26#include "fastmm/core/engine_runner.hpp"
62 std::uint32_t
pid = 0;
114 [[nodiscard]]
virtual std::string_view
name() const noexcept = 0;
121 std::uint64_t session_id, std::span<const
Instrument> table) = 0;
124 virtual
void begin() = 0;
148 virtual void commit() = 0;
154 virtual void idle(std::int64_t ) {}
157 virtual void close() = 0;
160 [[nodiscard]]
virtual std::uint64_t
rows() const noexcept = 0;
161 [[nodiscard]] virtual std::uint64_t
errors() const noexcept = 0;
Definition backend.hpp:109
virtual void reject(const RejectRecord &)
An order refused by the pre-trade checks or by its venue. The default drops it.
Definition backend.hpp:140
virtual void idle(std::int64_t)
StoreThread calls it when the ring is empty, outside a batch, with the wall clock: a backend may do o...
Definition backend.hpp:156
virtual void begin()=0
One batch. StoreThread calls begin(), then zero or more records, then commit().
virtual ~Backend()=default
Backend & operator=(const Backend &)=delete
virtual Result< void, std::string > session_close(const SessionClose &s)=0
virtual void markout(const MarkoutRecord &)
The mid at or after a fill ([engine] markout_ms).
Definition backend.hpp:144
virtual Result< void, std::string > open(const BackendOptions &opts)=0
Opens or creates the store and brings its schema up to date.
virtual void position(const PositionRecord &r)=0
virtual void param(const ParamRecord &)
A strategy parameter update the engine applied. The default drops it.
Definition backend.hpp:138
virtual std::uint64_t errors() const noexcept=0
virtual void order(const OrderRecord &r)=0
virtual void replayed(const ReplayedRecord &)
A venue's execution replay ended complete.
Definition backend.hpp:136
virtual Result< void, std::string > instruments(std::uint64_t session_id, std::span< const Instrument > table)=0
The instrument table of this session, by dense id.
virtual void funding(const FundingRecord &)
A funding payment.
Definition backend.hpp:133
virtual void limits(const LimitsRecord &)
An operator's risk limit change the engine applied. The default drops it.
Definition backend.hpp:142
virtual std::string last_error() const =0
virtual void kill(const KillRecord &r)=0
virtual std::string_view name() const noexcept=0
virtual void context_names(const ContextNamesRecord &)
The names of the strategy's quote context values (FillRecord::order_context).
Definition backend.hpp:149
virtual void capacity(const CapacityRecord &)
A minute of one account's capacity price ([capacity]). The default drops it.
Definition backend.hpp:146
virtual Result< void, std::string > session_open(const SessionOpen &s)=0
virtual void fill(const FillRecord &r)=0
virtual std::uint64_t rows() const noexcept=0
Any thread: fastmm-live reads them for the status file while the store thread writes.
Typed configuration (8.7).
Minimal expected<T, E>: the hot path never throws, it returns Result.
Instrument: the single definition of a tradable contract (5.3 / 5.15).
Definition backend.hpp:40
KillReason
Why a kill switch (global or one venue's) was tripped.
Definition enums.hpp:603
Record stream: the engine's second outbound queue, next to the journal.
A minute of one account's capacity price ([capacity], core/capacity_price.hpp): the actions priced,...
Definition record_stream.hpp:396
The names the strategy gave the values of its quote context (StrategyContext:: quote_context_names),...
Definition record_stream.hpp:419
One execution.
Definition record_stream.hpp:126
A funding payment the engine booked (FundingMsg): amount in the instrument's settlement currency,...
Definition record_stream.hpp:204
Definition config.hpp:487
Definition instrument.hpp:29
A kill switch trip. hdr.flags & kVenue marks a per-venue trip (hdr.venue names it).
Definition record_stream.hpp:218
An operator's limits command the engine applied (ControlCommand::SetLimits or SetUnderlyingLimit): th...
Definition record_stream.hpp:280
The instrument's mid horizon_ms after one of its fills, 0 at the fill ([engine] markout_ms).
Definition record_stream.hpp:383
The OMS record after a transition.
Definition record_stream.hpp:181
A strategy parameter update the engine applied (ParamUpdateMsg): after the header,...
Definition record_stream.hpp:247
One instrument's position and the portfolio totals at the same instant.
Definition record_stream.hpp:188
One order refused: by the pre-trade checks (the engine's) or by its venue (an OrderReject),...
Definition record_stream.hpp:343
A venue's execution replay ended complete (a reconciliation began with ReconcileMsg::kExecutionsExact...
Definition record_stream.hpp:238
What a backend is built with.
Definition backend.hpp:44
const GenericSection * config
Definition backend.hpp:45
std::string default_dir
[engine] journal_dir; where a backend may default its files
Definition backend.hpp:47
bool read_only
opened by a query tool, not by a session
Definition backend.hpp:48
std::string engine_name
[engine] name
Definition backend.hpp:46
Written once, after the last record.
Definition backend.hpp:97
RunnerStats stats
Definition backend.hpp:106
std::uint64_t session_id
Definition backend.hpp:98
std::vector< std::string > journal_paths
every part, in order
Definition backend.hpp:105
int exit_code
Definition backend.hpp:100
KillReason kill_reason
Definition backend.hpp:101
bool journal_complete
the journal was closed cleanly
Definition backend.hpp:103
std::int64_t stopped_ns
Definition backend.hpp:99
std::uint64_t journal_bytes
Definition backend.hpp:104
bool kill_latched
Definition backend.hpp:102
Definition backend.hpp:89
std::string name
Definition backend.hpp:90
std::string params
Definition backend.hpp:91
The strategy's parameter table in schema order: a ParamRecord's field index names an entry.
Definition backend.hpp:71
std::string name
Definition backend.hpp:72
std::uint8_t type
Definition backend.hpp:73
The parameters the session starts with.
Definition backend.hpp:78
std::string text
Definition backend.hpp:80
std::int64_t raw
Definition backend.hpp:81
bool has_raw
Definition backend.hpp:82
std::string name
Definition backend.hpp:79
Written once, before any record.
Definition backend.hpp:52
std::string host
Definition backend.hpp:63
std::string ab_test
[ab]: the test's name and its arms in order (ParamUpdateMsg::arm k + 1 names ab_arms[k]),...
Definition backend.hpp:88
std::vector< ParamField > param_table
Definition backend.hpp:75
std::string journal_path
first journal part; empty when journaling is off
Definition backend.hpp:62
std::uint64_t session_id
Definition backend.hpp:53
std::vector< std::string > venues
[venues.
Definition backend.hpp:67
std::string build_info
compiler, flags, build type
Definition backend.hpp:59
std::vector< ParamValue > params
Definition backend.hpp:84
bool params_complete
Definition backend.hpp:85
std::uint16_t session_epoch
Definition backend.hpp:54
std::uint32_t pid
Definition backend.hpp:64
std::string config_toml
effective configuration, secrets omitted
Definition backend.hpp:61
std::string version
FASTMM_VERSION_STRING.
Definition backend.hpp:58
std::vector< AbArm > ab_arms
Definition backend.hpp:93
std::int64_t pnl_carry_raw
net PnL carried in from earlier sessions
Definition backend.hpp:66
std::int64_t started_ns
Definition backend.hpp:55
std::string strategy
Definition backend.hpp:57
std::uint64_t config_hash
Definition backend.hpp:60
std::string engine_name
Definition backend.hpp:56
bool dry_run
Definition backend.hpp:65