Technology Stack

C++23 CMake 3.31+ Boost.JSON Eigen (ML) WebSocket REST APIs Lock-Free Queues Custom Decimal DLL Plugins Multi-Threaded MSVC / GCC / Clang Windows & Linux

System Architecture

ttTrader is built around a modular, event-driven architecture. Each component communicates through a central event dispatcher using lock-free queues — enabling true parallelism without synchronization overhead.

Exchange Manager
Market Data Mgr
Order ManagerLive / Sim
WebSocket ServerFrontend API
▼   ▼   ▼   ▼
⚡ Event Dispatcher Lock-Free · Multi-Producer · Multi-Consumer
▼       ▼       ▼
Algo #1DLL Plugin
Algo #2DLL Plugin
Algo #NDLL Plugin
Each algo compiles independently — hot-swappable without restarting other strategies

Market Data Pipeline

Every tick, every order book update, every trade — captured, normalized, and delivered to your strategy through a zero-copy, lock-free pipeline.

🔄

Trades (Tick Data)

Every trade: price, size, timestamp, and taker direction (buy/sell aggressor). Cumulative Volume Delta (CVD) is tracked on every tick for volume-pressure analysis. Circular buffer stores 16,384 most recent trades.

📖

Best Bid & Offer

Real-time BBO with price, size, spread tracking, and microsecond timestamps. 16,384-entry circular buffer for short-term microstructure analysis. Spread history maintained for real-time spread percentile calculations.

📚

Order Book (L2)

Full depth-of-book: up to 20 price levels per side in live trading, 5 levels during playback. Each level carries price + aggregated size. Book pressure and imbalance metrics computable at every update.

Algorithm Development

Strategies are implemented as independent DLL plugins. Derive from algoFramework_c, override the callbacks you need, and compile. No boilerplate, no ceremony.

Override What You Need

onMarketdataTick()
Every trade with price, size, CVD, taker direction
onMarketdataBbo()
Best bid/ask with integrated spread tracking
onMarketdataBook()
Full order book snapshot — 20 levels per side
onMarketdataOhlcClose()
OHLC bar completion with configurable timeframes
onOrderFill()
Execution confirmation with price, size, fee breakdown
onTimer()
Periodic callbacks for heartbeat, polling, or scheduled logic
// Your strategy — minimal boilerplate class MyAlgo : protected algoFramework_c { protected: void onMarketdataTick( instrumentInfo_s* instr, singleTradeInfo_s* trade ) override { // CVD divergence check if (detectDivergence(instr)) { m_orderManager.orderCreateLimit( instr, EOID_BUY_OPEN_LONG, size, limit, userId, "CVD entry" ); } } };

Order & Risk Management

📝

Order Types

Type Description
Market Execute immediately at best available price
Limit Resting order at specified price level
Stop-Market Trigger → market execution
Stop-Limit Trigger → limit order placement

TIF: GTC, FOK, IOC, GTD — all supported.

🛡️

Risk Controls

Method Usage
Fixed Risk Absolute USD risk per trade
Percent / BPS Risk as % of account or basis points
Min Size × Multiplier Scaled to instrument liquidity
Stop-Loss Engine OHLC-based, indicator-based, or ATR-multiplier stops

Pyramiding: Multiple concurrent positions per instrument with independent risk tracking.

Indicators & Machine Learning

Built-in technical indicators plus the ability to integrate custom ML models.

📐

Built-in Indicators

SMA, EMA, WMA, HMA, ZLHMA
MACD (with histogram)
RSI (Relative Strength Index)
Bollinger Bands (configurable σ)
ATR — Average True Range
Average Bar Range
Trading Range (High/Low)

All indicators accept OHLC data from any timeframe. Add custom indicators by implementing the indicatorCore interface.

🧠

ML & Advanced Analytics

Eigen Integration
Linear algebra, PCA, regression, Kalman filters for signal processing and regime detection — all header-only, zero runtime dependency.
Online Learning
Strategies can use online gradient descent or recursive least squares to adapt parameters in real-time based on PnL feedback.
Local LLM Integration
Connect to local LLM inference (llama.cpp) via IPC for regime classification and meta-decision making — no cloud dependency.
Neural Networks
Implement simple feed-forward NNs using Eigen matrices for pattern recognition on market microstructure features.

Playback & Backtesting

Record live market data, then replay it through the exact same event pipeline your strategy uses in production. No separate backtesting framework — no discrepancies.

Binary Recording Format (.ttpb v2)

Compact, efficient binary format stores trades, BBO, and order book snapshots (up to 5 levels).

Replay at original speed, accelerated, or stepped — full control over the simulation timeline. The built-in simulation engine fills orders against recorded BBO with configurable fee models, matching each exchange's actual maker/taker fee schedule.

Live Market → [.ttpb Record] → Disk

Disk → [Playback Engine] → Same Event Pipeline
                         → Your Algo (unchanged)
                         → Sim Engine fills orders

Exchange Integration

Each exchange implements a standardized protocol interface. Adding a new exchange means implementing exchangeProtocol.h — the rest of the framework doesn't change.

Exchange Data Execution Fee Note
Binance Trades, BBO, Book Market, Limit Standard maker/taker
Bybit Trades, BBO, Book Market, Limit Standard maker/taker
OKX Trades, BBO, Book Market, Limit Standard maker/taker
Bitfinex Trades, BBO, Book Market, Limit Standard maker/taker
Poloniex Trades, BBO, Book Market, Limit Standard maker/taker
Kraken Trades, BBO, Book Market, Limit Standard maker/taker
Bitstamp Trades, BBO, Book Market, Limit Standard maker/taker
Bitget Trades, BBO, Book Market, Limit Standard maker/taker
Hyperliquid Trades, BBO, Book Market, Limit Standard maker/taker
Paradex Trades, BBO, Book Market, Limit Standard maker/taker
Aster Trades, BBO, Book Market, Limit Standard maker/taker
Lighter Trades, BBO, Book Market, Limit Standard maker/taker
Phemex Trades, BBO, Book Market, Limit Standard maker/taker
Interactive Brokers Trades, BBO, Book Market, Limit Standard maker/taker

All exchanges provide futures/perpetual instruments. Spot, inverse, and vanilla futures supported where available.

Deployment Flexibility

🖥️

Local System

Run on your development machine or dedicated trading server. Full Windows and Linux support. Low barrier to entry for strategy development and testing.

☁️

AWS / Cloud

Deploy on EC2 instances in regions close to exchange data centers. Auto-scaling not needed — a single well-provisioned instance handles all strategies.

📍

Collocated

For latency-sensitive strategies: deploy on bare metal in exchange colocation facilities. The lock-free architecture ensures predictable, minimum latency.