FastMM documentation
FastMM C++ API 0.14.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::EngineConfig Struct Reference

#include <fastmm/core/engine_config.hpp>

Public Attributes

std::uint64_t session_id = 0
 
std::uint64_t rng_seed = 1
 
std::uint16_t session_epoch = 1
 
std::uint32_t max_events_per_step = 64
 
Duration crossed_grace = milliseconds(100)
 
Duration latency_publish_interval = seconds(1)
 
bool publish_live = true
 The monitors' snapshots (live_stats(), the latency percentiles) are published every latency_publish_interval and on every change an operator sees.
 
Duration reject_log_interval = seconds(10)
 Risk rejects are logged at WARN: the first of each reason, then at most one line per reason per interval with the number suppressed in between (0 logs every reject).
 
Duration max_param_age {}
 [strategy] max_param_age_ms: quoting is disabled before the first ParamUpdate and while none was applied for this long (zero: off).
 
std::string state_file
 [strategy] state_file / state_interval_s (strategies/hooks.hpp KeepsState): the engine takes the strategy's state() every state_interval and at the end for whoever runs it to write to state_file (Engine::take_strategy_state; empty: never), and hands initial_state to restore() once, after on_start (empty: nothing to restore).
 
Duration state_interval = seconds(300)
 
std::string initial_state
 
std::uint32_t initial_state_version = 0
 The state_version initial_state was written with (the state file's head, a checkpoint's record): a backtest and a live session refuse bytes of another version before they start.
 
Duration checkpoint_interval {}
 [engine] checkpoint_s: with a journal, a checkpoint is written to it this often (StrategyStateMsg Kind::Snapshot: the strategy's state() when it keeps state, the positions and the open orders; zero: never).
 
std::vector< std::int64_t > markout_ms
 [engine] markout_ms: after each fill the record stream gets the instrument's mid at the fill and at each of these horizons (MarkoutRecord), at most kMaxMarkoutHorizons; empty: none.
 
Duration ack_timeout {}
 [engine] ack_timeout_ms: an order still waiting for its ack this long is force-cancelled, so a lost request cannot hold a pool slot, a max_open_orders slot and max_position exposure for good (zero: off).
 
Duration flatten_interval = milliseconds(500)
 Operator flatten (ControlCommand::Flatten, the control socket's flatten): how often the engine looks at the remaining position and sends the next reduce-only slice, how long it keeps trying (zero: until it is flat or the operator stops it) and the slippage allowance a flatten without --max-slippage-bps uses.
 
Duration flatten_timeout = seconds(60)
 
std::int64_t flatten_slippage_bps = 25
 
bool cancel_unknown_own = false
 [engine] cancel_unknown = "own": an open order a reconciliation (or an ack) reports that the OMS does not know is cancelled only when its client order id is FastMM's with an epoch from 1 to session_epoch; any other is left alone.
 
BaseFlows base_flows = BaseFlows::Off
 [engine] base_flows, base_flows_settle_s, base_flows_from: for every base asset of the spot instruments (one that is no instrument's quote), the accounts' total of it less the position of its instruments is measured once a second; a change that holds for base_flows_settle is a flow.
 
Duration base_flows_settle = seconds(30)
 
bool base_flows_from_zero = false
 
std::int64_t queue_conservatism_bps = 10'000
 [engine] queue_conservatism (a backtest: [backtest] queue_conservatism), in bps of 1: how much of a level's shrink ahead of our order the queue estimate (StrategyContext::queue_ahead) credits to cancels ahead of it.
 
Notional pnl_carry {}
 Net PnL carried over from earlier sessions ([risk] max_loss is a budget for the deployment, not per process); fastmm-live reads it from the durable kill state (core/session_state.hpp).
 
bool quoting_enabled = true
 
bool reduce_only = false
 [risk] reduce_only: the session starts in reduce-only mode for every instrument (ControlCommand::ReduceOnly turns it off).
 
std::uint32_t reduce_only_venues = 0
 [venues.<x>] reduce_only: ... for the instruments of these venues, bit per venue id.
 
std::uint32_t await_reconcile = 0
 Bit v: venue v's positions are not current until its first reconciliation ends.
 
std::vector< std::string > venue_names
 The venues' names ([venues.
 
int cpu = -1
 
SpinMode spin_mode = SpinMode::Busy
 
RiskLimits risk
 
FillClusterConfig fill_cluster
 [risk] fill_cluster_names, fill_cluster_window_ms, fill_cluster_hold_ms: quote fills on one side over that many instruments within the window hold the side everywhere for the hold (core/fill_cluster.hpp; names 0: off).
 
HazardConfig hazard
 [[risk.hazard]]: groups of instruments with a hazard score per side; evidence that takes it to the group's threshold pulls that side's quotes on the members for the hold (core/hazard.hpp; none: off).
 
WindowsConfig windows
 [[windows]]: recurring windows that pull a scope's quotes or hold it reduce-only while open, on the engine's clock (core/windows.hpp; none: off).
 
QuoteParams quotes
 
FxPlan fx
 [accounting]: the settlement currencies and their FX sources (inactive: nothing converted).
 
FeeTable fees
 Maker/taker rates per instrument (fee_table, config/config.hpp), what StrategyContext::fees reports.
 
UnderlyingPlan underlying
 [risk.underlying]: the underlyings with a net position limit and their instruments (inactive: none).
 
BalanceConfig balance
 [risk] check_balance and the initial margin rates ([[instruments]] initial_margin) the balance check and the estimate use (core/balance_book.hpp).
 
PerpConfig perp
 [accounting] mark, stale_mark_ms, stale_funding_ms: what a derivative's position is valued at and when the venue's mark, index and funding are stale (core/perp_book.hpp).
 
PoolPlan pools
 [venues.
 
PoolHomesPlan homes
 [venues.
 
CapacityConfig capacity
 [capacity]: the price of an order slot (core/capacity_price.hpp); mode off: none.
 

Member Data Documentation

◆ session_id

std::uint64_t fastmm::EngineConfig::session_id = 0

◆ rng_seed

std::uint64_t fastmm::EngineConfig::rng_seed = 1

◆ session_epoch

std::uint16_t fastmm::EngineConfig::session_epoch = 1

◆ max_events_per_step

std::uint32_t fastmm::EngineConfig::max_events_per_step = 64

◆ crossed_grace

Duration fastmm::EngineConfig::crossed_grace = milliseconds(100)

◆ latency_publish_interval

Duration fastmm::EngineConfig::latency_publish_interval = seconds(1)

◆ publish_live

bool fastmm::EngineConfig::publish_live = true

The monitors' snapshots (live_stats(), the latency percentiles) are published every latency_publish_interval and on every change an operator sees.

A backtest, which nobody watches, turns them off: what it records and computes is the same.

◆ reject_log_interval

Duration fastmm::EngineConfig::reject_log_interval = seconds(10)

Risk rejects are logged at WARN: the first of each reason, then at most one line per reason per interval with the number suppressed in between (0 logs every reject).

◆ max_param_age

Duration fastmm::EngineConfig::max_param_age {}

[strategy] max_param_age_ms: quoting is disabled before the first ParamUpdate and while none was applied for this long (zero: off).

◆ state_file

std::string fastmm::EngineConfig::state_file

[strategy] state_file / state_interval_s (strategies/hooks.hpp KeepsState): the engine takes the strategy's state() every state_interval and at the end for whoever runs it to write to state_file (Engine::take_strategy_state; empty: never), and hands initial_state to restore() once, after on_start (empty: nothing to restore).

The loader reads the file, not the engine.

◆ state_interval

Duration fastmm::EngineConfig::state_interval = seconds(300)

◆ initial_state

std::string fastmm::EngineConfig::initial_state

◆ initial_state_version

std::uint32_t fastmm::EngineConfig::initial_state_version = 0

The state_version initial_state was written with (the state file's head, a checkpoint's record): a backtest and a live session refuse bytes of another version before they start.

◆ checkpoint_interval

Duration fastmm::EngineConfig::checkpoint_interval {}

[engine] checkpoint_s: with a journal, a checkpoint is written to it this often (StrategyStateMsg Kind::Snapshot: the strategy's state() when it keeps state, the positions and the open orders; zero: never).

The bytes handed to restore() are written once at the start whenever there are some.

◆ markout_ms

std::vector<std::int64_t> fastmm::EngineConfig::markout_ms

[engine] markout_ms: after each fill the record stream gets the instrument's mid at the fill and at each of these horizons (MarkoutRecord), at most kMaxMarkoutHorizons; empty: none.

◆ ack_timeout

Duration fastmm::EngineConfig::ack_timeout {}

[engine] ack_timeout_ms: an order still waiting for its ack this long is force-cancelled, so a lost request cannot hold a pool slot, a max_open_orders slot and max_position exposure for good (zero: off).

◆ flatten_interval

Duration fastmm::EngineConfig::flatten_interval = milliseconds(500)

Operator flatten (ControlCommand::Flatten, the control socket's flatten): how often the engine looks at the remaining position and sends the next reduce-only slice, how long it keeps trying (zero: until it is flat or the operator stops it) and the slippage allowance a flatten without --max-slippage-bps uses.

◆ flatten_timeout

Duration fastmm::EngineConfig::flatten_timeout = seconds(60)

◆ flatten_slippage_bps

std::int64_t fastmm::EngineConfig::flatten_slippage_bps = 25

◆ cancel_unknown_own

bool fastmm::EngineConfig::cancel_unknown_own = false

[engine] cancel_unknown = "own": an open order a reconciliation (or an ack) reports that the OMS does not know is cancelled only when its client order id is FastMM's with an epoch from 1 to session_epoch; any other is left alone.

False ("all"): every one is cancelled.

◆ base_flows

BaseFlows fastmm::EngineConfig::base_flows = BaseFlows::Off

[engine] base_flows, base_flows_settle_s, base_flows_from: for every base asset of the spot instruments (one that is no instrument's quote), the accounts' total of it less the position of its instruments is measured once a second; a change that holds for base_flows_settle is a flow.

Measured from the session's first settled value, or from zero (from_zero: the position is to equal the accounts' balance, an offset at the start included).

◆ base_flows_settle

Duration fastmm::EngineConfig::base_flows_settle = seconds(30)

◆ base_flows_from_zero

bool fastmm::EngineConfig::base_flows_from_zero = false

◆ queue_conservatism_bps

std::int64_t fastmm::EngineConfig::queue_conservatism_bps = 10'000

[engine] queue_conservatism (a backtest: [backtest] queue_conservatism), in bps of 1: how much of a level's shrink ahead of our order the queue estimate (StrategyContext::queue_ahead) credits to cancels ahead of it.

10000: none.

◆ pnl_carry

Notional fastmm::EngineConfig::pnl_carry {}

Net PnL carried over from earlier sessions ([risk] max_loss is a budget for the deployment, not per process); fastmm-live reads it from the durable kill state (core/session_state.hpp).

◆ quoting_enabled

bool fastmm::EngineConfig::quoting_enabled = true

◆ reduce_only

bool fastmm::EngineConfig::reduce_only = false

[risk] reduce_only: the session starts in reduce-only mode for every instrument (ControlCommand::ReduceOnly turns it off).

◆ reduce_only_venues

std::uint32_t fastmm::EngineConfig::reduce_only_venues = 0

[venues.<x>] reduce_only: ... for the instruments of these venues, bit per venue id.

◆ await_reconcile

std::uint32_t fastmm::EngineConfig::await_reconcile = 0

Bit v: venue v's positions are not current until its first reconciliation ends.

A live session sets it for the venues that replay executions at connect: until then the position is the store's plus whatever the replay has booked so far, and an order sized, hedged or risk-checked on it could double a hedge or pass a limit. No order is sent and quoting stays off until every such venue has reconciled (journal header await_reconcile, so a replay does the same).

◆ venue_names

std::vector<std::string> fastmm::EngineConfig::venue_names

The venues' names ([venues.

<name>]), indexed by venue id: log lines name an instrument venue:symbol (Engine::venue_name; "venue \<id\>" for an id without one).

◆ cpu

int fastmm::EngineConfig::cpu = -1

◆ spin_mode

SpinMode fastmm::EngineConfig::spin_mode = SpinMode::Busy

◆ risk

RiskLimits fastmm::EngineConfig::risk

◆ fill_cluster

FillClusterConfig fastmm::EngineConfig::fill_cluster

[risk] fill_cluster_names, fill_cluster_window_ms, fill_cluster_hold_ms: quote fills on one side over that many instruments within the window hold the side everywhere for the hold (core/fill_cluster.hpp; names 0: off).

◆ hazard

HazardConfig fastmm::EngineConfig::hazard

[[risk.hazard]]: groups of instruments with a hazard score per side; evidence that takes it to the group's threshold pulls that side's quotes on the members for the hold (core/hazard.hpp; none: off).

◆ windows

WindowsConfig fastmm::EngineConfig::windows

[[windows]]: recurring windows that pull a scope's quotes or hold it reduce-only while open, on the engine's clock (core/windows.hpp; none: off).

◆ quotes

QuoteParams fastmm::EngineConfig::quotes

◆ fx

FxPlan fastmm::EngineConfig::fx

[accounting]: the settlement currencies and their FX sources (inactive: nothing converted).

◆ fees

FeeTable fastmm::EngineConfig::fees

Maker/taker rates per instrument (fee_table, config/config.hpp), what StrategyContext::fees reports.

The simulated venue charges fills with the same table; a live venue reports its own.

◆ underlying

UnderlyingPlan fastmm::EngineConfig::underlying

[risk.underlying]: the underlyings with a net position limit and their instruments (inactive: none).

◆ balance

BalanceConfig fastmm::EngineConfig::balance

[risk] check_balance and the initial margin rates ([[instruments]] initial_margin) the balance check and the estimate use (core/balance_book.hpp).

◆ perp

PerpConfig fastmm::EngineConfig::perp

[accounting] mark, stale_mark_ms, stale_funding_ms: what a derivative's position is valued at and when the venue's mark, index and funding are stale (core/perp_book.hpp).

◆ pools

PoolPlan fastmm::EngineConfig::pools

[venues.

<x>] pool_of: the accounts behind each venue (core/account_pool.hpp). A new order on an instrument whose venue has members goes to one of them (NewOrderRequest::account, else by balance and remaining order window), and the order keeps it.

◆ homes

PoolHomesPlan fastmm::EngineConfig::homes

[venues.

<primary>.pool]: each pool's placement, its planner's settings and the pinned homes (core/pool_homes.hpp). A pool without the table routes by balance and keeps no homes.

◆ capacity

CapacityConfig fastmm::EngineConfig::capacity

[capacity]: the price of an order slot (core/capacity_price.hpp); mode off: none.