How timur-ten/ttrade works
TTrade is a crypto market-data, paper-trading, and research platform: Binance data is parsed and synchronized into an order book, strategies drive simulated execution, and recorded raw feeds can be replayed through the same engine for performance reporting. C++ owns the latency-sensitive feed, book, strategy, and simulation path; .NET services consume ZeroMQ/Protobuf events for persistence, risk, analytics, and REST queries. The graph includes documented capabilities whose implementation was not sampled, but limits their internal wiring to what the README or sampled entry points support.
Main entry points: trading_engine.cpp Trading engine · bus ZeroMQ / Protobuf bus · main.cpp Live trader · feed Feed clients
Components 28
C++ market data
- Trade feed handler
cpp/apps/feedhandler/main.cpp - Book builder
cpp/apps/bookbuilder/main.cpp - Tape recorder
cpp/apps/recorder/main.cpp - Binance parser
cpp/libs/feed/src/binance_parser.cpp - Feed clients
cpp/libs/feed - Tape reader/writer
cpp/libs/feed/src/tape.cpp - Book synchronization
cpp/libs/book/src/synchronizer.cpp - Order book
cpp/libs/book/src/order_book.cpp
Trading and research
- Live trader
cpp/apps/trader/main.cpp - Backtester
cpp/apps/backtester/main.cpp - Trading engine
cpp/libs/engine/src/trading_engine.cpp - Trading strategies
cpp/libs/strategy - Exchange simulator
cpp/libs/sim/src/exchange_simulator.cpp - Performance analytics
cpp/libs/analytics/src/performance.cpp
.NET services
- Market data subscriber
csharp/src/TTrade.MarketData - Risk monitor
csharp/src/TTrade.Risk - Analytics service
csharp/src/TTrade.Analytics
Messaging and observability
- ZeroMQ / Protobuf bus
cpp/libs/bus - Protobuf contracts
proto - Prometheus metrics
cpp/libs/metrics
Persistence and API
- Persistence recorder
csharp/src/TTrade.Persistence - Timescale writer
csharp/src/TTrade.Persistence/TickWriter.cs - TimescaleDB
- REST gateway
csharp/src/TTrade.Gateway/Program.cs - Market data repository
csharp/src/TTrade.Gateway/MarketDataRepository.cs
Other components
- Binance
- Operator / user
- Grafana
Connections 36
- Binance → Feed clients: streams / snapshots
- Trade feed handler → Feed clients: opens stream
- Trade feed handler → Binance parser: parses trades
- Trade feed handler → ZeroMQ / Protobuf bus: publishes trades
- Book builder → Feed clients: opens stream / REST
- Book builder → Binance parser: parses depth
- Book builder → Book synchronization: synchronizes diffs
- Book synchronization → Order book: updates book
- Book builder → ZeroMQ / Protobuf bus: publishes book
- Tape recorder → Feed clients: captures stream
- Tape recorder → Tape reader/writer: writes raw records
- Live trader → Feed clients: opens stream / REST
- Live trader → Trading engine: feeds messages
- Trading engine → Binance parser: parses payloads
- Trading engine → Book synchronization: synchronizes updates
- Trading engine → Order book: maintains book
- Trading engine → Trading strategies: dispatches market events
- Trading engine → Exchange simulator: simulates execution
- Live trader → ZeroMQ / Protobuf bus: publishes fills / state
- Live trader → Prometheus metrics: records metrics
- Operator / user → Live trader: selects strategy
- Backtester → Tape reader/writer: replays records
- Backtester → Trading engine: feeds recorded events
- Backtester → Performance analytics: builds report
- Backtester → Trading strategies: selects strategy
- Market data subscriber → ZeroMQ / Protobuf bus: subscribes to trades
- Market data subscriber → Persistence recorder: streams market data
- Persistence recorder → ZeroMQ / Protobuf bus: subscribes to events
- Persistence recorder → Timescale writer: records data
- Timescale writer → TimescaleDB: writes hypertables
- REST gateway → Market data repository: handles queries
- Market data repository → TimescaleDB: reads market data
- Operator / user → REST gateway: queries REST API
- Risk monitor → ZeroMQ / Protobuf bus: consumes positions / sends commands
- Analytics service → ZeroMQ / Protobuf bus: consumes trading events
- Grafana → Prometheus metrics: scrapes metrics