Building a trading simulation
The project started as a simple strategy tester for the MACD cross, then grew into a broader trading simulation platform. The goal was 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 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 specialised modules that mirror pieces of an exchange-style backend. Each runs as its own process, and they talk through clear service boundaries.
Data Collection
Streams real-time market data from Kraken.
Asset Data
Maintains historical and real-time market data.
Predictor
Processes historical data and generates trade signals.
Exchange Portal
Simulated trade execution through API-style interfaces.
Position Evaluator
Monitors open positions and risk rules.
PnL Evaluator
Calculates real-time profit and loss.
Results Store
Keeps trade outcomes for analysis and for the frontend.
The shift to machine learning
After testing several rule-based strategies, the project moved 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 never to promise profitable trades. It was to build a controlled environment for testing whether model-generated signals could adapt better than static strategy rules.
Live paper trading, and what's next
The current direction is live paper trading: real-time order book data and live market prices, with execution kept simulated. That keeps the work focused on validation, observability and risk control before any real capital is involved.
The main objective is to compare model behaviour in live conditions against backtest expectations, and to understand where the system needs stronger safeguards.
Technology
- Multiprocessing runs independent modules in parallel.
- Pandas handles data manipulation and analysis.
- NumPy supports numerical computing on large datasets.
- TensorFlow powers model training and signal experiments.
- REST APIs connect components through clear service boundaries.
- Flask + Queue coordinates communication between modules.
- JSON handles serialisation and data exchange.