|
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
|
| ▼ fastmm | |
| ► backtest | |
| array_source.hpp | ArraySource: zero-copy structure-of-arrays input, the numpy path of the Python bindings (8.5) |
| backtest_config.hpp | BacktestConfig: everything a run needs, assembled from the TOML sections [engine] [[instruments]] [strategy] [strategy.params] [risk] [venues |
| backtest_runner.hpp | BacktestRunner (8.4): wires Engine<S, SimClock, SimTransport, InlineFeed> to a SimDriver and collects a BacktestResult |
| csv_source.hpp | CsvSource: hand-rolled parser for the row format documented in data_source.hpp (ts_ns,type,inst,side,price,qty,seq, optional header line, '#' comments) |
| data_source.hpp | DataSource (8.4): a timestamp-ordered stream of normalized market-data events consumed by the simulator |
| fee_model.hpp | Fees are charged by the simulated venue, so the model lives in fastmm::sim; the backtest exposes it under its own namespace for configuration and reporting |
| journal_source.hpp | JournalSource: market-data events of an .fmj journal (BookDelta / BookSnapshot / Trade / BookTicker records, in sequence order) |
| live_analysis.hpp | What a live session's fills were worth, from its journal alone (fastmm-data analyze): per instrument and overall, the fills, maker share and traded notional, the spread they captured against the venue mid and their markouts and adverse selection at each horizon (markout.hpp), next to the order traffic |
| markout.hpp | Post-fill markouts: the metric that separates spread captured from adverse selection |
| metrics.hpp | Metrics (8.4) computed from the result rows: equity bars (1 s by default), fills and orders |
| replay.hpp | Deterministic replay (5.11): runs Engine<S, SimClock, ReplayTransport, JournalFeed> over a session journal recorded by fastmm-live, a sim or a backtest run (BacktestConfig::journal_out) and proves that the engine reproduces the recorded outbound stream bit for bit |
| result.hpp | BacktestResult (8.4): structure-of-arrays rows (numpy-friendly: each column is one contiguous vector) plus the summary Metrics and the raw counters of every component |
| sweep.hpp | Parameter sweep (8.4/8.5): cartesian grid over strategy parameters run on a std::jthread pool; every worker owns its own data cursor (source_factory) and backend, results come back in grid order (first parameter varies slowest) |
| synthetic_source.hpp | SyntheticSource: a MarketGenerator run against its own MatchingEngine, published through MdAggregator as a plain market-data stream (snapshot, 100 ms depth batches, trades, book tickers) |
| ► cli | |
| backtest.hpp | Fastmm::cli::backtest: the fastmm-backtest command line as a library function (fastmm::backtest) |
| live.hpp | Fastmm::cli::live: the fastmm-live command line as a library function (fastmm::live), so a strategy project's live app is a 3-line main: |
| replay.hpp | Fastmm::cli::replay: the fastmm-replay command line as a library function (fastmm::backtest) |
| ► codecs | |
| codec.hpp | Protocol codec concepts (plan 7) |
| ► config | |
| config.hpp | Typed configuration (8.7) |
| env_subst.hpp | ${VAR} environment substitution for [venues |
| schema.hpp | Declarative config schema (8.7): every known key with its section, type and whether it is required |
| ► core | |
| ► book | |
| book_syncer.hpp | BookSyncer: venue-agnostic snapshot/delta synchronisation FSM (5.4), instantiated per instrument on the net thread |
| book_view.hpp | BookView: the read interface every book implementation (L2Book, L3Book::to_l2 view, sim book) exposes to strategies and risk |
| l2_book.hpp | L2Book<kMaxDepth>: price-aggregated book for crypto feeds (5.4) |
| ► options | |
| black76.hpp | Black-76 option pricing, greeks and implied volatility (options on a forward / futures price) |
| engine_config.hpp | EngineConfig: the per-session settings an Engine is constructed with |
| enums.hpp | All engine enumerations |
| fees.hpp | Fee rates per instrument, in centi-basis-points (integer) of the fill notional |
| fixed_point.hpp | Fixed<Tag>: int64 fixed point with a global 1e-8 scale (ADR-0001) |
| instrument.hpp | Instrument: the single definition of a tradable contract (5.3 / 5.15) |
| log.hpp | Asynchronous logging (5.10) |
| messages.hpp | Event bus message structs (5.5) |
| oms.hpp | Order management (5.8): a Pool<Order> + OpenHashMap<ClientOrderId, Handle> + a ring of recently terminal ids used to classify late venue messages |
| order.hpp | Order: the OMS's 128-byte record for one order across its lifetime |
| position.hpp | Position tracking, average-cost method (5.8) |
| quote_diag.hpp | Why a side of an instrument is or is not quoting (ctx.note_quote, the status file's quote table): what the strategy last asked for on the side against the orders working there, the first thing the engine finds in the way, and the strategy's own reason and budget for the side |
| quote_manager.hpp | QuoteManager (5.6): diffs the strategy's DesiredQuotes against the orders resting at the venue and emits the minimal set of New / Cancel / Replace actions |
| record_stream.hpp | Record stream: the engine's second outbound queue, next to the journal |
| result.hpp | Minimal expected<T, E>: the hot path never throws, it returns Result |
| risk_limits.hpp | RiskLimits: the pre-trade limits a session runs with ([risk] in the configuration), and RiskHeadroom, what they still admit (RiskEngine::headroom, StrategyContext::risk_headroom) |
| rng.hpp | Xoshiro256** - the engine's only source of randomness; seeded from config and written to the journal header so replays are bit-exact |
| session_state.hpp | State that survives a process restart: the session epoch (client order ids) and the latched risk state (kill switch and cumulative PnL) |
| strategy_context.hpp | StrategyContext: the API a strategy sees (ADR-0012, section 2) |
| strong_id.hpp | Strongly typed identifiers |
| time.hpp | Time primitives |
| transfer.hpp | An internal transfer: an amount of one asset moved between two accounts of the same exchange (the accounts of a pool, core/account_pool.hpp), as a connector that can do it carries it out (venues::Venue::transfer, VenueCaps::internal_transfer) and the pool treasury asks for it (core/treasury.hpp) |
| venue_health.hpp | VenueHealth: per venue, how late its market data arrives and how long our orders take to be acknowledged, from the events the engine consumes (engine thread only) |
| ► live | |
| live_backend.hpp | LiveBackend: what RunnerDeps::backend points at for TransportKind::Live |
| session.hpp | Run_live(): wires venues, rings, the engine and the journal into the plan 5.1 thread model and runs a session (fastmm::live, src/live/session.cpp) |
| ► net | |
| backoff.hpp | Exponential backoff with jitter for reconnects: delay_n = cap_n * (1 - jitter) + U(0, cap_n * jitter) where cap_n = min(max_ms, base_ms * 2^n) |
| connection.hpp | Resilient WebSocket connection: DNS -> TCP -> TLS -> WS upgrade -> auth -> subscribe -> Live, with stale/dead detection, exponential backoff reconnects, and make-before-break rollover ahead of the venue's connection lifetime limit (Binance: 24 h) |
| crypto.hpp | Cryptographic primitives needed by the venue connectors: HMAC-SHA256 (REST/WS signing), HMAC-SHA384 (Gemini), SHA-1 (WebSocket accept key), SHA-256, base64 and base64url (own implementation), CSPRNG bytes, Ed25519 (Binance session logon / Ed25519 API keys) and ECDSA P-256 (ES256 JWTs of Coinbase CDP keys) |
| datagram_source.hpp | Datagram receive interface for multicast market data (ADR-0015, section 1) |
| dpdk_datagram_source.hpp | DPDK datagram source (rx_backend = "dpdk"): one ethdev port, one RX and one TX queue polled from the venue's network thread |
| http_client.hpp | Keep-alive HTTP/1.1 client over any ByteStream: one request in flight per connection plus a small FIFO, response bodies framed by Content-Length / chunked / connection-close, and a per-request reactor timer |
| kernel_datagram_source.hpp | kernel DatagramSource (ADR-0015, section 2): one UDP socket per subscription, bound to the group and port, SO_REUSEADDR, IP_MULTICAST_ALL off, joined any-source or source-specific (a unicast "group" is a local address: bound, not joined); recvmmsg in fixed batches; SO_TIMESTAMPING for kernel and NIC receive times |
| reactor.hpp | Single-threaded event loop with a timer min-heap and a thread-safe mailbox (post/wake via eventfd), over one of two backends chosen at construction: |
| udp_socket.hpp | Non-blocking IPv4 UDP socket with RAII fd ownership: multicast membership, batch receive (recvmmsg) and send (sendmmsg), SO_TIMESTAMPING and busy-poll options |
| url.hpp | Minimal URL parsing / query building for venue endpoints |
| ws_client.hpp | RFC 6455 WebSocket client over any ByteStream, driven by a Reactor |
| xdp_datagram_source.hpp | AF_XDP datagram source (ADR-0015, section 3): one XDP socket per (interface, RX queue), each with its own UMEM, fill and RX rings (the completion ring exists because bind requires it) |
| ► research | |
| extractor.hpp | Extract_features(): drives an MdSource into the engine's own L2Book and emits a FeatureTable |
| feature_table.hpp | FeatureTable: book features and forward mid moves, one row per qualifying market-data event, so a predictor can be judged before anyone writes a strategy around it |
| signal_eval.hpp | Evaluate_signal(): what a candidate predictor is worth, per horizon, before anyone writes a strategy around it |
| ► sim | |
| param_schedule.hpp | ParamSchedule: parameter updates of a backtest, delivered to the engine at simulated times (ADR-0013) |
| ► store | |
| backend.hpp | Storage backend interface: what a session's fills, orders, positions, PnL and kill events are handed to, so they can be queried without replaying the journal |
| reader.hpp | Query side of a storage backend: what fastmm-pnl and a restarting session read back |
| registry.hpp | Storage backend registry: name -> factories |
| sqlite_store.hpp | The SQLite storage backend ([storage] backend = "sqlite"), the one FastMM ships |
| store_thread.hpp | StoreThread: drains the engine's record ring into a Backend, on its own thread |
| ► strategies | |
| factories.hpp | Every factory definition (Sim, Replay, Live) |
| factory_live.hpp | Definition of fastmm::live_factory<S> (declared in strategies/module.hpp): builds Engine<S, TscClock, LiveTransport, RingFeed> on the live::LiveBackend that RunnerDeps::backend points at |
| factory_replay.hpp | Definition of fastmm::replay_factory<S> (declared in strategies/module.hpp): builds Engine<S, SimClock, ReplayTransport, JournalFeed> on the sim::ReplayBackend that RunnerDeps::backend points at |
| factory_sim.hpp | Definition of fastmm::sim_factory<S> (declared in strategies/module.hpp): builds Engine<S, SimClock, SimTransport, InlineFeed> on the sim::SimBackend that RunnerDeps::backend points at |
| hedge_executor.hpp | HedgeExecutor: keeps a strategy's exposure hedged with taker orders (docs/how-to/strategies/ hedge-executor.md) |
| hooks.hpp | Strategy hooks (ADR-0012): the hook table, the compile-time checker and the Fill view |
| module.hpp | Strategy modules (ADR-0012, section 5): one registration function per strategy library |
| param_publisher.hpp | ParamPublisher: builds ParamUpdate messages for a running engine, off the engine thread (ADR-0013) |
| params.hpp | Strategy parameter schema (8.6, ADR-0012) |
| quoting.hpp | Quoting helpers for strategies (ADR-0012): integer-only, noexcept, no allocation |
| registry.hpp | Strategy registry (8.6, ADR-0012): name -> parameter schema + one factory per transport kind, each producing an IEngineRunner |
| strategy.hpp | Strategy concept and the StrategyBase helper (8.6) |
| ► testing | |
| strategy_harness.hpp | StrategyHarness<S>: test a strategy's hooks against the real engine (ADR-0012, section 8) |
| ► venues | |
| blocking_http.hpp | BlockingHttp: one synchronous HTTPS request on a private Reactor + HttpClient |
| connection_slot.hpp | ConnectionSlot<Handler>: owns either a plain-TCP or a TLS net::Connection depending on the URL scheme (ws:// for the local simulator, wss:// for the testnets) and forwards the control operations |
| dead_mans_switch.hpp | Venue-side dead man's switch: the venue cancels the account's resting orders when the connector stops talking to it, whatever the reason |
| decimal.hpp | Exact decimal helpers for venue payloads (6.2) |
| error_action.hpp | Venue error classification shared by every connector's error map: the engine-facing RejectReason plus what the connector itself must do (cool down, resync the clock, reconcile, stop) |
| event_sink.hpp | EventSink (5.15): the net -> engine seam |
| feed.hpp | Hot-path connector concepts (6.2) |
| json_writer.hpp | JsonWriter: append-only JSON builder over a caller-provided fixed buffer (no heap) |
| order_commands.hpp | OrderCommand: a uniform, non-owning view over the three outbound engine messages (OutNewOrderMsg / OutCancelMsg / OutReplaceMsg) so encoders switch on one enum instead of three message types |
| order_events.hpp | Helpers that build the normalised order/connection events a connector emits from its control logic (WebSocket API responses, REST replies, local rejects) |
| padded_json.hpp | PaddedJson: owns a copy of a JSON text with kJsonPadding zero bytes behind it so the decoders (which assume RecvBuffer-style padding) can be driven from fixtures, tests and benchmarks |
| rate_limiter.hpp | RateLimiter (6.4/6.5): client-side accounting of venue rate limits so we refuse to send before the venue does |
| raw_recorder.hpp | RawRecorder: appends every raw WebSocket frame to <dir>/<venue>-<channel>.jsonl (one frame per line, prefixed with the receive timestamp; binary frames as hex) so fixtures can be captured from a live session (fastmm-live --record-raw DIR, plan 8.8) |
| registry.hpp | Venue registry: [venues |
| request_id.hpp | Request ids shared by the JSON order-entry encoders: "\<kind\>\<cl_ord_id\>" with kind n/c/r/a (1 + 14 chars), so a WebSocket API response maps back to the command with no lookup table |
| rest_channel.hpp | RestChannel: reactor-driven keep-alive HTTP(S) client with lazy (re)connection, for the venue control requests that run on the net thread (depth snapshots, openOrders, listenKey keepalive, order-entry REST fallback) |
| symbology.hpp | SymbolTable (6.2): venue symbol <-> InstrumentId |
| venue.hpp | Venue: the control-path interface every exchange connector implements (6.2) |
| wire_latency.hpp | Network-thread order latency: what happens to an outbound order after the engine pushed it into the venue's outbound ring |
| strategy.hpp | Everything a strategy header needs (ADR-0012): |