|
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
|
#include <fastmm/backtest/backtest_config.hpp>
Public Member Functions | |
| FxPlan | fx_plan (const InstrumentTable &table) |
The FX plan for table under accounting (throws ConfigError when a limit reads the totals and the table is not covered; otherwise a warning goes to warnings and nothing converts). | |
| UnderlyingPlan | underlying_plan (const InstrumentTable &table) const |
The [risk.underlying] plan for table (throws ConfigError when the spec does not fit it). | |
| void | set_param (const std::string &key, const std::string &value) |
| "key=value" strategy parameter override (CLI --param). | |
| void | set_seed (std::uint64_t s) noexcept |
| Seeds the synthetic market and the latency model. | |
Static Public Member Functions | |
| static BacktestConfig | from_config (const Config &cfg) |
| Throws ConfigError on invalid values. | |
| 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). | |
Public Attributes | |
| EngineConfig | engine |
| InstrumentTable | instruments |
| std::string | strategy |
| registry name (apps / Python); ignored by run_backtest<S>() | |
| ParamMap | params |
| sim::SimTransportConfig | transport |
| sim::MarketGeneratorParams | generator |
| std::uint64_t | seed = 1 |
| synthetic market + latency model (engine.rng_seed is separate) | |
| Timestamp | start {seconds(1'700'000'000).ns} |
| Duration | duration = seconds(60) |
| synthetic horizon | |
| Duration | equity_bar = seconds(1) |
| double | initial_capital = 0.0 |
| reporting only (drawdown %) | |
| AccountingSpec | accounting |
| [accounting] and the venue names its sources name (Config::venues order). | |
| std::vector< std::string > | venue_names |
| UnderlyingSpec | underlying |
[risk.underlying]: from_config() builds engine.underlying from it for instruments; replay builds it again for the journal's table. | |
| std::vector< std::string > | warnings |
| from_config: Config::warnings plus unknown [backtest] keys, each naming the key and its line. | |
| int | generator_seed_levels = 20 |
| std::string | source |
| "synthetic" | "journal" | "csv" | "" (caller supplies the source) | |
| std::string | path |
| std::string | output_dir |
| std::string | journal_out |
| record the run to this .fmj (empty = no journal) | |
| std::string | config_toml |
| Effective configuration embedded in journal_out (Config::effective_toml(); from_config() sets it, hand-built configs leave it empty). | |
| bool | measure_wall_clock = true |
| std::vector< Duration > | markout_horizons = {seconds(1), seconds(10), seconds(60)} |
| Post-fill markout horizons in simulated time; empty turns markouts off. | |
| bool | balances_from_journal = false |
| Start each venue's account (transport.accounts) from the first balance snapshot the journal source recorded for it; a venue it has none for keeps the configured balances. | |
| std::vector< TreasuryConfig > | treasuries |
| The pool treasuries ([venues. | |
| Duration | transfer_latency {} |
| [backtest] transfer_latency_ms: a simulated transfer is carried out this long after it is sent. | |
| InitialState | initial_state = InitialState::StateFile |
| The strategy's starting state; Journal also starts the engine's positions where the recorded session had them (sim::SessionStart). | |
| bool | params_from_journal = false |
| The data journal's parameter updates reach the strategy at the times the session received them (sim::RecordedParams), mapped by name and type onto its schema. | |
| Duration | reorder_window = milliseconds(1000) |
| Recorded data reaches the simulated venue in venue-time order (sim/venue_order.hpp), assuming no event was received more than this after its venue time; zero keeps the recorded order. | |
|
static |
Throws ConfigError on invalid values.
|
static |
One instrument (venue 0) with the given tick/lot; generator tick/lot follow (examples).
| FxPlan fastmm::bt::BacktestConfig::fx_plan | ( | const InstrumentTable & | table | ) |
The FX plan for table under accounting (throws ConfigError when a limit reads the totals and the table is not covered; otherwise a warning goes to warnings and nothing converts).
| UnderlyingPlan fastmm::bt::BacktestConfig::underlying_plan | ( | const InstrumentTable & | table | ) | const |
The [risk.underlying] plan for table (throws ConfigError when the spec does not fit it).
|
inline |
"key=value" strategy parameter override (CLI --param).
|
inlinenoexcept |
Seeds the synthetic market and the latency model.
| EngineConfig fastmm::bt::BacktestConfig::engine |
| InstrumentTable fastmm::bt::BacktestConfig::instruments |
| std::string fastmm::bt::BacktestConfig::strategy |
registry name (apps / Python); ignored by run_backtest<S>()
| ParamMap fastmm::bt::BacktestConfig::params |
| sim::SimTransportConfig fastmm::bt::BacktestConfig::transport |
| sim::MarketGeneratorParams fastmm::bt::BacktestConfig::generator |
| std::uint64_t fastmm::bt::BacktestConfig::seed = 1 |
synthetic market + latency model (engine.rng_seed is separate)
| double fastmm::bt::BacktestConfig::initial_capital = 0.0 |
reporting only (drawdown %)
| AccountingSpec fastmm::bt::BacktestConfig::accounting |
[accounting] and the venue names its sources name (Config::venues order).
from_config() builds engine.fx from them for instruments; replay builds it again for the journal's table.
| std::vector<std::string> fastmm::bt::BacktestConfig::venue_names |
| UnderlyingSpec fastmm::bt::BacktestConfig::underlying |
[risk.underlying]: from_config() builds engine.underlying from it for instruments; replay builds it again for the journal's table.
| std::vector<std::string> fastmm::bt::BacktestConfig::warnings |
from_config: Config::warnings plus unknown [backtest] keys, each naming the key and its line.
| int fastmm::bt::BacktestConfig::generator_seed_levels = 20 |
| std::string fastmm::bt::BacktestConfig::source |
"synthetic" | "journal" | "csv" | "" (caller supplies the source)
| std::string fastmm::bt::BacktestConfig::path |
| std::string fastmm::bt::BacktestConfig::output_dir |
| std::string fastmm::bt::BacktestConfig::journal_out |
record the run to this .fmj (empty = no journal)
| std::string fastmm::bt::BacktestConfig::config_toml |
Effective configuration embedded in journal_out (Config::effective_toml(); from_config() sets it, hand-built configs leave it empty).
Callers that override fields after from_config() must refresh or clear it.
| bool fastmm::bt::BacktestConfig::measure_wall_clock = true |
| std::vector<Duration> fastmm::bt::BacktestConfig::markout_horizons = {seconds(1), seconds(10), seconds(60)} |
Post-fill markout horizons in simulated time; empty turns markouts off.
The run stops the simulated clock at every fill time + horizon to read the venue mid there, so the shortest horizon also bounds how often the run loop is entered.
| bool fastmm::bt::BacktestConfig::balances_from_journal = false |
Start each venue's account (transport.accounts) from the first balance snapshot the journal source recorded for it; a venue it has none for keeps the configured balances.
| std::vector<TreasuryConfig> fastmm::bt::BacktestConfig::treasuries |
The pool treasuries ([venues.
<primary>.treasury] with enabled): each runs on simulated time against its pool's simulated accounts (sim/sim_treasury.hpp), without a ledger file. Empty: none, and the run is what it was without them.
| Duration fastmm::bt::BacktestConfig::transfer_latency {} |
[backtest] transfer_latency_ms: a simulated transfer is carried out this long after it is sent.
| InitialState fastmm::bt::BacktestConfig::initial_state = InitialState::StateFile |
The strategy's starting state; Journal also starts the engine's positions where the recorded session had them (sim::SessionStart).
| bool fastmm::bt::BacktestConfig::params_from_journal = false |
The data journal's parameter updates reach the strategy at the times the session received them (sim::RecordedParams), mapped by name and type onto its schema.
| Duration fastmm::bt::BacktestConfig::reorder_window = milliseconds(1000) |
Recorded data reaches the simulated venue in venue-time order (sim/venue_order.hpp), assuming no event was received more than this after its venue time; zero keeps the recorded order.