AI Trading Bot
Building a Trading Simulation
This project started as a simple strategy tester for the MACD cross, then grew into a broader trading simulation platform. The goal was to create a risk-free environment for testing ideas before considering live execution. That meant building local streams for order book and OHLCVT data, then wiring those streams into a system that could evaluate signals, simulate trades, and track results. Kraken was used as the primary data provider because its API made market data easy to retrieve for local testing.
System Modules
As the project expanded, the architecture split into specialized modules that mirror pieces of an exchange-style backend. A simplified overview of the system:
- Data Collection Module - Streams real-time market data from Kraken.
- Asset Data Module - Maintains historical and real-time market data.
- Predictor Module - Processes historical data and generates trade signals.
- Exchange Portal - Facilitates simulated trade execution through API-style interfaces.
- Active Position Evaluator - Monitors open positions and risk rules.
- PnL Evaluator - Calculates real-time profit and loss.
- Results Data Holder - Stores trade outcomes for analysis and availability to the frontend.
The Shift to Machine Learning
After testing several rule-based strategies, the project shifted toward machine learning. TensorFlow was used to train and evaluate models against historical price data, simulated real-time streams, and order book context. The objective was not to promise profitable trades, but to build a controlled environment for testing whether model-generated signals could adapt better than static strategy rules.
Live Paper Trading and Future Prospects
The current direction is live paper trading: using real-time order book data and live market prices while keeping execution simulated. This keeps the project focused on validation, observability, and risk control before any real capital is involved. The main objective is to compare model behavior in live conditions against backtest expectations and understand where the system needs stronger safeguards.
Technology Stack
The platform follows an object-oriented design and uses the following technologies for its core functionality:
- Multiprocessing - Runs independent modules in parallel.
- Pandas - Handles data manipulation and analysis.
- NumPy - Supports numerical computing for large datasets.
- TensorFlow - Powers model training and signal experimentation.
- RESTful APIs - Connects system components through clear service boundaries.
- Flask + Queue - Coordinates communication and module interaction.
- JSON - Handles data serialization and exchange.