The Problem: Standard backtesters assume zero latency, infinite liquidity, and perfect execution. The Solution: "The Mirror" simulates the chaotic reality of live markets—Network Jitter, Queue Position, and Packet Loss.
- Level 3 Matching Engine: Full Price-Time Priority Limit Order Book (LOB).
- Realistic Network Modeling: Gamma Distribution for latency (Co-lo to WiFi).
- The "Crystal Ball": Tracks exactly where your order sits in the queue.
- 100% Deterministic: Seeded RNG ensures perfect regression testing.
MatchingEngine: Manages the LOB and FIFO logic.LatencySimulator: Intercepts orders with seeded network delays.MarketDataReplayer: Streams Tick-by-Tick (L3) data.SimulationRunner: Priority Queue event loop orchestrating time.
- Install:
pip install -r requirements.txt - Run Sim:
python src/simulation.py - Test:
python tests/test_determinism.py
For educational and research purposes only. Not financial advice.
MIT License