How krrishapatel/exchange-simulator works
Exchange Simulator is a simulated trading venue with a C++ matching core, Python agents and training tools, market-data workflows, FIX connectivity, and a live dashboard. The main workflow is agents or replayed order flow submitting orders through Python bindings to the matching engine, which produces fills and book state for simulation and learning. README capabilities guide several links to unsampled modules; those links are cited to the README rather than implying their source was inspected.
Main entry points: py_exchange.cpp Python Bindings · self_play_env.py Self-Play Environment · matching_engine.cpp Matching Engine · fix_gateway.py FIX Gateway
Components 31
Exchange Core
- Order Types
engine/src/types.hpp - Order Book
engine/src/order_book.cpp - Matching Engine
engine/src/matching_engine.cpp - Multi-Asset Engine
engine/src/multi_asset_engine.cpp - Python Bindings
bindings/py_exchange.cpp
Agents and Simulation
- Agent Interface
agents/base.py - Random Agent
agents/random_agent.py - Market Maker
agents/market_maker.py - Simulation Loop
simulation/loop.py
Learning and Features
- Trading Environment
rl/trading_env.py - Self-Play Environment
rl/self_play_env.py - RL Training
rl/train_ppo.py - RL Evaluation
rl/evaluate.py - Tournaments and Elo
rl/analysis/tournament.py - Feature Engine
features/engine.py - Feature Dataset
features/dataset.py - Feature Labels
features/labels.py
Market Data
- Hawkes Flow
data/hawkes.py - Market Scenarios
data/scenarios.py - LOBSTER Replay
data/replay.py - Databento MBO
data/databento.py - Backtesting
data/backtest.py
External Interfaces
- FIX Gateway
gateway/fix_gateway.py - FIX Session
gateway/fix_session.py - FIX Parser
gateway/fix_parser.py - Dashboard Server
dashboard/server/app.py - Dashboard App
dashboard/frontend/src/App.jsx - Dashboard Views
dashboard/frontend/src/components
Other components
- Trading Agent
- FIX Client
- Dashboard Browser
Connections 32
- Matching Engine → Order Book: updates book
engine/src/matching_engine.cpp - Matching Engine → Order Types: uses orders
- Multi-Asset Engine → Matching Engine: routes symbols
- Python Bindings → Matching Engine: exposes engine
bindings/py_exchange.cpp - Python Bindings → Multi-Asset Engine: exposes multi-asset
bindings/py_exchange.cpp - Trading Agent → Python Bindings: submits orders
- Random Agent → Agent Interface: implements
agents/random_agent.py - Market Maker → Agent Interface: implements
agents/market_maker.py - Simulation Loop → Agent Interface: drives agents
- Simulation Loop → Python Bindings: uses engine
- Trading Environment → Python Bindings: uses engine
- Self-Play Environment → Python Bindings: submits orders
rl/self_play_env.py - Self-Play Environment → Random Agent: runs noise traders
rl/self_play_env.py - RL Training → Trading Environment: trains policy
- RL Training → Self-Play Environment: trains self-play
- RL Evaluation → Self-Play Environment: evaluates policies
rl/evaluate.py - Tournaments and Elo → Self-Play Environment: runs matches
rl/analysis/tournament.py - Tournaments and Elo → Order Types: scores fills
- Feature Dataset → Feature Engine: computes features
features/dataset.py - Feature Dataset → Feature Labels: builds labels
features/dataset.py - Hawkes Flow → Market Scenarios: configures flow
- LOBSTER Replay → Backtesting: feeds backtest
- Databento MBO → Backtesting: feeds backtest
- Backtesting → Python Bindings: replays through
- FIX Client → FIX Gateway: sends FIX
- FIX Gateway → FIX Session: manages session
gateway/fix_gateway.py - FIX Session → FIX Parser: parses messages
gateway/fix_session.py - FIX Gateway → Python Bindings: routes orders
- Dashboard Browser → Dashboard Server: streams ticks
- Dashboard App → Dashboard Server: receives ticks
- Dashboard App → Dashboard Views: renders views
dashboard/frontend/src/App.jsx - Dashboard Server → Simulation Loop: streams simulation