FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
replay.hpp File Reference

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. More...

#include "fastmm/backtest/backtest_config.hpp"
#include "fastmm/core/engine_runner.hpp"
#include "fastmm/strategies/params.hpp"
#include "fastmm/strategies/registry.hpp"
#include <cstdint>
#include <functional>
#include <memory>
#include <string>

Go to the source code of this file.

Classes

struct  fastmm::bt::ReplayOptions
 
struct  fastmm::bt::ReplayResult
 
struct  fastmm::bt::JournalInfo
 
struct  fastmm::bt::ReplayStrategy
 A strategy outside the registry (a Python hot strategy): the name for the result, the parameter schema that ParamUpdate fields are matched against, and a factory that builds the runner on the sim::ReplayBackend that deps.backend points at. More...
 

Namespaces

namespace  fastmm
 
namespace  fastmm::bt
 

Functions

JournalInfo fastmm::bt::inspect_journal (const std::string &path)
 Throws std::runtime_error when the file cannot be opened / validated.
 
BacktestConfig fastmm::bt::journal_config (const std::string &path)
 The configuration embedded in the journal.
 
std::string fastmm::bt::describe_outbound (const EventHeader &h)
 One-line description of an Out* message (type, ids, side, price, quantity, stamp).
 
ReplayResult fastmm::bt::replay_journal (const std::string &path, const BacktestConfig &cfg, const ReplayOptions &opt={})
 cfg supplies the engine configuration and strategy parameters (it must match the recording run for a verifying replay); the instrument table is taken from the journal.
 
ReplayResult fastmm::bt::replay_journal (const std::string &path, const BacktestConfig &cfg, const ReplayOptions &opt, const ReplayStrategy &strategy)
 Replays strategy instead of a registered one (opt.strategy is ignored).
 
ReplayResult fastmm::bt::replay_journal (const std::string &path, const ReplayOptions &opt={})
 Replays with the journal's embedded configuration (journal_config(path)).
 

Detailed Description

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.

A format v2 journal carries what a replay needs besides the events: the engine clock of every event, the session epoch, quoting enabled (dry run), the RNG seed, per-venue cancel-replace and the effective configuration. replay_journal(path) uses all of it; replay_journal(path, cfg) takes the engine and strategy configuration from cfg (what-if runs) and still restores the session settings from the header.

journal (inbound events + Out* copies) --JournalFeed--> engine --ReplayTransport--> sha256

A replay passes when the replayed and recorded message counts and SHA-256 hashes are equal and no message differed (ReplayResult::ok()). A different strategy or parameters turn the same call into a what-if run (ok() is then expected to be false).