Skip to content

C++ API

Generated by Doxygen from the headers listed in docs/api/public-headers.txt. Tier 1 is the strategy, testing, backtest and live API; tier 2 is the venue, codec, network and configuration extension API; Public API says what each tier promises. Unlisted headers are internal and not documented here.

Browse the whole set: classes and structs, concepts, namespaces, headers, members. The sidebar search box covers this reference only.

Prose counterparts: Strategy API, Fixed point, Journal format, Architecture.

Strategies

A strategy is a class template parameter, not a base class with virtual functions (ADR-0009); the engine detects the hooks it defines.

Type What it is
StrategyLike what a type must provide to be a strategy
StrategyBase optional base: parameters and their schema
strategies/hooks.hpp the hook set the engine probes for, and verify_strategy
StrategyContext the hook argument: quoting, orders, instruments, positions, timers, clock
FeeRates an instrument's maker and taker rates (ctx.fees)
RiskHeadroom what each risk limit still admits (ctx.risk_headroom)
VenueHealthView a venue's feed lag and order round trip (ctx.venue_health)
HedgeExecutor hedges a strategy's positions on other instruments, with failover and de-risking
StrategyRegistry name to factory, for fastmm-live and fastmm-backtest
StrategyEntry one registry entry
ParamPublisher publishes parameters to the trading thread
sim::StrategyHarness drives a strategy from a test

Quoting

Type What it is
QuoteManager diffs desired quotes against resting orders into New / Cancel / Replace
DesiredQuotes what the strategy wants resting, per side
QuoteParams hysteresis, re-quote interval, reject back-off
QuoteAction one action the caller executes
QuoteStats counters per reconcile

Orders and positions

Type What it is
Oms the order state machine: open orders, acks, fills, cancels
Order one order as the OMS holds it
OmsUpdate what changed after a venue message
PositionTracker position, average price and realised PnL per instrument
Position one instrument's position
Portfolio PnL totals across instruments
Fill one execution

Instruments, prices and time

Type What it is
Fixed<Tag> the fixed-point type behind Price, Qty and Ratio (8 decimals)
core/fixed_point.hpp Price, Qty, Ratio, the _px / _qty / _bps literals
Instrument tick size, lot size, fees, rounding
InstrumentTable dense InstrumentId to Instrument
StrongId InstrumentId, VenueId, ClientOrderId and the other typed ids
Timestamp nanoseconds since the epoch
Duration a nanosecond interval
Cycles raw TSC ticks, for latency timestamps
core/enums.hpp Side, OrderType, TimeInForce, EventType, Liquidity

Books and messages

Type What it is
BookView what a hook may read from a book
L2Book the aggregated depth book the engine maintains
BookSyncer snapshot plus delta resynchronisation
Level one price level
EventHeader the 64-byte header every event starts with
core/messages.hpp every event struct: book, trade, order, control
BookDeltaMsg a depth update or snapshot
BookTickerMsg best bid and ask
TradeMsg a public trade
OrderAckMsg the venue accepted an order
OrderFillMsg a fill on one of our orders
OrderRejectMsg the venue rejected an order

Backtest and replay

Type What it is
bt::BacktestRunner runs a strategy over a data source
bt::BacktestConfig instruments, fees, latency, seed
bt::BacktestResult fills, equity curve, orders, metrics
bt::Metrics PnL, Sharpe, drawdown, fill ratio
backtest/replay.hpp replays a journal, and bt::ReplayResult
backtest/sweep.hpp parameter sweeps and walk-forward folds, and bt::SweepPoint
bt::DataSourceLike what a data source must provide
bt::CsvSource CSV input
bt::JournalSource a recorded session as input
bt::SyntheticSource generated input
bt::ArraySource arrays in memory, used by the Python bindings

Venues

The connectors (Binance Spot and USDⓈ-M, Bybit, Deribit, Nasdaq ITCH) are internal; these are the interfaces a new one implements (Add a venue).

Type What it is
venues::Venue the connector interface the engine drives
venues::MarketDataFeed the market-data half
venues::OrderGateway the order half
venues::VenueCaps what a venue supports (replace, post-only, WebSocket order entry, user stream)
venues::EventSink where a connector writes events
venues::OrderCommand New, Cancel or Replace on its way out
venues::RateLimiter token buckets per endpoint
venues::RestChannel signed REST requests off the trading thread
venues::SymbolTable venue symbol to InstrumentId
venues::JsonWriter allocation-free JSON for order messages
venues::RawRecorder records the raw wire bytes

Network

Hand-written, no third-party event loop (ADR-0007); built only with FASTMM_BUILD_NET.

Type What it is
net::Reactor the event loop the connections run on (epoll or io_uring)
net::Connection one TCP or TLS connection
net::WsClient WebSocket client
net::HttpClient HTTP/1.1 client
net::Url URL parsing
net::ExponentialBackoff reconnect timing
net/crypto.hpp HMAC-SHA256 and Ed25519 request signing
net::UdpSocket multicast receive
net::DatagramSource the interface the three receive paths share
net::KernelDatagramSource recvmmsg
net::XdpDatagramSource AF_XDP
net::DpdkDatagramSource DPDK

Codecs

Type What it is
codecs::Framer bytes to frames
codecs::Decoder frames to events
codecs::Encoder commands to bytes
codecs::SessionLayer logon, heartbeats, sequence numbers
codecs::FrameView one frame in the receive buffer

The protocol implementations (FIX, Nasdaq ITCH and OUCH, CME MDP 3.0) are internal; the wire formats are documented in FIX 4.4, Nasdaq ITCH and OUCH and CME MDP 3.0. FIX and CME MDP 3.0 have no connector behind them yet and are built only with -DFASTMM_CODEC_FIX=ON / -DFASTMM_CODEC_MDP3=ON (Optional codecs).

Simulation and live

Type What it is
sim::ParamSchedule scheduled parameter changes in a simulated run
live::LiveOptions one live session's settings
live::LiveStrategy the strategy a live session runs
live::LiveBackend the transport a live session runs on
fastmm::cli the main() bodies of fastmm-backtest, fastmm-replay and fastmm-live

Configuration, logging and options

Type What it is
Config the parsed TOML document
config/schema.hpp the key tables that generate Configuration
EngineConfig the engine's own settings
Logger the off-thread logger and FASTMM_LOG_*
Result<T, E> the return type used instead of exceptions (ADR-0002)
fastmm::options Black-76 pricing and Greeks (Options)