This project is a real-time space trading simulation engine built on top of the SpaceTraders.io API. It simulates player actions such as travel, mining, and market interaction with realistic delays and state tracking. The system also includes a database-backed backend with route planning, fuel tracking, and early support for predictive analytics.
- Asynchronous event handling (e.g., travel, mining, docking).
- Uses
asyncioto simulate real-time travel durations. - Event consumers powered by Kafka.
- Complete universe mapped and stored with coordinates using PostGIS.
- Real-time ship location updates and travel path simulation.
- Distance calculation between waypoints using geospatial data.
- Tracks individual ships’ fuel, location, navigation state (DOCKED, IN_ORBIT, IN_TRANSIT).
- Automatically transitions between DOCKED ↔ ORBIT ↔ TRANSIT.
- Logs all trips with timestamps and travel durations.
- Logs fuel usage for all travel events.
- Warns when a trip might fail due to insufficient fuel.
- Plans for ML-based prediction of fuel requirements based on:
- Ship type
- Distance
- Historical travel logs
- Smart
start_tripvalidator with fuel & cooldown checks. - Predictive travel planning (ETA, refuel suggestions).
- Streamlit dashboard to visualize universe, ship paths, and analytics.
- Autonomous trader bot to monitor markets and plan profitable trades.
| Layer | Tools / Libraries |
|---|---|
| Backend Engine | Python, asyncio, requests, FastAPI (optional) |
| Messaging Queue | Kafka (Confluent-compatible) |
| Database | PostgreSQL with PostGIS extension |
| ORM | SQLAlchemy |
| Geospatial Logic | PostGIS, Shapely |
| ML Pipeline (WIP) | Scikit-learn, pandas (planned) |
| Infrastructure | Docker, Kafka CLI, Python dotenv |
- Python 3.9+
- Docker & Docker Compose
- Kafka & Zookeeper (local or Confluent Cloud)
git clone https://github.com/your-username/SpaceTraderAnalyst.git
cd SpaceTraderAnalyst
python -m venv env
source env/bin/activate # or `.\env\Scripts\activate` on Windows
pip install -r requirements.txt