FastMM documentation
FastMM C++ API 0.14.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
config.hpp
Go to the documentation of this file.
1#pragma once
2// Typed configuration (8.7). TOML parsing lives in src/core/config.cpp (toml++ is a
3// private dependency of fastmm_core); this header exposes only plain structs.
4//
5// Sections: [engine] [venues.<x>] [venues.<x>.fees] [[instruments]] [strategy]
6// [strategy.params] [risk] [[windows]] [gateway] [accounting] [accounting.fx] [logging]
7// [sim] [backtest] [storage]
8// A [venues.<x>] key the generic parser does not read is kept verbatim in VenueSection::extra:
9// the connector `kind` names owns it (include/fastmm/venues/registry.hpp).
10// Rules: ${VAR} is substituted only inside [venues.*] strings; a value that looks like an
11// inline secret (> 32 chars, no ${) is rejected unless allow_inline_secrets; redacted()
12// prints the config with secrets masked; validation errors carry line:col.
13#include "fastmm/core/account_pool.hpp"
14#include "fastmm/core/balance_book.hpp"
15#include "fastmm/core/enums.hpp"
16#include "fastmm/core/fees.hpp"
17#include "fastmm/core/fill_cluster.hpp"
18#include "fastmm/core/fx.hpp"
19#include "fastmm/core/hazard.hpp"
21#include "fastmm/core/perp_book.hpp"
22#include "fastmm/core/pool_homes.hpp"
24#include "fastmm/core/risk.hpp"
25#include "fastmm/core/thread_utils.hpp"
26#include "fastmm/core/treasury.hpp"
27#include "fastmm/core/underlying.hpp"
28#include "fastmm/core/windows.hpp"
30
31#include <cstdint>
32#include <map>
33#include <optional>
34#include <stdexcept>
35#include <string>
36#include <string_view>
37#include <vector>
38
39namespace fastmm {
40
41inline constexpr std::size_t kMaxVenuesConfig = 8; // == kMaxVenues (transport.hpp)
42// The most redundant market-data connections a venue opens ([venues.*] md_copies).
43inline constexpr int kMaxMdCopies = 8;
44// The shortest [venues.<name>] fill_audit_interval_s: an audit reads every subscribed symbol.
45inline constexpr int kMinFillAuditIntervalS = 10;
46
47class ConfigError : public std::runtime_error {
48 public:
49 ConfigError(const std::string& msg, int line = 0, int col = 0)
50 : std::runtime_error(line > 0 ? msg + " (line " + std::to_string(line) + ":" +
51 std::to_string(col) + ")"
52 : msg),
53 line_(line),
54 col_(col) {}
55 [[nodiscard]] int line() const noexcept { return line_; }
56 [[nodiscard]] int col() const noexcept { return col_; }
58 private:
59 int line_;
60 int col_;
61};
62
63struct EngineSection {
64 std::string name = "fastmm";
65 int cpu = -1;
66 std::vector<int> net_cpus;
67 // Cores of every other thread (live/thread_affinity.hpp); empty: the cores no hot thread is
68 // pinned to.
69 std::vector<int> aux_cpus;
70 std::string spin_mode = "adaptive";
71 // Carry the previous session's positions over from the store (venues that replay executions).
72 bool restore_position = true;
73 std::string net_backend = "epoll"; // net::Reactor backend: "epoll" | "io_uring"
74 // fastmm-live: "split" runs the engine and each venue's network loop on their own threads;
75 // "single" runs the one venue's network loop, the engine and order sending on the engine thread.
76 std::string threading = "split";
77 bool journal = true;
78 std::string journal_dir = "runs";
79 std::string journal_sync = "async"; // "async" | "fdatasync" (core/journal.hpp)
80 std::size_t journal_max_bytes = 0; // roll over to the next part at this size (0: never)
81 int journal_retention_days = 0; // delete journals older than this (0: keep)
82 std::string journal_compress = "none"; // "none" | "zstd" (core/journal_archive.hpp)
83 std::uint64_t journal_max_total_bytes = 0; // cap on the journals in journal_dir (0: none)
84 std::int64_t checkpoint_s = 0; // journal checkpoints this often (0: none)
85 std::string epoch_file = "runs/session_epoch";
86 // Latched kill switch and cumulative PnL; empty = "<journal_dir>/<name>.kill".
87 std::string kill_file;
88 // fastmm-live: an exclusive flock(2) on lock_file (empty = "<journal_dir>/<name>.lock") taken
89 // before the session touches the account, so one process of this engine name trades at a time
90 // (live/instance_lock.hpp). --standby and --takeover take it whatever this says.
91 bool instance_lock = false;
92 std::string lock_file;
93 // --takeover: how long the new process waits for the running one to release the lock after it
94 // accepted `handoff`, ms.
95 int handoff_timeout_ms = 75'000;
96 // The store's markouts: the mid this many ms after each fill (core/record_stream.hpp).
97 std::vector<std::int64_t> markout_ms;
98 // fastmm-live: the engine thread stuck inside one turn of its loop this long (Engine::heartbeat
99 // has not moved) cancels every venue's orders and exits with kExitRuntime, ms; 0: never.
100 int stall_ms = 10'000;
101 std::uint64_t rng_seed = 1;
102 std::size_t md_ring_bytes = 4U << 20;
103 std::size_t order_ring_bytes = 1U << 20;
104 std::size_t journal_ring_bytes = 16U << 20;
105 std::uint32_t max_events_per_step = 64;
106 std::uint32_t feed_budget_per_ring = 64; // RingFeed: events per ring before the next one's turn
107 // Adaptive: a network thread alone on its pinned core never blocks (net_never_blocks).
108 bool net_spin_dedicated = false;
109 int crossed_grace_ms = 100;
110 int ack_timeout_ms = 0; // force-cancel an order without an ack after this long; 0 = off
111 // Operator flatten (fastmm-ctl flatten): the sweep period, how long the engine keeps working the
112 // position off (0 = until it is flat or an operator stops it) and the default slippage.
113 int flatten_interval_ms = 500;
114 int flatten_timeout_ms = 60000;
116 double queue_conservatism = 1.0; // queue position estimate (ctx.queue_ahead), 0..1
118 int tsc_recalibrate_s = 10; // fastmm-live: TSC recalibration period, 0 = never
119 std::int64_t timer_slack_ns = 0; // fastmm-live: PR_SET_TIMERSLACK of its threads, 0 = kernel's
120 bool lock_memory = false; // fastmm-live: mlockall(MCL_CURRENT | MCL_FUTURE)
121 // fastmm-live: PM QoS CPU latency request (/dev/cpu_dma_latency) held for the session, us;
122 // -1 = none.
123 int cpu_dma_latency_us = -1;
124 // fastmm-live: SCHED_FIFO priority of the engine thread and of the network threads, 0 = off.
125 int rt_priority = 0;
126 int net_rt_priority = 0;
127 // fastmm-live: log the NICs' interrupt CPUs against the pinned ones.
128 bool log_irq_affinity = false;
129 // Endpoint selection (net/endpoint_selector.hpp): connect to the fastest of a venue host's
130 // addresses. endpoint_select is the default of every venue; the rest tune the probes.
131 bool endpoint_select = false;
138 int min_qty_bps = 8000;
139 bool post_only = true;
140 bool supports_replace = true;
141 int reject_backoff_ms = 1000; // QuoteManager: pause a side after a venue reject (0 = off)
142 int reject_backoff_max_ms = 60000; // doubling cap
143 int quote_token_reserve = 0; // [risk] order tokens quotes that add risk leave to others
144 int send_token_reserve = 0; // [risk] order tokens every quote leaves for ctx.send orders
145 int quote_room_reserve = 0; // venue order-window room below which quotes do not chase (-1 off)
146 // fastmm-live after a kill switch it did not ask for (risk limit, internal failure, every venue
147 // killed): "exit" shuts down like SIGTERM and exits with code 6; "stay" keeps running with
148 // quoting off and logs an ERROR line every 10 s.
149 std::string on_kill = "exit";
150 // Open orders a reconciliation finds on the session's symbols that the engine does not know:
151 // "all" cancels every one; "own" only those whose client order id FastMM minted with an epoch
152 // up to this session's, and leaves the rest (manual orders, another program's) alone.
153 std::string cancel_unknown = "all";
154 // A change of a spot instrument's base asset on its accounts that no fill or transfer of the
155 // engine's made (EngineConfig::base_flows): "off" | "report" | "adjust"; how long a change must
156 // hold first; and what it is measured from: "session" (the first settled offset) or "zero".
157 std::string base_flows = "off";
158 int base_flows_settle_s = 30;
159 std::string base_flows_from = "session";
162struct FeesSection {
163 double maker_bps = 0.0;
164 double taker_bps = 0.0;
167// [venues.<primary>.treasury]: the pool treasury of an account pool's primary
168// (core/treasury.hpp). Decimals keep their text; Config::treasury_config() makes it typed.
169struct TreasurySection {
170 bool configured = false; // the table is present
171 bool enabled = false;
172 bool dry_run = false;
173 std::string asset;
174 std::string targets = "weights"; // "weights" | "demand"
175 double headroom = 0.15;
176 bool reserve = false;
177 std::map<std::string, double> weights; // pool account -> weight (absent: 1)
178 std::map<std::string, std::string> min_free; // pool account -> decimal (absent: 0)
179 double threshold = 0.2;
180 std::string min_amount = "0";
181 std::string max_amount = "0";
182 std::string step = "0.01";
183 std::int64_t interval_s = 10;
184 std::int64_t min_interval_s = 60;
185 std::int64_t max_per_hour = 12;
186 std::int64_t cooldown_s = 300;
187 std::int64_t timeout_s = 60;
188 std::int64_t settle_s = 30;
189 std::string state_file; // empty: <journal_dir>/<engine name>.<primary>.treasury
192// [venues.<primary>.pool]: how the pool whose primary this venue is places each instrument's
193// position (core/pool_homes.hpp). Config::pool_homes() makes it typed.
194struct PoolSection {
195 bool configured = false; // the table is present
196 std::string placement = "balance";
197 std::int64_t reduce_accounts = 1;
198 std::string spill = "never";
199 double spill_at = 0.8;
200 std::int64_t plan_interval_s = 30;
201 double plan_lookback_h = 1.0;
202 std::int64_t plan_max_moves = 3;
203 std::map<std::string, std::string> homes; // symbol -> pool account
204 std::string sweep = "false"; // "false" | "true" | "auto"
205 std::int64_t sweep_delay_ms = 3000;
206 std::int64_t sweep_dust_s = 3600;
207 std::int64_t sweep_retry_s = 30;
210// [venues.<primary>.transfers]: the transfer lane of the pool whose primary this venue is
211// (core/transfer_lane.hpp). Config::pool_homes() makes it typed.
212struct TransfersSection {
213 bool configured = false; // the table is present
214 std::int64_t max_in_flight = 8;
215 std::int64_t per_minute = 20;
216 std::int64_t per_hour = 300;
217 std::int64_t per_day = 3000;
218 std::int64_t breaker_s = 900;
219 std::int64_t timeout_s = 60;
220 std::int64_t status_interval_s = 10;
221 bool dry_run = false;
222 std::string state_file; // empty: <journal_dir>/<engine name>.<primary>.transfers
225struct VenueSection {
226 std::string name;
227 std::string kind;
228 std::string ws_url;
229 std::string ws_api_url;
230 std::string rest_url;
231 std::string api_key;
232 std::string api_secret;
233 std::string api_passphrase; // OKX: the passphrase chosen with the API key
234 bool testnet = true;
235 bool supports_replace = false;
236 // Market data only: no keys needed, no private sessions, no orders, not awaited at start, not
237 // cancelled at stop. For a venue that is only a price leader for a strategy on another venue.
238 bool public_only = false;
239 // Another account of the venue named: this one takes orders for that venue's instruments with
240 // its own keys, balances and order-count windows, and has no instruments or market data of its
241 // own (core/account_pool.hpp). Empty: a venue of its own.
242 std::string pool_of;
243 // The session starts in reduce-only mode for this venue's instruments (fastmm-ctl reduce-only
244 // off --venue <name> ends it).
245 bool reduce_only = false;
246 bool insecure_tls = false;
247 std::string ca_file;
248 int recv_window_ms = 3000;
249 // Where this venue's connections leave the host from: one of its addresses, or the address of a
250 // network interface (net/source_address.hpp). Empty: the kernel chooses.
251 std::string source_ip;
252 std::string source_interface;
253 // Endpoint selection for this venue's connections; nullopt: [engine] endpoint_select.
254 std::optional<bool> endpoint_select;
255 // Fill audit (live/fill_auditor.hpp): every fill_audit_interval_s seconds fastmm-live compares
256 // the venue's trade history with the fills the store holds for this venue, up to
257 // fill_audit_lag_s ago. 0: off. "report" only reports a difference; "book" also books the
258 // executions the engine missed, through the execution replay.
259 // Redundant market-data connections (venues/md_copy.hpp) and the cores of their threads: copy k
260 // runs on a thread of its own pinned to md_copy_cpus[k], or on the venue's network thread past
261 // the end of the list.
262 int md_copies = 0;
263 std::vector<int> md_copy_cpus;
266 std::string fill_audit_mode = "report";
267 // The connector's start-up trading rules against [[instruments]] (live/venue_slot.hpp
268 // settle_venue_rules): "adopt" the venue's, "warn" and keep the configured ones, or "refuse" to
269 // start.
270 std::string rules_mismatch = "adopt";
275 // Every key the generic parser does not interpret, stringified. The venue `kind` names owns
276 // them: it declares them, validates them and reports an unknown one
277 // (fastmm::venues::validate_venues, include/fastmm/venues/registry.hpp), which is why the
278 // central schema knows none of them. `extra_lines` is the line each key came from, absent for a
279 // key set in code, so the owner can report with a position the way the schema does.
280 std::map<std::string, std::string> extra;
281 std::map<std::string, int> extra_lines;
284struct InstrumentSection {
285 std::string venue;
286 std::string symbol;
287 std::string base;
288 std::string quote;
289 std::string asset_class = "spot";
290 std::string tick;
291 std::string lot;
292 std::string min_qty;
293 std::string max_qty;
294 std::string min_notional;
295 std::string contract_multiplier = "1";
296 bool enabled = true;
298 std::string expiry;
299 std::string strike;
300 std::string option_type;
301 // Per-instrument fee schedule; unset means the instrument pays its venue's [venues.<x>.fees].
302 // Positive == a fee, negative == a rebate.
303 std::optional<double> maker_bps;
304 std::optional<double> taker_bps;
305 // A derivative's initial margin, fraction of the notional, decimal; empty: none configured.
306 std::string initial_margin;
307};
309struct StrategySection {
310 std::string name;
312 // [strategy.groups]: named lists of instruments ("symbol" or "venue:symbol").
313 std::map<std::string, std::vector<std::string>> groups;
314 // [strategy.overrides]: parameters of one instrument or group on top of params
315 // (strategies/param_overrides.hpp).
316 std::map<std::string, ParamMap> overrides;
317 std::int64_t max_param_age_ms = 0; // 0 = off
318 std::string state_file; // the strategy's state across sessions; empty: none
319 std::int64_t state_interval_s = 300;
322// [ab]: an A/B test of strategy parameters (strategies/ab_test.hpp). No arms: no test.
323struct AbArmSection {
324 std::string name;
325 ParamMap params; // on top of [strategy.params]; none: the arm runs the configured values
327struct AbSection {
328 std::string name;
329 std::string assignment; // "instrument" | "time" | "crossover" | "branch"
330 std::uint64_t seed = 1;
331 std::int64_t block_s = 0; // time, crossover: the block, seconds
332 std::string start; // UTC; empty: from the start of the session
333 std::string end; // UTC; empty: no end
334 // instrument, crossover: the weight of each instrument ("venue:symbol" or "symbol") the split
335 // balances the arms on; empty: every instrument weighs the same.
336 std::map<std::string, double> weights;
337 // instrument, crossover: the arm of each instrument ("venue:symbol" or "symbol" = arm name)
338 // instead of a drawn split; an instrument not listed stays out of the test.
339 std::map<std::string, std::string> assign;
340 // time, crossover: blocks start this many seconds after multiples of block_s since the epoch.
341 std::int64_t block_offset_s = 0;
342 std::vector<AbArmSection> arms;
343 [[nodiscard]] bool enabled() const noexcept { return !arms.empty(); }
346// One [[risk.hazard]] table (core/hazard.hpp).
347struct HazardSection {
348 std::string name;
349 // Members: a symbol, "venue:symbol" or a group of [strategy.groups].
350 std::vector<std::string> instruments;
351 // "venue:symbol" or "symbol" = weight; a member not listed weighs 1.
352 std::map<std::string, double> weights;
353 std::string side = "both"; // "bid" | "ask" | "both"
354 double threshold = 0.0;
355 double half_life_ms = 20.0;
356 int hold_ms = 500;
357 bool prints = true;
358 std::string mode = "pull"; // "pull" | "log"
361struct RiskSection {
362 std::string max_order_qty;
364 std::string max_position;
368 int stale_md_ms = 0;
369 std::string max_loss;
370 // The span max_loss is a budget for: "total" (every session since the kill file was cleared) or
371 // "utc_day" (from 00:00 UTC; a new day measures net PnL from zero again).
372 std::string max_loss_period = "total";
373 std::string max_gross_notional;
374 std::string max_net_notional;
376 int burst = 0;
377 bool stp = true;
378 int max_feed_lag_ms = 0; // 0 = off
379 // The fill-cluster guard (core/fill_cluster.hpp): names 0 = off.
381 int fill_cluster_window_ms = 500;
383 // [[risk.hazard]]: the hazard groups (core/hazard.hpp); none: off.
384 std::vector<HazardSection> hazard;
385 bool check_balance = true; // refuse what the venue's balance cannot cover
386 // A keyed fastmm-live session starts without max_position (or max_order_notional) and
387 // max_loss only with this set.
388 bool allow_unlimited = false;
389 // The session starts in reduce-only mode for every instrument (fastmm-ctl reduce-only off ends
390 // it).
391 bool reduce_only = false;
392 // [risk.underlying.<BASE>] max_net: net position per base asset over every instrument, base
393 // units.
394 UnderlyingSpec underlying;
395};
397// fastmm-gateway's account guards: one venue's account, shared by every attached strategy.
398struct GatewaySection {
399 int orders_per_sec = 0; // new orders and replaces per venue, 0 = off
400 int burst = 0; // token-bucket capacity, 0 = orders_per_sec
401 std::string max_open_notional; // notional working at a venue, decimal; empty = off
402 // The account over every attached strategy, decimals in the settlement currency; empty = off.
403 std::string max_loss; // net PnL, carried in <journal_dir>/<name>.kill
404 std::string max_gross_notional; // sum of |position| at the marks
405 std::string max_net_notional; // |signed sum| of the positions at the marks
406 // [gateway.underlying.<BASE>] max_net: the account's net position per base asset, base units.
407 UnderlyingSpec underlying;
408 // [gateway.shared."<venue>:<symbol>"]: an instrument several strategies may trade at once, and
409 // the [engine] name of its primary strategy (empty: none), which books the events naming no
410 // order.
411 std::map<std::string, std::string> shared;
412 bool check_balance = true; // the account's balance covers every strategy's orders
414 [[nodiscard]] bool any() const noexcept {
415 return orders_per_sec != 0 || burst != 0 || !max_open_notional.empty() || !max_loss.empty() ||
416 !max_gross_notional.empty() || !max_net_notional.empty() || underlying.configured() ||
417 !shared.empty() || !check_balance;
418 }
419};
420
421// [capacity]: the price of an order slot (core/capacity_price.hpp). Config::capacity_config()
422// makes it typed.
423struct CapacitySection {
424 bool configured = false;
425 std::string mode = "off";
426 std::string value = "off";
427 std::int64_t orders_10s = 0;
428 std::int64_t window_ms = 10'000;
429 bool fill_credit = false;
430 std::int64_t orders_1d = 0;
431 std::int64_t orders_per_day = 0;
432 std::int64_t weight_1m = 0;
433 double margin_bps = 1.0;
434 double full_move_bps = 10.0;
435 std::vector<std::string> venues; // empty: every venue
438// One [[windows]] table (core/windows.hpp), as written; window_config() resolves it.
439struct WindowSection {
440 std::string name;
441 std::string zone; // IANA name or POSIX TZ rule
442 std::vector<std::string> days; // "mon" ... "sun"; or
443 std::vector<std::string> dates; // "YYYY-MM-DD", local
444 std::string start; // "HH:MM[:SS]", local
445 std::string end; // "HH:MM[:SS]", local; or
446 std::string duration; // "30m", "1h30m", "2d"
447 std::string from; // first local date an occurrence may start on; "" = any
448 std::string until; // the last; "" = any
449 std::vector<std::string> except; // local dates no occurrence starts on
450 std::string action = "pull"; // "pull" | "reduce_only"
451 std::vector<std::string> venues; // scope: these venues' instruments ...
452 std::vector<std::string> instruments; // ... and these; neither: the whole session
455struct LoggingSection {
456 std::string level = "info";
457 std::string file;
458 std::string mirror_level = "warn";
459 // Seconds between the per-venue status lines; 0: none. Unset (-1): every second into a log file,
460 // every 10 s when the log is stderr.
461 std::int64_t status_interval_s = -1;
462};
464// Free-form section used by the sim / backtest libraries: dotted keys -> stringified value.
465// [shadow]: fastmm-shadow's settings (backtest/shadow.hpp, docs/reference/configuration.md#shadow).
466struct ShadowSection {
467 bool enabled = false;
468 int threads = 1;
469 int window_s = 60;
470 int settle_s = 10;
471 int max_lag_s = 300;
472 int nice = 10;
473 int idle_exit_s = 3600;
474 std::vector<int> cpus;
475 std::string program; // empty: fastmm-shadow beside this program
476 std::string report; // empty: <journal_dir>/<name>.shadow.json
477 std::string status; // empty: /dev/shm/fastmm-<name>.shadow
478 std::vector<std::pair<std::string, std::vector<std::string>>> grid;
479 std::vector<std::map<std::string, std::string>> points;
480 [[nodiscard]] bool configured() const noexcept {
481 return enabled || !grid.empty() || !points.empty();
483};
484
485struct GenericSection {
486 std::map<std::string, std::string> values;
487 std::map<std::string, int> lines; // key -> line in the file; absent for keys set in code
488 [[nodiscard]] bool has(std::string_view key) const { return values.contains(std::string(key)); }
489 [[nodiscard]] std::string get_string(std::string_view key, std::string_view def = "") const;
490 [[nodiscard]] std::int64_t get_int(std::string_view key, std::int64_t def = 0) const;
491 [[nodiscard]] double get_double(std::string_view key, double def = 0.0) const;
492 [[nodiscard]] bool get_bool(std::string_view key, bool def = false) const;
495struct ConfigLoadOptions {
496 bool allow_inline_secrets = false;
497 bool substitute_env = true;
500class Config {
501 public:
503
504 static Config load(const std::string& path, const LoadOptions& opts = LoadOptions{});
505 static Config parse(std::string_view toml,
506 const LoadOptions& opts = LoadOptions{},
507 std::string_view source_name = "<string>");
508
510 std::vector<VenueSection> venues; // VenueId == index
511 std::vector<InstrumentSection> instruments;
515 std::vector<WindowSection> windows; // [[windows]]
518 // [accounting]: the reporting currency and the FX source of each other settlement currency,
519 // read by fastmm-live, fastmm-gateway, the backtester and replay (build_fx_plan, core/fx.hpp).
520 AccountingSpec accounting;
525 // [storage]: the backend name and whatever keys that backend reads. Free-form, like [sim] and
526 // [backtest]: a storage backend parses its own keys and the central schema knows none of them
527 // (docs/reference/storage.md).
529 std::vector<std::string> warnings;
530 std::string source; // path or "<string>"
531 std::uint64_t hash = 0; // FNV-1a of the raw text
533 [[nodiscard]] const VenueSection* venue(std::string_view name) const noexcept;
534 [[nodiscard]] VenueId venue_id(std::string_view name) const noexcept; // invalid if unknown
535 // The account pools ([venues.<x>] pool_of), by venue id; inactive without any.
536 [[nodiscard]] PoolPlan pool_plan() const noexcept;
537 // The venues whose [venues.<x>] reduce_only is set, bit per venue id (EngineConfig).
538 [[nodiscard]] std::uint32_t reduce_only_venues() const noexcept;
539 // The treasury of the pool whose primary is `primary` ([venues.<primary>.treasury]), typed; a
540 // disabled one when the venue has none.
541 [[nodiscard]] TreasuryConfig treasury_config(std::string_view primary) const;
542
543 // Typed views used to wire the engine.
544 [[nodiscard]] RiskLimits risk_limits() const;
545 [[nodiscard]] FillClusterConfig fill_cluster_config() const;
546 // Why fastmm-live refuses this [risk] for a session that trades with real keys: neither
547 // max_position nor max_order_notional, or no max_loss, and no allow_unlimited. Empty when it
548 // starts.
549 [[nodiscard]] std::string unlimited_risk() const;
550 [[nodiscard]] QuoteParams quote_params() const;
551 // [capacity], typed; the engine fills in the threshold's notional range.
552 [[nodiscard]] CapacityConfig capacity_config() const;
553 [[nodiscard]] LogLevel log_level() const;
554 [[nodiscard]] LogLevel mirror_level() const;
555 // `to_file`: the log goes to a file (--log or [logging] file), where the default is 1 s.
556 [[nodiscard]] std::int64_t status_interval_s(bool to_file) const noexcept {
558 return to_file ? 1 : 10;
559 }
560 [[nodiscard]] SpinMode spin_mode() const;
561 [[nodiscard]] bool single_threaded() const noexcept { return engine.threading == "single"; }
563 // Dump with api_key/api_secret/api_passphrase masked; safe to log.
564 [[nodiscard]] std::string redacted() const;
565
566 // The configuration as parsed (after any changes made to this object, e.g. command-line
567 // overrides) as complete TOML without api_key / api_secret / api_passphrase. Deterministic:
568 // equal configurations give equal text, and parsing the text gives an equal configuration.
569 // Journals embed it, and its hash is the journal header's config_hash.
570 [[nodiscard]] std::string effective_toml() const;
571 [[nodiscard]] std::uint64_t effective_hash() const { return text_hash(effective_toml()); }
572 [[nodiscard]] static std::uint64_t text_hash(std::string_view text) noexcept; // FNV-1a
575// Builds the dense instrument table (src/core/instrument_loader.cpp). Throws ConfigError.
577
578// [venues.<primary>.pool] of every pool, and the pinned homes (`homes`) by the id each instrument
579// has in `table`.
580PoolHomesPlan pool_homes(const Config& cfg, const InstrumentTable& table);
581
582// [[risk.hazard]] with the members resolved in `table` (`venue_names` naming its venue ids). Throws
583// ConfigError for a member that names no instrument or one that two groups share.
584HazardConfig hazard_config(const Config& cfg,
585 const InstrumentTable& table,
586 std::span<const std::string> venue_names);
587
588// [[windows]] with the zones looked up and the scopes resolved in `table` (`venue_names` naming
589// its venue ids). Throws ConfigError for a scope entry that names no instrument.
590WindowsConfig window_config(const Config& cfg,
591 const InstrumentTable& table,
592 std::span<const std::string> venue_names);
593
594// The fee rates of each instrument: its [[instruments]] maker_bps / taker_bps, else its venue's
595// [venues.<x>.fees]; the first venue's are the default for ids outside the configuration. Without
596// `table`, instrument k of the configuration is InstrumentId k (load_instruments); with it, each
597// instrument of `table` takes the entry with its venue and symbol, `venue_names` naming its venue
598// ids (a table from fastmm-gateway, whose order is not the configuration's).
599FeeTable fee_table(const Config& cfg,
600 const InstrumentTable* table = nullptr,
601 const std::vector<std::string>* venue_names = nullptr);
602
603// [risk] check_balance and each instrument's [[instruments]] initial_margin, the instruments mapped
604// as fee_table() maps them.
605BalanceConfig balance_config(const Config& cfg,
606 const InstrumentTable* table = nullptr,
607 const std::vector<std::string>* venue_names = nullptr);
608
609// [accounting] mark, stale_mark_ms and stale_funding_ms.
610PerpConfig perp_config(const Config& cfg);
611
612} // namespace fastmm
Definition config.hpp:49
int col() const noexcept
Definition config.hpp:58
int line() const noexcept
Definition config.hpp:57
Definition config.hpp:502
static Config parse(std::string_view toml, const LoadOptions &opts=LoadOptions{}, std::string_view source_name="<string>")
SpinMode spin_mode() const
StrategySection strategy
Definition config.hpp:514
LogLevel mirror_level() const
RiskLimits risk_limits() const
Typed views used to wire the engine.
bool single_threaded() const noexcept
Definition config.hpp:563
std::string redacted() const
Dump with api_key/api_secret/api_passphrase masked; safe to log.
std::uint32_t reduce_only_venues() const noexcept
The venues whose [venues.<x>] reduce_only is set, bit per venue id (EngineConfig).
GenericSection backtest
Definition config.hpp:526
GenericSection storage
[storage]: the backend name and whatever keys that backend reads.
Definition config.hpp:530
LoggingSection logging
Definition config.hpp:523
const VenueSection * venue(std::string_view name) const noexcept
GatewaySection gateway
Definition config.hpp:519
PoolPlan pool_plan() const noexcept
The account pools ([venues.<x>] pool_of), by venue id; inactive without any.
std::vector< std::string > warnings
Definition config.hpp:531
AbSection ab
Definition config.hpp:515
QuoteParams quote_params() const
EngineSection engine
Definition config.hpp:511
std::string unlimited_risk() const
Why fastmm-live refuses this [risk] for a session that trades with real keys: neither max_position no...
std::string source
path or "<string>"
Definition config.hpp:532
std::uint64_t hash
FNV-1a of the raw text.
Definition config.hpp:533
TreasuryConfig treasury_config(std::string_view primary) const
The treasury of the pool whose primary is primary ([venues.
FillClusterConfig fill_cluster_config() const
RiskSection risk
Definition config.hpp:516
std::uint64_t effective_hash() const
Definition config.hpp:573
AccountingSpec accounting
[accounting]: the reporting currency and the FX source of each other settlement currency,...
Definition config.hpp:522
std::vector< WindowSection > windows
[[windows]]
Definition config.hpp:517
ShadowSection shadow
Definition config.hpp:524
GenericSection sim
Definition config.hpp:525
CapacitySection capacity
Definition config.hpp:518
CapacityConfig capacity_config() const
[capacity], typed; the engine fills in the threshold's notional range.
std::vector< VenueSection > venues
VenueId == index.
Definition config.hpp:512
static Config load(const std::string &path, const LoadOptions &opts=LoadOptions{})
LogLevel log_level() const
static std::uint64_t text_hash(std::string_view text) noexcept
FNV-1a.
std::int64_t status_interval_s(bool to_file) const noexcept
to_file: the log goes to a file (--log or [logging] file), where the default is 1 s.
Definition config.hpp:558
std::string effective_toml() const
The configuration as parsed (after any changes made to this object, e.g.
VenueId venue_id(std::string_view name) const noexcept
invalid if unknown
std::vector< InstrumentSection > instruments
Definition config.hpp:513
Definition fees.hpp:54
Dense-by-id table built at startup; symbol lookup is a sorted FlatMap keyed by (venue,...
Definition instrument.hpp:147
All engine enumerations.
Fee rates per instrument, in centi-basis-points (integer) of the fill notional.
Instrument: the single definition of a tradable contract (5.3 / 5.15).
Definition strategy.hpp:23
constexpr int kMinFillAuditIntervalS
The shortest [venues.<name>] fill_audit_interval_s: an audit reads every subscribed symbol.
Definition config.hpp:47
LogLevel
Definition enums.hpp:688
FeeTable fee_table(const Config &cfg, const InstrumentTable *table=nullptr, const std::vector< std::string > *venue_names=nullptr)
The fee rates of each instrument: its [[instruments]] maker_bps / taker_bps, else its venue's [venues...
PerpConfig perp_config(const Config &cfg)
[accounting] mark, stale_mark_ms and stale_funding_ms.
constexpr std::size_t kMaxVenuesConfig
== kMaxVenues (transport.hpp)
Definition config.hpp:43
constexpr int kMaxMdCopies
The most redundant market-data connections a venue opens ([venues.*] md_copies).
Definition config.hpp:45
InstrumentTable load_instruments(const Config &cfg)
Builds the dense instrument table (src/core/instrument_loader.cpp). Throws ConfigError.
constexpr std::string_view to_string(ParamType t) noexcept
Definition params.hpp:63
BalanceConfig balance_config(const Config &cfg, const InstrumentTable *table=nullptr, const std::vector< std::string > *venue_names=nullptr)
[risk] check_balance and each instrument's [[instruments]] initial_margin, the instruments mapped as ...
HazardConfig hazard_config(const Config &cfg, const InstrumentTable &table, std::span< const std::string > venue_names)
[[risk.hazard]] with the members resolved in table (venue_names naming its venue ids).
PoolHomesPlan pool_homes(const Config &cfg, const InstrumentTable &table)
[venues.
WindowsConfig window_config(const Config &cfg, const InstrumentTable &table, std::span< const std::string > venue_names)
[[windows]] with the zones looked up and the scopes resolved in table (venue_names naming its venue i...
std::map< std::string, std::string > ParamMap
Definition params.hpp:119
Strategy parameter schema (8.6, ADR-0012).
QuoteManager (5.6): diffs the strategy's DesiredQuotes against the orders resting at the venue and em...
[ab]: an A/B test of strategy parameters (strategies/ab_test.hpp). No arms: no test.
Definition config.hpp:325
std::string name
Definition config.hpp:326
ParamMap params
on top of [strategy.params]; none: the arm runs the configured values
Definition config.hpp:327
Definition config.hpp:329
bool enabled() const noexcept
Definition config.hpp:345
std::int64_t block_s
time, crossover: the block, seconds
Definition config.hpp:333
std::string name
Definition config.hpp:330
std::map< std::string, double > weights
instrument, crossover: the weight of each instrument ("venue:symbol" or "symbol") the split balances ...
Definition config.hpp:338
std::string start
UTC; empty: from the start of the session.
Definition config.hpp:334
std::uint64_t seed
Definition config.hpp:332
std::string assignment
"instrument" | "time" | "crossover" | "branch"
Definition config.hpp:331
std::vector< AbArmSection > arms
Definition config.hpp:344
std::int64_t block_offset_s
time, crossover: blocks start this many seconds after multiples of block_s since the epoch.
Definition config.hpp:343
std::string end
UTC; empty: no end.
Definition config.hpp:335
std::map< std::string, std::string > assign
instrument, crossover: the arm of each instrument ("venue:symbol" or "symbol" = arm name) instead of ...
Definition config.hpp:341
Definition capacity_price.hpp:77
[capacity]: the price of an order slot (core/capacity_price.hpp).
Definition config.hpp:425
std::string mode
Definition config.hpp:427
std::int64_t orders_10s
Definition config.hpp:429
std::string value
Definition config.hpp:428
std::vector< std::string > venues
empty: every venue
Definition config.hpp:437
bool configured
Definition config.hpp:426
double margin_bps
Definition config.hpp:435
std::int64_t orders_per_day
Definition config.hpp:433
std::int64_t orders_1d
Definition config.hpp:432
double full_move_bps
Definition config.hpp:436
bool fill_credit
Definition config.hpp:431
std::int64_t window_ms
Definition config.hpp:430
std::int64_t weight_1m
Definition config.hpp:434
Definition config.hpp:497
bool substitute_env
Definition config.hpp:499
bool allow_inline_secrets
Definition config.hpp:498
Definition config.hpp:65
std::size_t order_ring_bytes
Definition config.hpp:105
std::string epoch_file
Definition config.hpp:87
int reject_backoff_max_ms
doubling cap
Definition config.hpp:144
std::string kill_file
Latched kill switch and cumulative PnL; empty = "<journal_dir>/<name>.kill".
Definition config.hpp:89
std::vector< std::int64_t > markout_ms
The store's markouts: the mid this many ms after each fill (core/record_stream.hpp).
Definition config.hpp:99
int endpoint_probe_samples
Definition config.hpp:135
int send_token_reserve
[risk] order tokens every quote leaves for ctx.send orders
Definition config.hpp:146
std::uint32_t feed_budget_per_ring
RingFeed: events per ring before the next one's turn.
Definition config.hpp:108
int endpoint_spread_us
Definition config.hpp:136
bool instance_lock
fastmm-live: an exclusive flock(2) on lock_file (empty = "<journal_dir>/<name>....
Definition config.hpp:93
std::uint64_t journal_max_total_bytes
cap on the journals in journal_dir (0: none)
Definition config.hpp:85
int crossed_grace_ms
Definition config.hpp:111
int tsc_recalibrate_s
fastmm-live: TSC recalibration period, 0 = never
Definition config.hpp:120
std::string journal_sync
"async" | "fdatasync" (core/journal.hpp)
Definition config.hpp:81
int flatten_timeout_ms
Definition config.hpp:116
std::string base_flows
A change of a spot instrument's base asset on its accounts that no fill or transfer of the engine's m...
Definition config.hpp:159
std::size_t journal_max_bytes
roll over to the next part at this size (0: never)
Definition config.hpp:82
int quote_room_reserve
venue order-window room below which quotes do not chase (-1 off)
Definition config.hpp:147
int stall_ms
fastmm-live: the engine thread stuck inside one turn of its loop this long (Engine::heartbeat has not...
Definition config.hpp:102
std::string lock_file
Definition config.hpp:94
bool log_irq_affinity
fastmm-live: log the NICs' interrupt CPUs against the pinned ones.
Definition config.hpp:130
std::vector< int > net_cpus
Definition config.hpp:68
int base_flows_settle_s
Definition config.hpp:160
double queue_conservatism
queue position estimate (ctx.queue_ahead), 0..1
Definition config.hpp:118
int latency_publish_ms
Definition config.hpp:119
int min_requote_ticks
Definition config.hpp:138
int quote_token_reserve
[risk] order tokens quotes that add risk leave to others
Definition config.hpp:145
std::int64_t checkpoint_s
journal checkpoints this often (0: none)
Definition config.hpp:86
bool post_only
Definition config.hpp:141
std::string threading
fastmm-live: "split" runs the engine and each venue's network loop on their own threads; "single" run...
Definition config.hpp:78
std::string journal_compress
"none" | "zstd" (core/journal_archive.hpp)
Definition config.hpp:84
std::string on_kill
fastmm-live after a kill switch it did not ask for (risk limit, internal failure, every venue killed)...
Definition config.hpp:151
bool supports_replace
Definition config.hpp:142
int rt_priority
fastmm-live: SCHED_FIFO priority of the engine thread and of the network threads, 0 = off.
Definition config.hpp:127
int handoff_timeout_ms
--takeover: how long the new process waits for the running one to release the lock after it accepted ...
Definition config.hpp:97
int cpu_dma_latency_us
fastmm-live: PM QoS CPU latency request (/dev/cpu_dma_latency) held for the session,...
Definition config.hpp:125
std::vector< int > aux_cpus
Cores of every other thread (live/thread_affinity.hpp); empty: the cores no hot thread is pinned to.
Definition config.hpp:71
int min_qty_bps
Definition config.hpp:140
bool journal
Definition config.hpp:79
std::string net_backend
net::Reactor backend: "epoll" | "io_uring"
Definition config.hpp:75
std::string spin_mode
Definition config.hpp:72
int ack_timeout_ms
force-cancel an order without an ack after this long; 0 = off
Definition config.hpp:112
std::uint32_t max_events_per_step
Definition config.hpp:107
std::string name
Definition config.hpp:66
int flatten_interval_ms
Operator flatten (fastmm-ctl flatten): the sweep period, how long the engine keeps working the positi...
Definition config.hpp:115
std::string base_flows_from
Definition config.hpp:161
int reject_backoff_ms
QuoteManager: pause a side after a venue reject (0 = off)
Definition config.hpp:143
int endpoint_probe_interval_s
Definition config.hpp:134
int cpu
Definition config.hpp:67
bool net_spin_dedicated
Adaptive: a network thread alone on its pinned core never blocks (net_never_blocks).
Definition config.hpp:110
std::size_t journal_ring_bytes
Definition config.hpp:106
std::uint64_t rng_seed
Definition config.hpp:103
int journal_retention_days
delete journals older than this (0: keep)
Definition config.hpp:83
int endpoint_switch_us
Definition config.hpp:137
bool endpoint_select
Endpoint selection (net/endpoint_selector.hpp): connect to the fastest of a venue host's addresses.
Definition config.hpp:133
int flatten_slippage_bps
Definition config.hpp:117
std::int64_t timer_slack_ns
fastmm-live: PR_SET_TIMERSLACK of its threads, 0 = kernel's
Definition config.hpp:121
int net_rt_priority
Definition config.hpp:128
std::string journal_dir
Definition config.hpp:80
bool lock_memory
fastmm-live: mlockall(MCL_CURRENT | MCL_FUTURE)
Definition config.hpp:122
bool restore_position
Carry the previous session's positions over from the store (venues that replay executions).
Definition config.hpp:74
std::string cancel_unknown
Open orders a reconciliation finds on the session's symbols that the engine does not know: "all" canc...
Definition config.hpp:155
int min_requote_interval_ms
Definition config.hpp:139
std::size_t md_ring_bytes
Definition config.hpp:104
Definition config.hpp:164
double maker_bps
Definition config.hpp:165
double taker_bps
Definition config.hpp:166
fastmm-gateway's account guards: one venue's account, shared by every attached strategy.
Definition config.hpp:400
std::string max_loss
The account over every attached strategy, decimals in the settlement currency; empty = off.
Definition config.hpp:405
int orders_per_sec
new orders and replaces per venue, 0 = off
Definition config.hpp:401
UnderlyingSpec underlying
[gateway.underlying.<BASE>] max_net: the account's net position per base asset, base units.
Definition config.hpp:409
int burst
token-bucket capacity, 0 = orders_per_sec
Definition config.hpp:402
std::string max_gross_notional
sum of |position| at the marks
Definition config.hpp:406
std::string max_open_notional
notional working at a venue, decimal; empty = off
Definition config.hpp:403
std::map< std::string, std::string > shared
[gateway.shared.
Definition config.hpp:413
bool any() const noexcept
Definition config.hpp:416
bool check_balance
the account's balance covers every strategy's orders
Definition config.hpp:414
std::string max_net_notional
|signed sum| of the positions at the marks
Definition config.hpp:407
Definition config.hpp:487
std::map< std::string, std::string > values
Definition config.hpp:488
double get_double(std::string_view key, double def=0.0) const
std::map< std::string, int > lines
key -> line in the file; absent for keys set in code
Definition config.hpp:489
std::int64_t get_int(std::string_view key, std::int64_t def=0) const
bool has(std::string_view key) const
Definition config.hpp:490
std::string get_string(std::string_view key, std::string_view def="") const
bool get_bool(std::string_view key, bool def=false) const
One [[risk.hazard]] table (core/hazard.hpp).
Definition config.hpp:349
std::string mode
"pull" | "log"
Definition config.hpp:360
std::vector< std::string > instruments
Members: a symbol, "venue:symbol" or a group of [strategy.groups].
Definition config.hpp:352
std::string side
"bid" | "ask" | "both"
Definition config.hpp:355
bool prints
Definition config.hpp:359
double threshold
Definition config.hpp:356
std::string name
Definition config.hpp:350
double half_life_ms
Definition config.hpp:357
std::map< std::string, double > weights
"venue:symbol" or "symbol" = weight; a member not listed weighs 1.
Definition config.hpp:354
int hold_ms
Definition config.hpp:358
Definition config.hpp:286
std::optional< double > taker_bps
Definition config.hpp:306
std::string strike
Definition config.hpp:301
std::string lot
Definition config.hpp:293
std::string contract_multiplier
Definition config.hpp:297
std::optional< double > maker_bps
Per-instrument fee schedule; unset means the instrument pays its venue's [venues.
Definition config.hpp:305
std::string asset_class
Definition config.hpp:291
std::string expiry
Definition config.hpp:300
std::string max_qty
Definition config.hpp:295
std::string venue
Definition config.hpp:287
std::string base
Definition config.hpp:289
std::string min_qty
Definition config.hpp:294
std::string tick
Definition config.hpp:292
std::string option_type
Definition config.hpp:302
int price_decimals
Definition config.hpp:299
std::string min_notional
Definition config.hpp:296
std::string quote
Definition config.hpp:290
std::string initial_margin
A derivative's initial margin, fraction of the notional, decimal; empty: none configured.
Definition config.hpp:308
bool enabled
Definition config.hpp:298
std::string symbol
Definition config.hpp:288
Definition config.hpp:457
std::string file
Definition config.hpp:459
std::string mirror_level
Definition config.hpp:460
std::string level
Definition config.hpp:458
std::int64_t status_interval_s
Seconds between the per-venue status lines; 0: none.
Definition config.hpp:463
[venues.
Definition config.hpp:196
std::map< std::string, std::string > homes
symbol -> pool account
Definition config.hpp:205
std::string sweep
"false" | "true" | "auto"
Definition config.hpp:206
std::int64_t reduce_accounts
Definition config.hpp:199
double spill_at
Definition config.hpp:201
double plan_lookback_h
Definition config.hpp:203
std::string spill
Definition config.hpp:200
std::int64_t sweep_dust_s
Definition config.hpp:208
std::int64_t plan_max_moves
Definition config.hpp:204
std::int64_t sweep_delay_ms
Definition config.hpp:207
std::int64_t plan_interval_s
Definition config.hpp:202
std::int64_t sweep_retry_s
Definition config.hpp:209
bool configured
the table is present
Definition config.hpp:197
std::string placement
Definition config.hpp:198
Definition quote_manager.hpp:159
Definition risk_limits.hpp:18
Definition config.hpp:363
std::string max_gross_notional
Definition config.hpp:375
std::string max_loss_period
The span max_loss is a budget for: "total" (every session since the kill file was cleared) or "utc_da...
Definition config.hpp:374
int max_feed_lag_ms
0 = off
Definition config.hpp:380
int fat_finger_bps
Definition config.hpp:369
int fill_cluster_hold_ms
Definition config.hpp:384
int max_open_orders
Definition config.hpp:367
int fill_cluster_window_ms
Definition config.hpp:383
std::string max_position
Definition config.hpp:366
bool allow_unlimited
A keyed fastmm-live session starts without max_position (or max_order_notional) and max_loss only wit...
Definition config.hpp:390
bool reduce_only
The session starts in reduce-only mode for every instrument (fastmm-ctl reduce-only off ends it).
Definition config.hpp:393
UnderlyingSpec underlying
[risk.underlying.
Definition config.hpp:396
std::string max_order_qty
Definition config.hpp:364
std::string max_order_notional
Definition config.hpp:365
int price_collar_bps
Definition config.hpp:368
std::string max_net_notional
Definition config.hpp:376
int fill_cluster_names
The fill-cluster guard (core/fill_cluster.hpp): names 0 = off.
Definition config.hpp:382
std::vector< HazardSection > hazard
[[risk.hazard]]: the hazard groups (core/hazard.hpp); none: off.
Definition config.hpp:386
std::string max_loss
Definition config.hpp:371
int orders_per_sec
Definition config.hpp:377
int stale_md_ms
Definition config.hpp:370
int burst
Definition config.hpp:378
bool check_balance
refuse what the venue's balance cannot cover
Definition config.hpp:387
bool stp
Definition config.hpp:379
Free-form section used by the sim / backtest libraries: dotted keys -> stringified value.
Definition config.hpp:468
int settle_s
Definition config.hpp:472
int threads
Definition config.hpp:470
std::string status
empty: /dev/shm/fastmm-<name>.shadow
Definition config.hpp:479
std::vector< std::map< std::string, std::string > > points
Definition config.hpp:481
std::vector< int > cpus
Definition config.hpp:476
int max_lag_s
Definition config.hpp:473
std::vector< std::pair< std::string, std::vector< std::string > > > grid
Definition config.hpp:480
int nice
Definition config.hpp:474
int idle_exit_s
Definition config.hpp:475
bool configured() const noexcept
Definition config.hpp:482
int window_s
Definition config.hpp:471
std::string program
empty: fastmm-shadow beside this program
Definition config.hpp:477
std::string report
empty: <journal_dir>/<name>.shadow.json
Definition config.hpp:478
bool enabled
Definition config.hpp:469
Definition config.hpp:311
ParamMap params
Definition config.hpp:313
std::map< std::string, ParamMap > overrides
[strategy.overrides]: parameters of one instrument or group on top of params (strategies/param_overri...
Definition config.hpp:318
std::map< std::string, std::vector< std::string > > groups
[strategy.groups]: named lists of instruments ("symbol" or "venue:symbol").
Definition config.hpp:315
std::int64_t max_param_age_ms
0 = off
Definition config.hpp:319
std::int64_t state_interval_s
Definition config.hpp:321
std::string name
Definition config.hpp:312
std::string state_file
the strategy's state across sessions; empty: none
Definition config.hpp:320
[venues.
Definition config.hpp:214
std::int64_t breaker_s
Definition config.hpp:220
std::string state_file
empty: <journal_dir>/<engine name>.<primary>.transfers
Definition config.hpp:224
std::int64_t status_interval_s
Definition config.hpp:222
std::int64_t per_hour
Definition config.hpp:218
std::int64_t timeout_s
Definition config.hpp:221
std::int64_t max_in_flight
Definition config.hpp:216
std::int64_t per_day
Definition config.hpp:219
bool dry_run
Definition config.hpp:223
std::int64_t per_minute
Definition config.hpp:217
bool configured
the table is present
Definition config.hpp:215
[venues.
Definition config.hpp:171
std::string min_amount
Definition config.hpp:182
bool reserve
Definition config.hpp:178
std::string step
Definition config.hpp:184
std::int64_t max_per_hour
Definition config.hpp:187
double threshold
Definition config.hpp:181
std::int64_t interval_s
Definition config.hpp:185
std::int64_t min_interval_s
Definition config.hpp:186
std::int64_t settle_s
Definition config.hpp:190
std::string asset
Definition config.hpp:175
std::int64_t cooldown_s
Definition config.hpp:188
bool dry_run
Definition config.hpp:174
bool enabled
Definition config.hpp:173
std::map< std::string, double > weights
pool account -> weight (absent: 1)
Definition config.hpp:179
bool configured
the table is present
Definition config.hpp:172
std::string max_amount
Definition config.hpp:183
std::string state_file
empty: <journal_dir>/<engine name>.<primary>.treasury
Definition config.hpp:191
double headroom
Definition config.hpp:177
std::int64_t timeout_s
Definition config.hpp:189
std::string targets
"weights" | "demand"
Definition config.hpp:176
std::map< std::string, std::string > min_free
pool account -> decimal (absent: 0)
Definition config.hpp:180
Definition config.hpp:227
bool reduce_only
The session starts in reduce-only mode for this venue's instruments (fastmm-ctl reduce-only off --ven...
Definition config.hpp:247
bool supports_replace
Definition config.hpp:237
bool testnet
Definition config.hpp:236
bool insecure_tls
Definition config.hpp:248
std::string fill_audit_mode
Definition config.hpp:268
bool public_only
Market data only: no keys needed, no private sessions, no orders, not awaited at start,...
Definition config.hpp:240
std::string api_key
Definition config.hpp:233
PoolSection pool
Definition config.hpp:275
std::string ca_file
Definition config.hpp:249
std::string ws_api_url
Definition config.hpp:231
int md_copies
Fill audit (live/fill_auditor.hpp): every fill_audit_interval_s seconds fastmm-live compares the venu...
Definition config.hpp:264
std::vector< int > md_copy_cpus
Definition config.hpp:265
int recv_window_ms
Definition config.hpp:250
std::map< std::string, int > extra_lines
Definition config.hpp:283
std::string name
Definition config.hpp:228
std::string api_passphrase
OKX: the passphrase chosen with the API key.
Definition config.hpp:235
std::map< std::string, std::string > extra
Every key the generic parser does not interpret, stringified.
Definition config.hpp:282
FeesSection fees
Definition config.hpp:273
TreasurySection treasury
Definition config.hpp:274
std::string source_ip
Where this venue's connections leave the host from: one of its addresses, or the address of a network...
Definition config.hpp:253
TransfersSection transfers
Definition config.hpp:276
std::string api_secret
Definition config.hpp:234
std::string pool_of
Another account of the venue named: this one takes orders for that venue's instruments with its own k...
Definition config.hpp:244
std::optional< bool > endpoint_select
Endpoint selection for this venue's connections; nullopt: [engine] endpoint_select.
Definition config.hpp:256
std::string kind
Definition config.hpp:229
std::string source_interface
Definition config.hpp:254
int fill_audit_interval_s
Definition config.hpp:266
std::string rest_url
Definition config.hpp:232
int fill_audit_lag_s
Definition config.hpp:267
std::string ws_url
Definition config.hpp:230
std::string rules_mismatch
The connector's start-up trading rules against [[instruments]] (live/venue_slot.hpp settle_venue_rule...
Definition config.hpp:272
One [[windows]] table (core/windows.hpp), as written; window_config() resolves it.
Definition config.hpp:441
std::vector< std::string > except
local dates no occurrence starts on
Definition config.hpp:451
std::string from
first local date an occurrence may start on; "" = any
Definition config.hpp:449
std::string until
the last; "" = any
Definition config.hpp:450
std::vector< std::string > dates
"YYYY-MM-DD", local
Definition config.hpp:445
std::string name
Definition config.hpp:442
std::string duration
"30m", "1h30m", "2d"
Definition config.hpp:448
std::vector< std::string > days
"mon" ... "sun"; or
Definition config.hpp:444
std::string action
"pull" | "reduce_only"
Definition config.hpp:452
std::string zone
IANA name or POSIX TZ rule.
Definition config.hpp:443
std::string end
"HH:MM[:SS]", local; or
Definition config.hpp:447
std::string start
"HH:MM[:SS]", local
Definition config.hpp:446
std::vector< std::string > venues
scope: these venues' instruments ...
Definition config.hpp:453
std::vector< std::string > instruments
... and these; neither: the whole session
Definition config.hpp:454