64 std::function<void(std::function<
void()> wake)>
set_waker;
68 std::function<std::unique_ptr<IEngineRunner>(
RunnerDeps& deps)>
make;
70 std::function<void(IEngineRunner& runner)>
finished;
75 std::function<std::string(
const std::vector<std::pair<std::string, std::string>>&,
InstrumentId)>
113 std::string
program =
"fastmm-live";
117 std::function<std::string()>
watchdog;
126inline constexpr int kExitOk = 0;
Definition config.hpp:502
Definition params.hpp:102
Typed configuration (8.7).
Definition session.hpp:54
constexpr int kExitKilled
engine-tripped kill switch with [engine] on_kill = "exit"
Definition session.hpp:133
constexpr int kExitSlowTier
LiveOptions::watchdog (a Python slow tier failed)
Definition session.hpp:134
constexpr int kExitVenue
venue reference data failed
Definition session.hpp:131
constexpr int kExitUsage
bad command line, missing API keys
Definition session.hpp:129
bool trades_with_keys(const Config &cfg)
A venue of cfg trades with real keys: it is not public_only and has an api_key (an OUCH login on a ve...
constexpr int kExitRuntime
cancel_all failed, journal, ring overflow, stalled engine
Definition session.hpp:132
constexpr int kExitState
The state a restart carries over is gone or known to be wrong (live/restart_check....
Definition session.hpp:140
constexpr std::int64_t kKilledReminderNs
How often a session that stays up after a kill ([engine] on_kill = "stay") repeats its ERROR.
Definition session.hpp:143
bool resolve_venue_env(Config &cfg, bool dry_run, const char *prog)
Resolves ${VAR} in every venue string.
constexpr int kExitLocked
Another process holds the instance lock, or a takeover failed; nothing was traded.
Definition session.hpp:136
constexpr int kExitOk
Process exit codes (listed in fastmm-live --help and docs/how-to/operations/).
Definition session.hpp:128
void restore_signal_handlers() noexcept
Restores the SIGINT/SIGTERM handlers run_live replaced; a no-op when none are replaced.
int run_live(const Config &cfg, const LiveOptions &opts)
Runs one session; returns the process exit code.
constexpr int kExitConfig
bad config, strategy or parameters
Definition session.hpp:130
Definition strategy.hpp:23
ParamPublisher: builds ParamUpdate messages for a running engine, off the engine thread (ADR-0013).
Strongly typed identifiers.
Where a built update goes; push returns false when it was not accepted (full).
Definition param_publisher.hpp:49
Everything a factory needs that is backend-independent.
Definition registry.hpp:51
Definition session.hpp:85
std::function< std::string()> watchdog
Called by the control thread every 50 ms; must not block.
Definition session.hpp:119
bool no_control
Definition session.hpp:96
std::string journal_path
overrides [engine] journal_dir
Definition session.hpp:90
bool no_status
Definition session.hpp:93
bool standby
Waits for the instance lock (live/instance_lock.hpp) instead of refusing to start while another proce...
Definition session.hpp:111
std::string config_path
Definition session.hpp:86
std::string program
prefix of error messages (log lines keep fastmm-live:)
Definition session.hpp:115
std::string gateway_path
Attach to the fastmm-gateway listening here instead of connecting to the venues (live/gateway....
Definition session.hpp:123
bool no_journal
Definition session.hpp:91
std::string control_path
Control socket (live/control_socket.hpp); empty takes <journal_dir>/<engine name>....
Definition session.hpp:95
bool accept_position
Trade from the store's position even though its newest session booked executions more than once (live...
Definition session.hpp:102
std::string record_raw_dir
Definition session.hpp:89
bool dry_run
Definition session.hpp:88
const LiveStrategy * strategy
nullptr: [strategy] name from the registry
Definition session.hpp:116
bool takeover
standby, and once ready send handoff to the control socket of the session holding the lock; give up a...
Definition session.hpp:114
std::string status_path
overrides the default /dev/shm/fastmm-<engine>.status
Definition session.hpp:92
bool clear_kill
Removes the durable kill state before starting: clears a latched max-loss trip and arms the whole [ri...
Definition session.hpp:99
std::int64_t duration_ns
0 = until SIGINT/SIGTERM
Definition session.hpp:87
A strategy the caller builds instead of the registry's [strategy] name.
Definition session.hpp:57
std::string meta
the journal's strategy metadata (key=value lines)
Definition session.hpp:60
std::string name
journal header, status file and log lines
Definition session.hpp:58
std::function< std::string(const std::vector< std::pair< std::string, std::string > > &, InstrumentId)> set_params
The control socket's param: validates the (name, value) pairs against this strategy's schema and publ...
Definition session.hpp:78
std::function< std::unique_ptr< IEngineRunner >(RunnerDeps &deps)> make
Builds the runner on deps (deps.backend is a LiveBackend) on the calling thread, after the venues' re...
Definition session.hpp:70
const ParamSchema * params
the journal's parameter table
Definition session.hpp:59
std::function< void(std::function< void()> wake)> set_waker
Called with a function that wakes the engine, before the session's threads start, and with an empty o...
Definition session.hpp:66
std::function< void(IEngineRunner &runner)> finished
Called after the engine thread has stopped, before the runner is destroyed.
Definition session.hpp:72
std::vector< MsgRing * > inputs
Rings the engine polls besides the venues' (parameter updates); the caller keeps them alive.
Definition session.hpp:62
std::function< std::unique_ptr< ParamPublisher >(ParamSink sink)> publisher
A publisher of the strategy's parameters onto sink, its copy starting from the values the session sta...
Definition session.hpp:82