29#include "fastmm/core/engine.hpp"
31#include "fastmm/core/treasury.hpp"
32#include "fastmm/sim/market_generator.hpp"
33#include "fastmm/sim/sim_transport.hpp"
46inline constexpr std::array<std::string_view, 8>
kSweepSettings = {
"latency_fixed_us",
49 "latency_md_jitter_us",
166 std::map<std::string, std::vector<std::string>>
param_groups;
199 void set_market_bps(
double spread_bps,
double mid_step_bps,
double depth_bps);
206 bool set_setting(std::string_view key, std::string_view value);
208 void set_param(
const std::string& key,
const std::string& value) {
params[key] = value; }
Definition config.hpp:502
Dense-by-id table built at startup; symbol lookup is a sorted FlatMap keyed by (venue,...
Definition instrument.hpp:147
Typed configuration (8.7).
Instrument: the single definition of a tradable contract (5.3 / 5.15).
Definition backtest_config.hpp:44
InitialState
Where the strategy's starting state comes from ([backtest] initial_state).
Definition backtest_config.hpp:58
@ StateFile
[strategy] state_file, when set
@ None
nothing: the strategy starts fresh
@ Journal
the data journal's (journal_state.hpp), with the session's positions
constexpr double kDefaultMidStepBps
Definition backtest_config.hpp:70
constexpr double kDefaultSpreadBps
The [sim] defaults of a configuration file: a liquid crypto pair.
Definition backtest_config.hpp:69
constexpr double kDefaultDepthBps
Definition backtest_config.hpp:71
constexpr std::array< std::string_view, 8 > kSweepSettings
The backtest settings a sweep's point can vary besides the strategy's parameters (BacktestConfig::set...
Definition backtest_config.hpp:48
constexpr Duration milliseconds(std::int64_t v) noexcept
Definition time.hpp:38
constexpr Duration seconds(std::int64_t v) noexcept
Definition time.hpp:41
std::map< std::string, std::string > ParamMap
Definition params.hpp:119
Strategy parameter schema (8.6, ADR-0012).
Definition config.hpp:329
bool enabled() const noexcept
Definition config.hpp:345
std::int64_t ns
Definition time.hpp:23
Definition engine_config.hpp:41
Definition backtest_config.hpp:80
double initial_capital
reporting only (drawdown %)
Definition backtest_config.hpp:91
std::vector< StartPosition > positions
[backtest.positions]: the engine's positions at the start, by instrument. They replace the
Definition backtest_config.hpp:143
MsgRing * record_ring
Where the engine puts its records (core/record_stream.hpp), as fastmm-live hands them to the store: t...
Definition backtest_config.hpp:109
bool latency_from_journal
[backtest] latency_from_journal: the simulated venues take a message's latency from the data journal'...
Definition backtest_config.hpp:154
AccountingSpec accounting
[accounting] and the venue names its sources name (Config::venues order).
Definition backtest_config.hpp:94
UnderlyingPlan underlying_plan(const InstrumentTable &table) const
The [risk.underlying] plan for table (throws ConfigError when the spec does not fit it).
std::string path
Definition backtest_config.hpp:103
std::vector< TreasuryConfig > treasuries
The pool treasuries ([venues.
Definition backtest_config.hpp:128
void set_market_bps(double spread_bps, double mid_step_bps, double depth_bps)
The synthetic market in basis points of generator.start_mid, turned into ticks of generator....
std::string strategy
registry name (apps / Python); ignored by run_backtest<S>()
Definition backtest_config.hpp:83
std::string config_toml
Effective configuration embedded in journal_out (Config::effective_toml(); from_config() sets it,...
Definition backtest_config.hpp:113
InstrumentTable instruments
Definition backtest_config.hpp:82
std::string output_dir
Definition backtest_config.hpp:104
std::map< std::string, std::vector< std::string > > param_groups
[strategy.groups] and [strategy.overrides]: parameters per instrument, set at the start (strategies/p...
Definition backtest_config.hpp:168
bool balances_from_journal
Start each venue's account (transport.accounts) from the first balance snapshot the journal source re...
Definition backtest_config.hpp:124
Duration reorder_window
Recorded data reaches the simulated venue in venue-time order (sim/venue_order.hpp),...
Definition backtest_config.hpp:180
static BacktestConfig single_instrument(std::string_view symbol, Price tick, Qty lot)
One instrument (venue 0) with the given tick/lot; generator tick/lot follow (examples).
std::string source
"synthetic" | "journal" | "csv" | "" (caller supplies the source)
Definition backtest_config.hpp:102
bool params_from_journal
The data journal's parameter updates reach the strategy at the times the session received them (sim::...
Definition backtest_config.hpp:157
InitialState initial_state
The strategy's starting state; Journal also starts the engine's positions where the recorded session ...
Definition backtest_config.hpp:138
static BacktestConfig from_config(const Config &cfg)
Throws ConfigError on invalid values.
int ab_arm
[ab] assignment = "branch": the arm this run is (an index into ab.arms); fastmm-backtest runs each on...
Definition backtest_config.hpp:177
bool measure_wall_clock
Definition backtest_config.hpp:114
Timestamp start
Definition backtest_config.hpp:88
bool set_setting(std::string_view key, std::string_view value)
Sets one of kSweepSettings from its decimal value: latency_fixed_us and latency_jitter_us the order a...
std::string journal_out
record the run to this .fmj (empty = no journal)
Definition backtest_config.hpp:105
double transfer_p_unknown
Definition backtest_config.hpp:134
FxPlan fx_plan(const InstrumentTable &table)
The FX plan for table under accounting (throws ConfigError when a limit reads the totals and the tabl...
ParamMap params
Definition backtest_config.hpp:84
int generator_seed_levels
Definition backtest_config.hpp:101
std::map< std::string, ParamMap > param_overrides
Definition backtest_config.hpp:169
sim::SimTransportConfig transport
Definition backtest_config.hpp:85
std::vector< std::string > warnings
from_config: Config::warnings plus unknown [backtest] keys, each naming the key and its line.
Definition backtest_config.hpp:100
void set_seed(std::uint64_t s) noexcept
Seeds the synthetic market and the latency model.
Definition backtest_config.hpp:212
std::uint64_t seed
synthetic market + latency model (engine.rng_seed is separate)
Definition backtest_config.hpp:87
bool publishes_params() const noexcept
The run publishes parameter updates of its own: [ab] or [strategy.overrides] (BacktestSession::enable...
Definition backtest_config.hpp:172
std::vector< std::string > params_pinned
params_from_journal leaves these parameters at the configured values: a counterfactual run keeps the ...
Definition backtest_config.hpp:160
Duration transfer_latency
[backtest] transfer_latency_ms: a simulated transfer is carried out this long after it is sent.
Definition backtest_config.hpp:130
bool keep_orders
The result keeps a row for every order sent (BacktestResult::orders).
Definition backtest_config.hpp:117
Duration transfer_hang
Definition backtest_config.hpp:135
sim::MarketGeneratorParams generator
Definition backtest_config.hpp:86
AbSection ab
[ab]: an A/B test of the strategy's parameters (strategies/ab_test.hpp); no arms: none.
Definition backtest_config.hpp:165
UnderlyingSpec underlying
[risk.underlying]: from_config() builds engine.underlying from it for instruments; replay builds it a...
Definition backtest_config.hpp:98
EngineConfig engine
Definition backtest_config.hpp:81
double transfer_p_fail
[backtest] transfer_p_fail, transfer_p_unknown, transfer_hang_ms: the simulated venue refuses a trans...
Definition backtest_config.hpp:133
Duration duration
synthetic horizon
Definition backtest_config.hpp:89
bool controls_from_journal
The data journal's operator commands (sim::replayable_control) reach the engine at the times the sess...
Definition backtest_config.hpp:163
std::vector< Duration > markout_horizons
Post-fill markout horizons in simulated time; empty turns markouts off.
Definition backtest_config.hpp:121
Duration equity_bar
Definition backtest_config.hpp:90
std::vector< std::string > venue_names
Definition backtest_config.hpp:95
void set_param(const std::string &key, const std::string &value)
"key=value" strategy parameter override (CLI --param).
Definition backtest_config.hpp:210
Timestamp start_at
[backtest] start_at: the run reads the data from its start (the books and the strategy's view of the ...
Definition backtest_config.hpp:150
One [backtest.positions] row: the engine starts with this position in the instrument.
Definition backtest_config.hpp:74
Price avg_px
Definition backtest_config.hpp:77
Qty qty
Definition backtest_config.hpp:76
InstrumentId instrument
Definition backtest_config.hpp:75