FastMM documentation
FastMM C++ API 0.14.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
schema.hpp
Go to the documentation of this file.
1#pragma once
2// Declarative config schema (8.7): every known key with its section, type and whether it
3// is required. config.cpp validates the parsed TOML against this table and reports
4// errors with line numbers; an unknown key is an error too, so a misspelled or renamed key never
5// leaves the real one at its default.
6// Sections "sim", "backtest" and "storage" are free-form (owned by the sim, backtest and store
7// libraries), and a [venues.<name>] key this table does not list belongs to the connector its
8// `kind` names: the venue declares, validates and documents it
9// (include/fastmm/venues/registry.hpp).
10//
11// The doc strings are the key tables of docs/reference/configuration.md
12// (python3 tools/docs_config_ref.py regenerates them): say what the key does, its unit and its
13// default.
14#include <cstddef>
15#include <span>
16#include <string_view>
17
18namespace fastmm {
19
20enum class KeyType : unsigned char { String, Int, Float, Bool, IntArray, StringArray, Table, Any };
21
22struct KeySpec {
23 std::string_view section; // "engine", "venues.*", "instruments[]", "strategy", ...
24 std::string_view key;
27 std::string_view doc;
28};
30inline constexpr KeySpec kConfigSchema[] = {
31 // [engine]
32 {"engine",
33 "name",
35 false,
36 "session name, used in logs, journal file names and the status file (default \"fastmm\")"},
37 {"engine",
38 "cpu",
40 false,
41 "CPU core of the engine thread; -1 = not pinned (default -1)"},
42 {"engine",
43 "net_cpus",
45 false,
46 "CPU cores of the network threads, one per venue in order; venues given the same core run on "
47 "one thread when it polls (spin_mode = \"busy\", or net_spin_dedicated) and the core is not "
48 "the engine's; otherwise, with spin_mode = \"adaptive\", a thread whose core it shares with "
49 "the engine or another network thread blocks when idle instead of spinning (default [])"},
50 {"engine",
51 "aux_cpus",
53 false,
54 "fastmm-live, fastmm-gateway: CPU cores of the threads that are not the engine's or a "
55 "network thread's (journal, store, audit, treasury, resolvers, main); empty = every core but "
56 "cpu, net_cpus and the venues' md_copy_cpus, or, when those take every core, every core but "
57 "cpu and the cores of network threads that never block, with a warning (default [])"},
58 {"engine",
59 "spin_mode",
61 false,
62 "busy (spin forever) | adaptive (spin briefly, then block until work arrives; use on WSL2 "
63 "and laptops) (default adaptive)"},
64 {"engine",
65 "net_backend",
67 false,
68 "event loop of fastmm-live and fastmm-sim-exchange: epoll | io_uring (Linux 5.13 or newer; "
69 "falls back to epoll with a warning) (default epoll)"},
70 {"engine",
71 "threading",
73 false,
74 "fastmm-live: split (engine and network threads, rings between them) | single (one venue; "
75 "its network loop, the engine and order sending run on the engine thread, cpu; net_cpus is "
76 "ignored) (default split)"},
77 {"engine",
78 "journal",
80 false,
81 "record every consumed event to a .fmj journal (default true)"},
82 {"engine", "journal_dir", KeyType::String, false, "directory for journals (default \"runs\")"},
83 {"engine",
84 "journal_sync",
86 false,
87 "how far a journal write is pushed: async (the kernel writes it back; survives the process "
88 "dying) | fdatasync (fdatasync every 100 ms; survives power loss) (default async)"},
89 {"engine",
90 "journal_max_bytes",
92 false,
93 "roll the journal over to the next part at this size, bytes; each part is a complete journal "
94 "(\"x.fmj\", \"x.1.fmj\", ...); 0 = one file per session (default 0)"},
95 {"engine",
96 "journal_retention_days",
98 false,
99 "delete journals (.fmj and .fmj.zst) in journal_dir last written more than this many days "
100 "ago, at start and, in fastmm-live, every minute while it runs; 0 = keep everything "
101 "(default 0)"},
102 {"engine",
103 "journal_compress",
105 false,
106 "fastmm-live: none | zstd: compress each journal in journal_dir nobody is writing to "
107 "x.fmj.zst on a background thread, a minute after it was last written; the replay, "
108 "backtest and tools read either form (default none)"},
109 {"engine",
110 "journal_max_total_bytes",
112 false,
113 "cap on the journals in journal_dir, bytes, compressed or not: the oldest go first, at start "
114 "and, in fastmm-live, every minute; a part being written is never deleted; 0 = no cap "
115 "(default 0)"},
116 {"engine",
117 "checkpoint_s",
119 false,
120 "with a journal, how often the engine writes a checkpoint to it: the strategy's state() (a "
121 "strategy that keeps state), the positions and the open orders, seconds of engine time; a "
122 "backtest can start from any of them (default 0: never)"},
123 {"engine",
124 "epoch_file",
126 false,
127 "session epoch file, keeps client order ids unique across restarts (default "
128 "\"runs/session_epoch\")"},
129 {"engine",
130 "kill_file",
132 false,
133 "latched kill switch and cumulative PnL, so [risk] max_loss is a budget across restarts "
134 "(default \"<journal_dir>/<name>.kill\")"},
135 {"engine",
136 "instance_lock",
138 false,
139 "fastmm-live: take an exclusive lock on lock_file before touching the account and refuse to "
140 "start (exit code 8) while another process holds it; --standby and --takeover take it "
141 "whatever this says (default false)"},
142 {"engine",
143 "lock_file",
145 false,
146 "the instance lock's file (default \"<journal_dir>/<name>.lock\")"},
147 {"engine",
148 "handoff_timeout_ms",
150 false,
151 "fastmm-live --takeover: how long to wait for the running session to release the instance "
152 "lock once it accepted the handoff, ms (default 75000)"},
153 {"engine",
154 "markout_ms",
156 false,
157 "with a store, the mid at each fill and this many ms after it, up to 4 horizons, in the "
158 "store's markouts table (fastmm-pnl ab); e.g. [1000, 10000, 60000] (default: none)"},
159 {"engine",
160 "stall_ms",
162 false,
163 "fastmm-live: an engine thread that has not finished a turn of its loop for this long (a "
164 "strategy hook that never returns) is given up: every venue cancels all its orders and the "
165 "process exits with code 5, ms; 0 = never (default 10000)"},
166 {"engine",
167 "ack_timeout_ms",
169 false,
170 "force-cancel an order whose ack has not arrived within this long, ms; 0 = off (default 0)"},
171 {"engine",
172 "queue_conservatism",
174 false,
175 "the queue position estimate ctx.queue_ahead, from 0 to 1: at 0 a level's shrink is shared "
176 "between cancels ahead of and behind our order, at 1 cancels never move it up (default 1.0; "
177 "a backtest uses [backtest] queue_conservatism when set)"},
178 {"engine",
179 "flatten_interval_ms",
181 false,
182 "how often an operator flatten looks at the position left and sends the next reduce-only "
183 "slice, ms (default 500)"},
184 {"engine",
185 "flatten_timeout_ms",
187 false,
188 "how long an operator flatten keeps trying before it gives up and leaves the position, ms; "
189 "0 = until it is flat or an operator stops it (default 60000)"},
190 {"engine",
191 "flatten_slippage_bps",
193 false,
194 "how far through the touch a flatten prices its orders when the command gives no "
195 "--max-slippage-bps, basis points (default 25)"},
196 {"engine",
197 "rng_seed",
199 false,
200 "seed of the strategy random generator ctx.rng() (default 1)"},
201 {"engine",
202 "md_ring_bytes",
204 false,
205 "market-data ring per venue, bytes, a power of two (default 4194304)"},
206 {"engine",
207 "order_ring_bytes",
209 false,
210 "order-event ring per venue, bytes, a power of two (default 1048576)"},
211 {"engine",
212 "journal_ring_bytes",
214 false,
215 "engine-to-journal ring, bytes, a power of two (default 16777216)"},
216 {"engine",
217 "max_events_per_step",
219 false,
220 "events taken from each ring per engine iteration (default 64)"},
221 {"engine",
222 "feed_budget_per_ring",
224 false,
225 "fastmm-live: events the engine takes from one input ring before the next ring's turn; 1 "
226 "interleaves the rings, so a burst of one account's order events does not hold up the "
227 "market data behind it (default 64)"},
228 {"engine",
229 "net_spin_dedicated",
231 false,
232 "with spin_mode = \"adaptive\": a network thread pinned to a core of its own (net_cpus, "
233 "shared with neither the engine nor another network thread) polls without ever blocking, as "
234 "with \"busy\", and so does the one thread of the venues net_cpus gives one core; threads "
235 "on the engine's core or unpinned still block when idle (default false)"},
236 {"engine",
237 "crossed_grace_ms",
239 false,
240 "tolerate a crossed book this long before pulling its quotes, ms (default 100)"},
241 {"engine",
242 "latency_publish_ms",
244 false,
245 "latency histogram publish interval, ms (default 1000)"},
246 {"engine",
247 "tsc_recalibrate_s",
249 false,
250 "fastmm-live: TSC recalibration period, s; 0 = off (default 10)"},
251 {"engine",
252 "timer_slack_ns",
254 false,
255 "fastmm-live: timer slack of its threads, ns; how late a timed wait may end (adaptive "
256 "spin_mode: the engine's idle wait, at most 1 ms, and with threading = \"single\" a 50 us "
257 "sleep); 0 = the kernel's, 50000 (default 0)"},
258 {"engine",
259 "restore_position",
261 false,
262 "carry the previous session's positions over from the store and replay the venue's executions "
263 "since its last recorded fill (venues that can replay executions); default true"},
264 {"engine",
265 "lock_memory",
267 false,
268 "fastmm-live: mlockall() the process, so no page is swapped out or faulted in on the hot "
269 "path; needs ulimit -l above the process size, a warning otherwise (default false)"},
270 {"engine",
271 "cpu_dma_latency_us",
273 false,
274 "fastmm-live: holds /dev/cpu_dma_latency at this many us for the session, so no CPU enters "
275 "an idle state that takes longer to wake; 0 keeps every CPU polling in C0; needs write "
276 "access to the device, a warning otherwise; -1 = no request (default -1)"},
277 {"engine",
278 "rt_priority",
280 false,
281 "fastmm-live: SCHED_FIFO priority 1..99 of the engine thread (with threading = \"single\" it "
282 "also runs the network loop); needs CAP_SYS_NICE or ulimit -r at least as high, a warning "
283 "otherwise; a busy-spinning FIFO thread starves the kernel's threads on its core unless the "
284 "core is isolated; 0 = the default scheduler (default 0)"},
285 {"engine",
286 "net_rt_priority",
288 false,
289 "fastmm-live: SCHED_FIFO priority 1..99 of the network threads, as rt_priority; ignored with "
290 "threading = \"single\"; 0 = the default scheduler (default 0)"},
291 {"engine",
292 "log_irq_affinity",
294 false,
295 "fastmm-live: at start, log each network interface's queue interrupts with the CPUs they may "
296 "run on and which of them are cpu or net_cpus, and warn about any that may run on the "
297 "engine's CPU; read only (default false)"},
298 {"engine",
299 "endpoint_select",
301 false,
302 "fastmm-live, fastmm-gateway: connect to the fastest of each venue host's addresses, as "
303 "measured by TCP connects to every address the lookups return; the default of every "
304 "[venues.<name>] endpoint_select (default false)"},
305 {"engine",
306 "endpoint_probe_interval_s",
308 false,
309 "with endpoint selection: how often a background thread looks the hosts in use up again and "
310 "probes their addresses, s; connections also probe whenever they connect; 0 = only then "
311 "(default 300)"},
312 {"engine",
313 "endpoint_probe_samples",
315 false,
316 "with endpoint selection: TCP connects to each address per probe, ranked by their median, "
317 "1 to 100 (default 8)"},
318 {"engine",
319 "endpoint_spread_us",
321 false,
322 "with endpoint selection: addresses this close to the fastest count as fast, and a new "
323 "connection takes the one of them with the fewest connections, so a venue's md_copies spread "
324 "over them, us (default 20)"},
325 {"engine",
326 "endpoint_switch_us",
328 false,
329 "with endpoint selection: a live connection that rolls over (Binance) moves to the fastest "
330 "address, make-before-break, once its own is this much slower or no lookup returns it; "
331 "others move when they next connect; 0 = never moves, us (default 50)"},
332 {"engine",
333 "min_requote_ticks",
335 false,
336 "keep a resting quote whose price is within this many ticks of the desired price (default 1)"},
337 {"engine",
338 "min_requote_interval_ms",
340 false,
341 "change the same quote slot at most this often, ms (default 50)"},
342 {"engine",
343 "min_qty_bps",
345 false,
346 "keep a resting quote whose remaining quantity covers this share of the desired quantity, "
347 "bps (default 8000 = 80 %)"},
348 {"engine", "post_only", KeyType::Bool, false, "send quotes as post-only orders (default true)"},
349 {"engine",
350 "supports_replace",
352 false,
353 "let the quote manager amend orders in place where the venue supports it (default true)"},
354 {"engine",
355 "reject_backoff_ms",
357 false,
358 "after the venue refuses a quote's new order or replace, other than a post-only cross or an "
359 "order it no longer has, or the price collar or fat-finger band refuses it, no new orders or "
360 "replaces on that side for this long, doubling with each further refusal, then the side "
361 "quotes "
362 "again, ms; 0 = off (default 1000)"},
363 {"engine",
364 "reject_backoff_max_ms",
366 false,
367 "cap of the doubling reject backoff, ms (default 60000)"},
368 {"engine",
369 "quote_token_reserve",
371 false,
372 "order tokens of [risk] orders_per_sec a quote that does not reduce the position leaves for "
373 "the strategy's own orders and for quotes that do; quotes short of a token wait and are "
374 "placed in turn as tokens return, not refused (default 0)"},
375 {"engine",
376 "send_token_reserve",
378 false,
379 "order tokens of [risk] orders_per_sec every quote leaves for the orders the strategy sends "
380 "itself, which are refused without a token where quotes wait for one; a quote that does not "
381 "reduce the position leaves quote_token_reserve on top of it (default 0)"},
382 {"engine",
383 "quote_room_reserve",
385 false,
386 "orders an account's venue order windows keep for quotes into empty levels and moves away "
387 "from the touch: with no more left, a resting quote is not moved towards the touch and stays "
388 "where it is; -1 = off (default 0: only when none is left)"},
389 {"engine",
390 "on_kill",
392 false,
393 "fastmm-live after a kill switch the engine trips itself ([risk] max_loss, a full ring, every "
394 "venue killed): exit (normal shutdown, exit code 6) | stay (keep running with quoting off) "
395 "(default exit)"},
396 {"engine",
397 "cancel_unknown",
399 false,
400 "open orders the engine does not know, found on its symbols at start-up and after a "
401 "reconnect: all (cancel every one; the account must be FastMM's alone) | own (cancel only "
402 "those with a FastMM client order id of this engine's epochs) (default all)"},
403 {"engine",
404 "base_flows",
406 false,
407 "a change of a spot instrument's base asset on its accounts that no fill and no transfer of "
408 "the engine's made (a token dividend, an airdrop, a deposit): off | report (log and journal "
409 "it) | adjust (and book it to the position at the mid) (default off)"},
410 {"engine",
411 "base_flows_settle_s",
413 false,
414 "how long such a change must hold before it counts, s (default 30)"},
415 {"engine",
416 "base_flows_from",
418 false,
419 "what base_flows measures the accounts' balance against the position from: session (the "
420 "difference when the session's balances first settle) | zero (the position is to equal the "
421 "balance, a difference at the start included) (default session)"},
422 // [venues.<name>]
423 {"venues.*",
424 "kind",
426 true,
427 "name of a registered connector; the keys it adds to this section are its own "
428 "(see Connectors below)"},
429 {"venues.*", "ws_url", KeyType::String, false, "market-data WebSocket URL"},
430 {"venues.*",
431 "ws_api_url",
433 false,
434 "order-entry WebSocket API URL, where the venue has one"},
435 {"venues.*", "rest_url", KeyType::String, false, "REST base URL"},
436 {"venues.*", "api_key", KeyType::String, false, "API key, written as \"${VARIABLE}\""},
437 {"venues.*", "api_secret", KeyType::String, false, "API secret, written as \"${VARIABLE}\""},
438 {"venues.*",
439 "api_passphrase",
441 false,
442 "API key passphrase where the venue has one (OKX, Coinbase Exchange), written as "
443 "\"${VARIABLE}\""},
444 {"venues.*",
445 "testnet",
447 false,
448 "the endpoints are a testnet or demo environment (default true)"},
449 {"venues.*",
450 "supports_replace",
452 false,
453 "the venue can amend an order in place (default false)"},
454 {"venues.*",
455 "insecure_tls",
457 false,
458 "skip TLS certificate verification; local simulator only (default false)"},
459 {"venues.*",
460 "ca_file",
462 false,
463 "extra CA certificate, for example tests/fixtures/tls/cert.pem for the local simulator"},
464 {"venues.*",
465 "public_only",
467 false,
468 "market data only: no keys, no private sessions, no orders on this venue (default false)"},
469 {"venues.*",
470 "pool_of",
472 false,
473 "name of another [venues.<name>] of the same kind whose instruments this account takes orders "
474 "for, with its own keys, balances and order-count windows; no instruments or market data of "
475 "its own (default none)"},
476 {"venues.*",
477 "reduce_only",
479 false,
480 "start in reduce-only mode for this venue's instruments: orders that would take a position "
481 "further from zero are refused until fastmm-ctl reduce-only off --venue <name> (default "
482 "false)"},
483 {"venues.*",
484 "recv_window_ms",
486 false,
487 "validity window of signed requests, ms (default 3000)"},
488 {"venues.*",
489 "source_ip",
491 false,
492 "the venue's connections leave this host from this address, IPv4 or IPv6; it must be one of "
493 "the host's (default: the kernel chooses)"},
494 {"venues.*",
495 "source_interface",
497 false,
498 "the venue's connections leave this host from this network interface's address; exclusive "
499 "with source_ip (default: the kernel chooses)"},
500 {"venues.*",
501 "endpoint_select",
503 false,
504 "connect to the fastest of each of the venue's host's addresses ([engine] "
505 "endpoint_probe_interval_s and the other endpoint_ keys tune it); the connections keep the "
506 "host name for TLS and HTTP (default: [engine] endpoint_select)"},
507 {"venues.*",
508 "md_copies",
510 false,
511 "redundant market-data connections carrying the venue's top-of-book streams again; each "
512 "update reaches the engine once, from whichever connection delivered it first (connectors "
513 "with copies: binance, binance_usdm; 0 to 8, default 0)"},
514 {"venues.*",
515 "md_copy_cpus",
517 false,
518 "fastmm-live: CPU cores of network threads of their own for the copies, one per copy in "
519 "order; copies given the same core share a thread, -1 = a thread not pinned; copies past the "
520 "end of the list run on the venue's network thread (default [], all of them do)"},
521 {"venues.*",
522 "fill_audit_interval_s",
524 false,
525 "fastmm-live compares the venue's trade history with the stored fills this often, s; 0 = off "
526 "(default 0, at least 10)"},
527 {"venues.*",
528 "fill_audit_lag_s",
530 false,
531 "a fill audit reads up to this long ago, s, so the execution replay has booked what it will "
532 "(default 180)"},
533 {"venues.*",
534 "fill_audit_mode",
536 false,
537 "\"report\" logs and counts what differs; \"book\" also books the executions the engine "
538 "missed "
539 "(default \"report\")"},
540 {"venues.*",
541 "rules_mismatch",
543 false,
544 "a tick, lot, min_qty, max_qty or min_notional of [[instruments]] that differs from the "
545 "venue's at start-up: \"adopt\" the venue's (default), \"warn\" and keep the configured "
546 "one, or \"refuse\" to start"},
547 {"venues.*",
548 "fees",
550 false,
551 "[venues.<name>.fees] table: maker_bps and taker_bps, used for PnL"},
552 {"venues.*.fees",
553 "maker_bps",
555 false,
556 "maker fee, bps; negative = rebate (default 0)"},
557 {"venues.*.fees", "taker_bps", KeyType::Float, false, "taker fee, bps (default 0)"},
558 {"venues.*",
559 "treasury",
561 false,
562 "[venues.<primary>.treasury] table: transfers that keep one asset spread over the accounts "
563 "of the pool this venue is the primary of (fastmm-live)"},
564 {"venues.*.treasury",
565 "enabled",
567 false,
568 "move the asset between the pool's accounts (default false)"},
569 {"venues.*.treasury",
570 "dry_run",
572 false,
573 "log and journal the planned transfers without sending them; needs no transfer key (default "
574 "false)"},
575 {"venues.*.treasury",
576 "asset",
578 false,
579 "the asset kept spread, for example USDT; required when enabled"},
580 {"venues.*.treasury",
581 "targets",
583 false,
584 "\"weights\": each account's target is its weight's share of the pool's free balance; "
585 "\"demand\": what the strategy's funding needs of the instruments homed there add up to "
586 "(ctx.set_funding_need), needs a [venues.<primary>.pool] table (default \"weights\")"},
587 {"venues.*.treasury",
588 "headroom",
590 false,
591 "demand targets: each account's need times (1 + headroom) (default 0.15)"},
592 {"venues.*.treasury",
593 "reserve",
595 false,
596 "the engine holds a planned transfer out of the payer's free balance until it resolves, so no "
597 "order spends it first (default false)"},
598 {"venues.*.treasury",
599 "weights",
601 false,
602 "{ <account> = <weight>, ... }: each account's share of the pool's free balance (default 1 "
603 "each)"},
604 {"venues.*.treasury",
605 "min_free",
607 false,
608 "{ <account> = \"<decimal>\", ... }: free balance an account is topped up to and never gives "
609 "below (default 0)"},
610 {"venues.*.treasury",
611 "threshold",
613 false,
614 "an account is short below its target times (1 - threshold), 0 to 1 (default 0.2)"},
615 {"venues.*.treasury",
616 "min_amount",
618 false,
619 "smallest transfer, decimal (default 0)"},
620 {"venues.*.treasury",
621 "max_amount",
623 false,
624 "largest transfer, decimal; 0 = no cap (default 0)"},
625 {"venues.*.treasury",
626 "step",
628 false,
629 "transfer amounts round down to a multiple of it, decimal (default 0.01)"},
630 {"venues.*.treasury",
631 "interval_s",
633 false,
634 "how often the balances are looked at and a transfer in flight is asked for, s (default 10)"},
635 {"venues.*.treasury",
636 "min_interval_s",
638 false,
639 "least time between two transfers sent, s (default 60)"},
640 {"venues.*.treasury",
641 "max_per_hour",
643 false,
644 "transfers sent in any hour; 0 = no limit (default 12)"},
645 {"venues.*.treasury",
646 "cooldown_s",
648 false,
649 "no transfer for this long after one failed or timed out, s (default 300)"},
650 {"venues.*.treasury",
651 "timeout_s",
653 false,
654 "a transfer unresolved this long times out (cooldown_s; still asked for), and one the venue "
655 "has no record of fails, s (default 60)"},
656 {"venues.*.treasury",
657 "settle_s",
659 false,
660 "longest wait after a transfer for both accounts' balances to report it, s (default 30)"},
661 {"venues.*.treasury",
662 "state_file",
664 false,
665 "the transfers in flight, the id counter and the limiter across restarts (default "
666 "<journal_dir>/<engine name>.<primary>.treasury)"},
667 {"venues.*",
668 "pool",
670 false,
671 "[venues.<primary>.pool] table: where the pool this venue is the primary of keeps each "
672 "instrument's position (home placement) and the planner that spreads the homes"},
673 {"venues.*.pool",
674 "placement",
676 false,
677 "\"balance\": each new order to the account whose balance covers it with the most order "
678 "window left; \"home\": each instrument's position on one account, its home: an order goes "
679 "there unless it takes a piece on another account towards zero (default \"balance\")"},
680 {"venues.*.pool",
681 "reduce_accounts",
683 false,
684 "accounts that may carry reducing orders of one instrument and side at once; 1 offers a "
685 "piece alone until it is gone (default 1)"},
686 {"venues.*.pool",
687 "spill",
689 false,
690 "\"never\": an order for a home that is down is refused HomeUnavailable; \"flat\": an "
691 "instrument flat over the pool and not pinned moves to the usable account with the most "
692 "order window first; \"busy\": a spot order that adds goes to the account the balance "
693 "routing picks when its home is down, past spill_at of its 10 s window, short of the "
694 "balance or priced out by [capacity], and the home stays (default \"never\")"},
695 {"venues.*.pool",
696 "spill_at",
698 false,
699 "spill = \"busy\": the share of the home's 10 s order window, as its connector admits it, "
700 "from which adding orders go to another account (default 0.8)"},
701 {"venues.*.pool",
702 "plan_interval_s",
704 false,
705 "how often the planner moves homes to spread the orders the homes carry over the accounts' "
706 "10 s windows, s; 0 = no planner (default 30)"},
707 {"venues.*.pool",
708 "plan_lookback_h",
710 false,
711 "hours of the engine's own orders the planner plans from (default 1)"},
712 {"venues.*.pool",
713 "plan_max_moves",
715 false,
716 "instruments the planner moves at most per plan (default 3)"},
717 {"venues.*.pool",
718 "homes",
720 false,
721 "{ <symbol> = \"<account>\", ... }: pinned homes the planner and a spill never move "
722 "(default none)"},
723 {"venues.*.pool",
724 "sweep",
726 false,
727 "true: the engine moves a spot instrument's free base on another account of the pool to its "
728 "home by internal transfer, and sends reducing orders to the home; \"auto\": true when the "
729 "primary's connector has a transfer key (default false)"},
730 {"venues.*.pool",
731 "sweep_delay_ms",
733 false,
734 "a piece is swept once its holding and the free part of it have not changed for this long, "
735 "ms (default 3000)"},
736 {"venues.*.pool",
737 "sweep_dust_s",
739 false,
740 "an amount below the tradable minimum is swept after this long, or with the delay when the "
741 "home holds a tradable amount, s (default 3600)"},
742 {"venues.*.pool",
743 "sweep_retry_s",
745 false,
746 "after a refused transfer the payer's asset waits this long, s (default 30)"},
747 {"venues.*",
748 "transfers",
750 false,
751 "[venues.<primary>.transfers] table: the budget and breaker of the transfers the engine makes "
752 "for the pool's sweep"},
753 {"venues.*.transfers",
754 "max_in_flight",
756 false,
757 "transfers unresolved at once, at most 16; one per asset (default 8)"},
758 {"venues.*.transfers",
759 "per_minute",
761 false,
762 "transfers created in any minute (default 20)"},
763 {"venues.*.transfers",
764 "per_hour",
766 false,
767 "transfers created in any hour (default 300)"},
768 {"venues.*.transfers",
769 "per_day",
771 false,
772 "transfers created in any 24 h; once used, pieces trade off on their accounts (default "
773 "3000)"},
774 {"venues.*.transfers",
775 "breaker_s",
777 false,
778 "the sweep pauses this long after 5 failures, 3 unknown answers or 10 refusals for want of "
779 "balance in 10 minutes, or a rate-limit answer; a second trip turns it off until fastmm-ctl "
780 "pool sweep on, s (default "
781 "900)"},
782 {"venues.*.transfers",
783 "timeout_s",
785 false,
786 "an unresolved transfer this old is reported late, and one the venue has no record of fails, "
787 "s (default 60)"},
788 {"venues.*.transfers",
789 "status_interval_s",
791 false,
792 "a transfer not confirmed by both accounts' flows is asked for this often, s (default 10)"},
793 {"venues.*.transfers",
794 "dry_run",
796 false,
797 "journal and count the transfers the sweep would make; hold and send nothing, and route as "
798 "without the sweep (default false)"},
799 {"venues.*.transfers",
800 "state_file",
802 false,
803 "the transfers in flight across restarts (default <journal_dir>/<engine "
804 "name>.<primary>.transfers)"},
805 // [[instruments]]
806 {"instruments[]", "venue", KeyType::String, true, "name of a [venues.<name>] table"},
807 {"instruments[]", "symbol", KeyType::String, true, "venue symbol, for example BTCUSDT"},
808 {"instruments[]", "base", KeyType::String, false, "base asset, for example BTC"},
809 {"instruments[]", "quote", KeyType::String, false, "quote asset, for example USDT"},
810 {"instruments[]",
811 "asset_class",
813 false,
814 "spot | perpetual (perp) | future (futures) | option | fx | equity (default spot)"},
815 {"instruments[]", "tick", KeyType::Any, true, "price increment, decimal"},
816 {"instruments[]", "lot", KeyType::Any, true, "quantity increment, decimal"},
817 {"instruments[]", "min_qty", KeyType::Any, false, "smallest order quantity, decimal"},
818 {"instruments[]", "max_qty", KeyType::Any, false, "largest order quantity, decimal"},
819 {"instruments[]",
820 "min_notional",
822 false,
823 "smallest order value, settlement currency (base coin for an inverse contract), "
824 "decimal"},
825 {"instruments[]",
826 "contract_multiplier",
828 false,
829 "units of the underlying per contract, decimal; PnL and notional use it (default 1)"},
830 {"instruments[]",
831 "enabled",
833 false,
834 "trade this instrument; false loads it without trading (default true)"},
835 {"instruments[]", "price_decimals", KeyType::Int, false, "price display precision (default 8)"},
836 {"instruments[]", "expiry", KeyType::String, false, "expiry of a derivative, ISO-8601"},
837 {"instruments[]", "strike", KeyType::Any, false, "option strike, decimal"},
838 {"instruments[]", "option_type", KeyType::String, false, "call | put"},
839 {"instruments[]",
840 "maker_bps",
842 false,
843 "maker fee of this instrument, bps; negative = rebate. Overrides the venue's fees table"},
844 {"instruments[]",
845 "taker_bps",
847 false,
848 "taker fee of this instrument, bps. Overrides the venue's fees table"},
849 {"instruments[]",
850 "initial_margin",
852 false,
853 "initial margin of a derivative, fraction of the notional (0.1 at 10x leverage), decimal; the "
854 "balance check and estimate use it (default: none, an order passes while the venue reports "
855 "margin available)"},
856 // [strategy]
857 {"strategy", "name", KeyType::String, true, "registered strategy name (see --list-strategies)"},
858 {"strategy",
859 "max_param_age_ms",
861 false,
862 "disable quoting before the first parameter update and while none was applied for this long, "
863 "ms of engine time (default 0: off)"},
864 {"strategy",
865 "state_file",
867 false,
868 "file the strategy's state() is written to every state_interval_s and at the end, and "
869 "restore() reads at the start (a strategy that keeps state; default: none)"},
870 {"strategy",
871 "state_interval_s",
873 false,
874 "how often the state is written, seconds of engine time (default 300)"},
875 {"strategy",
876 "params",
878 false,
879 "[strategy.params] table: the strategy's parameters"},
880 {"strategy.params", "*", KeyType::Any, false, "strategy parameters (validated by the schema)"},
881 {"strategy",
882 "groups",
884 false,
885 "[strategy.groups] table: name = [\"symbol\" or \"venue:symbol\", ...], instruments that "
886 "[strategy.overrides] and fastmm-ctl param --group name together"},
887 {"strategy.groups", "*", KeyType::Any, false, "the instruments of one group"},
888 {"strategy",
889 "overrides",
891 false,
892 "[strategy.overrides.<key>] tables: parameters of one instrument (\"symbol\" or "
893 "\"venue:symbol\") or group on top of [strategy.params]; an instrument's own table wins over "
894 "its groups' (a strategy with a parameter set per instrument)"},
895 {"strategy.overrides", "*", KeyType::Table, false, "the parameters of one instrument or group"},
896 {"strategy.overrides.*", "*", KeyType::Any, false, "one strategy parameter"},
897 // [ab]
898 {"ab",
899 "name",
901 true,
902 "name of the test, up to 32 letters, digits, '_', '-' or '.'; the store and journal record it "
903 "with every arm assignment"},
904 {"ab",
905 "assignment",
907 true,
908 "instrument (each instrument stays in one arm, the arms balanced on weights) | time (every "
909 "instrument in the same arm, the arm changing each block) | crossover (instruments split as "
910 "with instrument, each one changing arm each block) | branch (a backtest only: one run per "
911 "arm over the same data and seed, every instrument in that arm from the start of trading)"},
912 {"ab",
913 "seed",
915 false,
916 "seed of the instrument split and of the order of the arms over the blocks (default 1)"},
917 {"ab",
918 "block_s",
920 false,
921 "time, crossover: block length, s; blocks start at multiples of it since 1970-01-01 UTC, and "
922 "each run of as many blocks as there are arms gives every arm one, in an order drawn from "
923 "seed "
924 "(required with time and crossover, refused with instrument)"},
925 {"ab",
926 "start",
928 false,
929 "UTC time the test starts, YYYY-MM-DD, YYYY-MM-DDTHH:MM or YYYY-MM-DDTHH:MM:SSZ; before it "
930 "the configured parameters run (default: at the start of the session)"},
931 {"ab",
932 "end",
934 false,
935 "UTC time the test ends, as start; after it the configured parameters run again (default: "
936 "none)"},
937 {"ab",
938 "weights",
940 false,
941 "[ab.weights] table: instrument, crossover: the weight of each instrument (\"venue:symbol\" "
942 "or \"symbol\" = number >= 0, e.g. its daily volume), every instrument or none; instruments "
943 "of similar weight go to different arms (default: equal weights)"},
944 {"ab.weights", "*", KeyType::Float, false, "weight of one instrument"},
945 {"ab",
946 "assign",
948 false,
949 "[ab.assign] table: instrument, crossover: the arm of each instrument (\"venue:symbol\" or "
950 "\"symbol\" = arm name) instead of a drawn split; an instrument not listed stays out of the "
951 "test (default: drawn, balanced on weights)"},
952 {"ab.assign", "*", KeyType::String, false, "arm of one instrument"},
953 {"ab",
954 "block_offset_s",
956 false,
957 "time, crossover: blocks start this many seconds after the multiples of block_s, 0 to "
958 "block_s - 1; with block_s = 86400, 79200 starts each day at 22:00 UTC (default 0)"},
959 {"ab",
960 "arms",
962 true,
963 "[[ab.arms]] tables, 2 to 16, in order: arm 0 is the control the readout compares the others "
964 "with"},
965 {"ab.arms[]", "name", KeyType::String, true, "arm name, up to 16 letters, digits, '_' or '-'"},
966 {"ab.arms[]",
967 "params",
969 false,
970 "[ab.arms.params] table: the arm's strategy parameters on top of [strategy.params] (default: "
971 "none, the configured values); the parameters the arms name, 32 at most, belong to the test "
972 "while it runs"},
973 {"ab.arms[].params", "*", KeyType::Any, false, "one strategy parameter of the arm"},
974 // [risk]
975 {"risk", "max_order_qty", KeyType::Any, false, "largest order quantity, decimal"},
976 {"risk",
977 "max_order_notional",
979 false,
980 "largest order value, settlement currency (base coin for an inverse contract), decimal"},
981 {"risk",
982 "max_position",
984 false,
985 "largest absolute position per instrument, counting same-side open orders, decimal"},
986 {"risk", "max_open_orders", KeyType::Int, false, "open orders per instrument"},
987 {"risk",
988 "price_collar_bps",
990 false,
991 "refuse limit prices further than this from the mid, bps"},
992 {"risk",
993 "fat_finger_bps",
995 false,
996 "refuse limit prices further than this from the last trade, bps"},
997 {"risk",
998 "stale_md_ms",
1000 false,
1001 "refuse orders when the instrument's book is older than this, ms"},
1002 {"risk",
1003 "max_loss",
1005 false,
1006 "trip the kill switch when net PnL falls to -max_loss, settlement currency (the "
1007 "[accounting] reporting_currency when set), decimal; latched across restarts in kill_file"},
1008 {"risk",
1009 "max_loss_period",
1011 false,
1012 "what max_loss is a budget for: total (every session since kill_file was cleared) | utc_day "
1013 "(net PnL from 00:00 UTC; a trip stays latched across the day) (default total)"},
1014 {"risk",
1015 "max_gross_notional",
1017 false,
1018 "refuse an order that would take the portfolio's summed |position| at the last marks past "
1019 "this, settlement currency (or reporting_currency), decimal"},
1020 {"risk",
1021 "max_net_notional",
1023 false,
1024 "refuse an order that would take the portfolio's signed position sum further past this, "
1025 "settlement currency (or reporting_currency), decimal"},
1026 {"risk", "orders_per_sec", KeyType::Int, false, "token-bucket order rate, orders/s"},
1027 {"risk",
1028 "burst",
1030 false,
1031 "token-bucket capacity, orders (default orders_per_sec)"},
1032 {"risk",
1033 "stp",
1035 false,
1036 "self-trade prevention against our own resting orders (default true)"},
1037 {"risk",
1038 "max_feed_lag_ms",
1040 false,
1041 "pull a venue's quotes and refuse orders that could rest there without reducing the "
1042 "position while its market data arrives this much later than its baseline, ms; resumes "
1043 "100 ms after the last message over it (default 0: off)"},
1044 {"risk",
1045 "fill_cluster_names",
1047 false,
1048 "the fill-cluster guard: when maker fills of our quotes on one side cover this many distinct "
1049 "instruments within fill_cluster_window_ms, that side's quotes are pulled on every instrument "
1050 "for fill_cluster_hold_ms, then put back (0 to 16; default 0: off)"},
1051 {"risk",
1052 "fill_cluster_window_ms",
1054 false,
1055 "the fill-cluster guard's window, ms (default 500)"},
1056 {"risk",
1057 "fill_cluster_hold_ms",
1059 false,
1060 "how long the fill-cluster guard holds the side after the last fill that completed a cluster, "
1061 "ms (default 500)"},
1062 {"risk",
1063 "hazard",
1065 false,
1066 "[[risk.hazard]] tables, 16 at most: groups of instruments whose quotes on one side are "
1067 "pulled together when evidence that the side is being picked off reaches a threshold "
1068 "(default: none)"},
1069 {"risk.hazard[]", "name", KeyType::String, true, "group name, for the log"},
1070 {"risk.hazard[]",
1071 "instruments",
1073 true,
1074 "the members: \"symbol\", \"venue:symbol\" or the name of a [strategy.groups] group; an "
1075 "instrument belongs to one hazard group at most"},
1076 {"risk.hazard[]",
1077 "weights",
1079 false,
1080 "[risk.hazard.weights] \"symbol\" or \"venue:symbol\" = number: what a unit of notional on "
1081 "that member adds to the score (default 1 for each member)"},
1082 {"risk.hazard[]",
1083 "threshold",
1085 true,
1086 "the score that pulls a side, in quote notional times weight; the score is the sum of the "
1087 "evidence, each piece halving every half_life_ms"},
1088 {"risk.hazard[]",
1089 "half_life_ms",
1091 false,
1092 "half-life of the score, ms (default 20)"},
1093 {"risk.hazard[]",
1094 "hold_ms",
1096 false,
1097 "how long the side stays pulled after the last evidence that found the score at the "
1098 "threshold, ms (default 500)"},
1099 {"risk.hazard[]",
1100 "side",
1102 false,
1103 "the sides the group scores and pulls: \"bid\", \"ask\" or \"both\" (default \"both\")"},
1104 {"risk.hazard[]",
1105 "prints",
1107 false,
1108 "count a public print that reaches a quote of ours when it arrives before the fill's own "
1109 "report (default true)"},
1110 {"risk.hazard[]",
1111 "mode",
1113 false,
1114 "\"pull\" cancels the side's quotes and holds it; \"log\" keeps the score and only logs "
1115 "what it would have pulled and the fills that arrived meanwhile (default \"pull\")"},
1116 {"risk",
1117 "check_balance",
1119 false,
1120 "refuse an order the venue's reported balance, less this session's orders and fills since, "
1121 "cannot cover; off for a venue until it reports balances (default true)"},
1122 {"risk",
1123 "reduce_only",
1125 false,
1126 "start in reduce-only mode for every instrument: orders that would take a position further "
1127 "from zero are refused until fastmm-ctl reduce-only off (default false)"},
1128 {"risk",
1129 "allow_unlimited",
1131 false,
1132 "let fastmm-live trade with real keys without max_position (or max_order_notional) and "
1133 "max_loss; without it such a session refuses to start, exit code 3 (default false)"},
1134 {"risk",
1135 "underlying",
1137 false,
1138 "one [risk.underlying.BTC] table per base asset: a net position limit over every instrument "
1139 "and venue that trades it"},
1140 {"risk.underlying.*",
1141 "max_net",
1143 true,
1144 "refuse an order that would take the net position in this base asset, open orders on the "
1145 "order's side included, further past this; base units (contracts times contract_multiplier, "
1146 "inverse contracts at the mark), decimal; 0: tracked, no limit"},
1147 // [gateway]
1148 {"gateway",
1149 "orders_per_sec",
1151 false,
1152 "fastmm-gateway: new orders and replaces per second per venue, over every attached strategy "
1153 "(default 0: off)"},
1154 {"gateway",
1155 "burst",
1157 false,
1158 "fastmm-gateway: token-bucket capacity of orders_per_sec, orders (default orders_per_sec)"},
1159 {"gateway",
1160 "max_open_notional",
1162 false,
1163 "fastmm-gateway: refuse an order that would take the notional working at its venue, over "
1164 "every attached strategy and both sides, past this; settlement currency, decimal"},
1165 {"gateway",
1166 "max_loss",
1168 false,
1169 "fastmm-gateway: trip the account's kill switch when the net PnL of every strategy together, "
1170 "carried across restarts in the gateway's kill file, reaches -max_loss; decimal, in "
1171 "[accounting] reporting_currency when set"},
1172 {"gateway",
1173 "max_gross_notional",
1175 false,
1176 "fastmm-gateway: refuse an order that would take the sum of the account's |position| at the "
1177 "marks past this, unless it only closes its instrument's position (an order through zero "
1178 "counts what it opens); decimal"},
1179 {"gateway",
1180 "max_net_notional",
1182 false,
1183 "fastmm-gateway: refuse an order that would take the account's net position at the marks "
1184 "further past this, unless it only closes its instrument's position (an order through zero "
1185 "counts what it opens); decimal"},
1186 {"gateway",
1187 "underlying",
1189 false,
1190 "fastmm-gateway: one [gateway.underlying.BTC] table per base asset: the account's net limit, "
1191 "over every strategy and venue"},
1192 {"gateway",
1193 "check_balance",
1195 false,
1196 "fastmm-gateway: refuse an order the venue's reported balance, less the orders and fills of "
1197 "every attached strategy since, cannot cover (default true)"},
1198 {"gateway.underlying.*",
1199 "max_net",
1201 true,
1202 "fastmm-gateway: refuse an order that would take the account's net position in this base "
1203 "asset, working orders on the order's side included, further past this; base units, decimal"},
1204 {"gateway",
1205 "shared",
1207 false,
1208 "fastmm-gateway: one [gateway.shared.\"venue:symbol\"] table per instrument that several "
1209 "strategies may trade at once (default: one strategy per instrument)"},
1210 {"gateway.shared.*",
1211 "primary",
1213 false,
1214 "fastmm-gateway: [engine] name of the strategy that books this instrument's events naming no "
1215 "order (funding, liquidation fills, executions of orders placed elsewhere); default none: "
1216 "the account alone books them"},
1217 // [[windows]]
1218 {"windows[]",
1219 "name",
1221 true,
1222 "the window's name, 1 to 32 letters, digits, '_', '-' or '.', for the log and the status"},
1223 {"windows[]",
1224 "zone",
1226 true,
1227 "the time zone of start, end and the dates: an IANA name (\"America/New_York\") of the "
1228 "tzdata compiled into the build, or a POSIX TZ rule (\"EST5EDT,M3.2.0,M11.1.0\")"},
1229 {"windows[]",
1230 "days",
1232 false,
1233 "the local weekdays an occurrence starts on: \"mon\" ... \"sun\"; give days or dates"},
1234 {"windows[]",
1235 "dates",
1237 false,
1238 "the local dates an occurrence starts on, \"YYYY-MM-DD\"; give days or dates"},
1239 {"windows[]",
1240 "start",
1242 true,
1243 "local time the window opens, \"HH:MM\" or \"HH:MM:SS\"; a time the clock skips opens at the "
1244 "jump, one it shows twice opens at the first"},
1245 {"windows[]",
1246 "end",
1248 false,
1249 "local time it closes, \"HH:MM[:SS]\": the same day when later than start, otherwise the "
1250 "next; give end or duration"},
1251 {"windows[]",
1252 "duration",
1254 false,
1255 "how long it stays open in wall-clock time, \"30m\", \"1h30m\", \"2d\" (units d, h, m, s), "
1256 "more than 0 and at most 7d; give end or duration"},
1257 {"windows[]",
1258 "from",
1260 false,
1261 "first local date an occurrence may start on, \"YYYY-MM-DD\" (default: no limit)"},
1262 {"windows[]",
1263 "until",
1265 false,
1266 "last local date an occurrence may start on, \"YYYY-MM-DD\" (default: no limit)"},
1267 {"windows[]",
1268 "except",
1270 false,
1271 "local dates no occurrence starts on, \"YYYY-MM-DD\" (default none)"},
1272 {"windows[]",
1273 "action",
1275 false,
1276 "\"pull\": no quotes in the scope while open, as fastmm-ctl pull; \"reduce_only\": orders "
1277 "that add to a position are refused, as fastmm-ctl reduce-only on (default \"pull\")"},
1278 {"windows[]",
1279 "venues",
1281 false,
1282 "the scope: every instrument of these [venues.<name>] (default: with no instruments either, "
1283 "the whole session)"},
1284 {"windows[]",
1285 "instruments",
1287 false,
1288 "the scope: \"symbol\", \"venue:symbol\" or a [strategy.groups] name (default: with no venues "
1289 "either, the whole session)"},
1290 // [accounting]
1291 // [capacity]
1292 {"capacity",
1293 "mode",
1295 false,
1296 "off | observe (price every new order and move, count and record what it would refuse, "
1297 "refuse nothing) | new (refuse new orders below their price, observe moves) | enforce "
1298 "(refuse both) (default off)"},
1299 {"capacity",
1300 "value",
1302 false,
1303 "the value of a quote level whose strategy states none: off (worth any price) | learned "
1304 "(notional x the filled per placed notional of its instrument, side and size class x "
1305 "margin_bps) (default off)"},
1306 {"capacity",
1307 "orders_10s",
1309 false,
1310 "orders each account's window admits; the window's price rises as its share is used "
1311 "(Binance Spot 100) (default 0: the window is not priced)"},
1312 {"capacity",
1313 "venues",
1315 false,
1316 "the [venues.<name>] whose accounts are priced, with their pools' members; the others' "
1317 "orders are neither priced nor counted (default []: every venue)"},
1318 {"capacity",
1319 "window_ms",
1321 false,
1322 "the account window's length, ms; windows start at multiples of it since 1970-01-01 UTC "
1323 "(default 10000)"},
1324 {"capacity",
1325 "fill_credit",
1327 false,
1328 "an order's first fill gives its slot back to its window, as Binance's unfilled order count "
1329 "does (default false)"},
1330 {"capacity",
1331 "orders_1d",
1333 false,
1334 "orders each account may send per UTC day; a day price keeps the day's demand within it "
1335 "(Binance Spot 200000) (default 0: no day price per account)"},
1336 {"capacity",
1337 "orders_per_day",
1339 false,
1340 "the strategy's orders per UTC day over every account; a day price keeps the day's demand "
1341 "within it (default 0: no budget)"},
1342 {"capacity",
1343 "weight_1m",
1345 false,
1346 "request weight per minute shared by a pool's accounts (one IP); a new order, a replace and "
1347 "a cancel count 1 each (default 0: not priced)"},
1348 {"capacity",
1349 "margin_bps",
1351 false,
1352 "what a filled unit of notional earns, rebate plus edge, bps; scales the learned values and "
1353 "the price floor (default 1)"},
1354 {"capacity",
1355 "full_move_bps",
1357 false,
1358 "a move towards the touch of this many bps is worth a whole new order when the strategy "
1359 "states no keep value; a smaller move buys that share of the level's value (default 10)"},
1360 {"accounting",
1361 "reporting_currency",
1363 false,
1364 "currency the PnL totals, [risk] max_loss and the exposure caps (and fastmm-gateway's) are in "
1365 "when instruments settle in more than one; every other settlement currency needs a source in "
1366 "[accounting.fx] (default unset: no conversion)"},
1367 {"accounting",
1368 "fx",
1370 false,
1371 "[accounting.fx] table: one entry per other settlement currency, the instrument whose mid "
1372 "prices it in reporting_currency (BTC = \"binance:BTCUSDT\"; a pair quoted the other way "
1373 "round, USDTBTC, is inverted)"},
1374 {"accounting.fx", "*", KeyType::String, false, "FX source of one settlement currency"},
1375 {"accounting",
1376 "mark",
1378 false,
1379 "what a derivative's position is valued at for the unrealized PnL, max_loss and the "
1380 "exposure caps (fastmm-gateway's too): venue (its venue's mark price while it is fresh, else "
1381 "the book's mid) | mid (default venue)"},
1382 {"accounting",
1383 "stale_mark_ms",
1385 false,
1386 "a venue's mark or index price older than this is stale: ctx.mark and ctx.index flag it and "
1387 "the position is valued at the mid, ms (default 15000)"},
1388 {"accounting",
1389 "stale_funding_ms",
1391 false,
1392 "a venue's funding rate older than this is stale (ctx.funding flags it), ms (default "
1393 "180000)"},
1394 {"accounting",
1395 "stale_fx_ms",
1397 false,
1398 "an [accounting.fx] rate whose source's book has not updated for this long is not current: "
1399 "an order that adds exposure in that currency is refused; ms (default 60000; 0: a valid "
1400 "book is enough). Not [risk] stale_md_ms: a quiet FX book can go seconds without a change"},
1401 // [logging]
1402 {"logging",
1403 "level",
1405 false,
1406 "trace | debug | info | warn (or warning) | error | off (default info)"},
1407 {"logging", "file", KeyType::String, false, "log file; empty = stderr only"},
1408 {"logging",
1409 "mirror_level",
1411 false,
1412 "records at or above this level are also written to stderr (default warn)"},
1413 {"logging",
1414 "status_interval_s",
1416 false,
1417 "seconds between the per-venue status lines, 0 = none (default 1 with a log file, 10 on "
1418 "stderr)"},
1419 // [shadow]
1420 {"shadow",
1421 "enabled",
1423 false,
1424 "fastmm-live starts fastmm-shadow from its own directory, which follows the session's journal "
1425 "in a process of its own (default false)"},
1426 {"shadow",
1427 "program",
1429 false,
1430 "the program fastmm-live starts: an application's own fastmm::cli::shadow for its own "
1431 "strategies (default fastmm-shadow in fastmm-live's directory)"},
1432 {"shadow",
1433 "threads",
1435 false,
1436 "threads that step the points, at most 128 points each, plus one that reads the journal when "
1437 "there are two or more (default 1)"},
1438 {"shadow",
1439 "window_s",
1441 false,
1442 "length of a comparison window, seconds: the error of the simulation and the variants' "
1443 "intervals are per window, and each window closes settle_s after its end (default 60)"},
1444 {"shadow",
1445 "settle_s",
1447 false,
1448 "how far behind the journal the simulation runs, seconds: what the journal says about a venue "
1449 "time (acks, fills, parameter updates) must arrive within this for the runs to equal a "
1450 "backtest of the finished journal; the report counts what came later (default 10)"},
1451 {"shadow",
1452 "max_lag_s",
1454 false,
1455 "behind the session by more than this and not catching up, the highest-numbered half of the "
1456 "variants stop, seconds; the live point never does; 0 = never (default 300)"},
1457 {"shadow",
1458 "idle_exit_s",
1460 false,
1461 "a shadow fastmm-live started leaves when no session has written for this long, seconds "
1462 "(default 3600)"},
1463 {"shadow",
1464 "cpus",
1466 false,
1467 "CPU cores the process may use; empty = every core but [engine] cpu and net_cpus (default "
1468 "[])"},
1469 {"shadow", "nice", KeyType::Int, false, "the process's nice value (default 10)"},
1470 {"shadow",
1471 "report",
1473 false,
1474 "the report, rewritten as each window closes (default \"<journal_dir>/<name>.shadow.json\"), "
1475 "and beside it one line per window (.jsonl)"},
1476 {"shadow",
1477 "status",
1479 false,
1480 "the status file fastmm-top reads (default \"/dev/shm/fastmm-<name>.shadow\")"},
1481 {"shadow",
1482 "grid",
1484 false,
1485 "variants, the cartesian product of <key> = [values]: strategy parameters and the backtest "
1486 "settings a sweep can vary"},
1487 {"shadow",
1488 "points",
1490 false,
1491 "more variants, [[shadow.points]] with one table of <key> = value each"},
1492 // free-form
1493 {"sim", "*", KeyType::Any, false, "simulator settings"},
1494 {"sim.*", "*", KeyType::Any, false, "simulator sub-tables"},
1495 {"backtest", "*", KeyType::Any, false, "backtester settings"},
1496 {"backtest.*", "*", KeyType::Any, false, "backtester sub-tables"},
1497};
1498
1499[[nodiscard]] inline std::span<const KeySpec> config_schema() noexcept {
1500 return kConfigSchema;
1502
1503} // namespace fastmm
Definition strategy.hpp:23
constexpr KeySpec kConfigSchema[]
Definition schema.hpp:32
std::span< const KeySpec > config_schema() noexcept
Definition schema.hpp:1501
KeyType
Definition schema.hpp:22
Definition schema.hpp:24
std::string_view key
Definition schema.hpp:26
std::string_view doc
Definition schema.hpp:29
KeyType type
Definition schema.hpp:27
std::string_view section
"engine", "venues.*", "instruments[]", "strategy", ...
Definition schema.hpp:25
bool required
Definition schema.hpp:28