FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
reader.hpp
Go to the documentation of this file.
1#pragma once
2// Query side of a storage backend: what fastmm-pnl and a restarting session read back.
3//
4// Rows are strings. The store is queried by people and by tools, never on a hot path, and a
5// string column keeps the interface small enough for a backend to implement in an afternoon;
6// raw fixed-point columns are rendered as exact decimals (Fixed::to_string).
7#include "fastmm/core/fill_audit.hpp"
10
11#include <cstdint>
12#include <string>
13#include <vector>
14
15namespace fastmm::store {
16
17// The executions an engine stored for one venue (Reader::booked_fills): the engine's side of a
18// fill audit (core/fill_audit.hpp).
19struct BookedFillQuery {
20 std::string engine; // [engine] name (empty: every engine)
21 std::string venue; // [venues.<name>] (empty: every venue)
22 std::string instrument; // symbol (empty: every instrument)
23 std::int64_t from_ms = 0; // the venue's time of the trade, inclusive (0: from the beginning)
24 std::int64_t to_ms = 0; // inclusive (0: to the end)
25};
27struct Rows {
28 std::vector<std::string> columns;
29 std::vector<std::vector<std::string>> rows;
30 [[nodiscard]] bool empty() const noexcept { return rows.empty(); }
31};
33// Every query takes the same filter; a backend ignores the fields its query has no use for.
34// Which session, and when in it, for the parameter queries.
35struct ParamQuery {
36 std::string engine; // [engine] name (empty: every engine)
37 std::uint64_t session_id = 0; // 0: the newest session that started by at_ns
38 std::int64_t at_ns = 0; // wall clock; 0: now (the session's last update)
39 std::string instrument; // symbol: its own values and the shared ones (empty: every scope)
40};
42struct QueryFilter {
43 std::string engine; // [engine] name (empty: every engine)
44 std::uint64_t session_id = 0; // 0: every session
45 std::string instrument; // symbol (empty: every instrument)
46 std::string from; // inclusive UTC day, "YYYY-MM-DD" (empty: from the beginning)
47 std::string to; // inclusive UTC day (empty: to the end)
48 std::size_t limit = 0; // 0: no limit
49 std::string order; // client order id (order_timeline; empty: none)
50};
52// What the previous session left behind, for the operator who is about to start a new one.
53struct Recovery {
54 bool found = false;
55 std::uint64_t session_id = 0;
56 std::string started_utc;
57 std::string stopped_utc; // empty: the session never recorded a close (it was killed)
58 std::string strategy;
59 std::string kill_reason;
60 bool kill_latched = false;
61 bool clean_shutdown = false;
62 int exit_code = 0;
63 std::string realized; // decimal, settlement currency
64 std::string funding; // the part of realized that is funding (schema 4; "0" before)
65 std::string unrealized;
66 std::string fees;
67 std::string net;
68 std::uint64_t fills = 0;
69 std::uint64_t records_dropped = 0;
70 bool journal_complete = true;
71 std::vector<std::string> journals;
72 // "SYMBOL qty @ avg_px realized=... fees=..." per instrument with a position or a fill.
73 std::vector<std::string> positions;
74 // "cl_ord_id SYMBOL side qty @ price state" per order that was not terminal at the last record.
75 std::vector<std::string> open_orders;
76
77 // The positions a session carries over (fastmm-live restores them before it connects; see
78 // Venue::resume_executions): per venue and symbol, the last one the engine's store holds, from
79 // this session or, for a venue and symbol it recorded nothing about (it crashed first), the
80 // newest earlier session that did. Two venues can list the same symbol.
81 struct PositionState {
82 std::uint8_t venue_id = 0; // in the session that recorded it
83 std::string venue; // its [venues.<name>]; empty when the store predates schema 3
84 std::string symbol;
85 std::int64_t qty_raw = 0;
86 std::int64_t avg_px_raw = 0;
87 };
88 std::vector<PositionState> position_state;
89 // The session epochs (the high bits of their client order ids) of the sessions a restart carries
90 // over, newest first, at most kMaxSessionEpochs: behind fastmm-gateway, executions of their
91 // orders are this engine's, whichever session placed them.
92 static constexpr std::size_t kMaxSessionEpochs = 64;
93 std::vector<std::uint16_t> session_epochs;
94 // The orders of those sessions that were not terminal at their last record and that the venue
95 // had acknowledged (a venue order id), newest first, at most kMaxPastOrders. A venue's trade
96 // history can name an execution by the venue's order id alone (Binance); behind fastmm-gateway,
97 // after a gateway restart, only this store can say whose order that was.
98 struct PastOrder {
99 std::string venue; // its [venues.<name>]; empty when the store predates schema 3
100 std::string symbol;
101 std::string venue_order_id;
102 std::string cl_ord_id;
103 };
104 static constexpr std::size_t kMaxPastOrders = 256;
105 std::vector<PastOrder> past_orders;
106 // Where each venue's execution replay resumes (Venue::resume_executions): from the venue time of
107 // the last fill or funding payment the store holds for it (in the newest session that stored
108 // one), minus kResumeOverlapMs, skipping the trade ids and funding ids (kFundingIdPrefix + id)
109 // the store holds from there on. The funding replay starts there too, so a payment made while no
110 // session ran is booked by the next one. Both ends are the venue's clock, so the engine's clock
111 // (which follows the host's and may be seconds off, a WSL2 clock step) does not enter.
112 //
113 // The ids are those of every session of the engine, not of the session the start comes from: a
114 // session killed seconds after it started stores only what its own replay booked, and the next
115 // replay's window still reaches the executions the sessions before it stored. An execution the
116 // store holds, in whichever session, is never handed to a replay as new.
117 //
118 // The start is where the record is known to be whole: the last fill stored up to the newest
119 // session that got past its own replay on the venue (the store records a reconciliation that
120 // began with the venue's executions complete, schema 6; a session from before that counts when it
121 // placed an order there - none goes out before the venue has reconciled - or shut down cleanly).
122 // A session after that one died while its replay was still reading, and can hold a fill newer
123 // than one the replay had not reached: its fills are known, and the start is not later than the
124 // earliest of their last ones. When no session at all got past its replay the start is no later
125 // than unbooked_since_ms.
126 //
127 // The overlap covers one thing: the order in which a venue publishes executions against their
128 // trade times. Executions of different symbols (and a Bybit batch, a Deribit per-instrument
129 // channel) can reach the store out of trade-time order; a restart must not skip one that traded
130 // just before the last stored fill but had not arrived when the process stopped. That spread is
131 // milliseconds to a few hundred; 1 s covers it with margin.
132 static constexpr std::int64_t kResumeOverlapMs = 1000;
133 // The most trade ids a venue's resume carries (the gateway's attach request holds
134 // gw::kMaxKnownExecIds over all its venues). A venue with more stored fills inside the overlap
135 // has its start moved later, past the oldest millisecond that does not fit whole, and
136 // VenueResume::shrunk says so: dropping an id instead would book that execution twice.
137 static constexpr std::size_t kMaxKnownExecIds = 128;
138 struct VenueResume {
139 std::uint8_t venue_id = 0; // the session's VenueId
140 std::string venue; // its [venues.<name>]; empty when the store predates schema 3
141 // Venue time of the stored fill or funding payment the start is taken from (see above).
142 std::int64_t last_fill_ms = 0;
143 std::int64_t since_ms = 0; // the replay's start, venue time, inclusive
144 // Stored fills and funding at or after since_ms, of every session of the engine.
145 std::vector<std::string> known_exec_ids;
146 bool shrunk = false; // since_ms moved later than last_fill_ms - kResumeOverlapMs
147 };
148 // One entry per venue that recorded a fill with a venue time.
149 std::vector<VenueResume> venue_resume;
150 // The highest numeric trade id per (venue, symbol) the store holds up to the newest session that
151 // got past its replay on the venue (see above), and the ids above it that the sessions after
152 // that one stored. Binance trade ids increase per symbol, so its replay resumes at last_id + 1
153 // exactly and skips known_after (Venue::resume_trade_ids). No entry for a venue no session got
154 // past its replay on: it replays by time.
155 struct TradeIdMark {
156 std::uint8_t venue_id = 0;
157 std::string venue; // empty when the store predates schema 3
158 std::string symbol;
159 std::int64_t last_id = 0;
160 std::vector<std::int64_t> known_after; // ascending
161 };
162 std::vector<TradeIdMark> last_trade_ids;
163
164 // The fallback for a venue with no entry above (a store from before schema 3, or a venue whose
165 // fills carry no venue time): the engine clock, as before. The replay starts kFallbackOverlapNs
166 // before the session's last fill, and the ids reach kFallbackIdsNs back, further than the start,
167 // because the start is local time and the venue compares it with its own. At most
168 // kMaxKnownExecIds, with the start moved later when more fall inside.
169 static constexpr std::int64_t kFallbackOverlapNs = 10'000'000'000; // 10 s
170 static constexpr std::int64_t kFallbackIdsNs = 2 * kFallbackOverlapNs;
171 std::int64_t last_fill_ns = 0; // engine time of the newest session's last fill (0: none)
172 std::int64_t fallback_since_ms = 0; // 0: no replay
173 std::vector<std::string> fallback_exec_ids; // of every session that ran inside kFallbackIdsNs
175 // Where the replay of a venue with no stored fill starts (no venue_resume entry, in a store
176 // whose fills carry the venue's time or that holds none): the start of the newest session that
177 // shut down cleanly, else of the oldest session, less kFallbackOverlapNs, engine clock. Whatever
178 // the venue executed since is unbooked: a fill of a session that crashed before storing it, or
179 // one made while nothing ran.
180 std::int64_t unbooked_since_ms = 0;
181
182 // Executions and funding payments the engine's store holds more than once (Reader::duplicates):
183 // a restart booked them a second time, so the positions and the PnL of the sessions holding the
184 // copies count them twice. Reported, never repaired: the rows stay as they were written. At most
185 // kMaxDuplicates are listed; duplicate_count is how many there are.
186 struct Duplicate {
187 std::string venue; // its [venues.<name>]; "#<id>" when the store predates schema 3
188 std::string symbol;
189 std::string id; // the venue's trade id or funding id
190 std::string qty; // decimal: the execution's quantity, the funding payment's amount
191 std::string side; // empty for a funding payment
192 std::string sessions; // the sessions holding it, oldest first, space separated
193 std::uint32_t copies = 0;
194 bool funding = false;
195 };
196 static constexpr std::size_t kMaxDuplicates = 32;
197 std::vector<Duplicate> duplicates;
198 std::uint64_t duplicate_count = 0;
201class Reader {
202 public:
203 Reader() = default;
204 virtual ~Reader() = default;
205 Reader(const Reader&) = delete;
206 Reader& operator=(const Reader&) = delete;
208 [[nodiscard]] virtual Result<void, std::string> open(const BackendOptions& opts) = 0;
209 // One row per session: id, engine, strategy, start, stop, PnL, fills, exit.
210 [[nodiscard]] virtual Result<Rows, std::string> sessions(const QueryFilter& f) = 0;
211 // One row per execution.
212 [[nodiscard]] virtual Result<Rows, std::string> fills(const QueryFilter& f) = 0;
213 // One row per order, in its last known state.
214 [[nodiscard]] virtual Result<Rows, std::string> orders(const QueryFilter& f) = 0;
215 // One row per UTC day and instrument: realised, fees, unrealised, position, settlement currency.
216 [[nodiscard]] virtual Result<Rows, std::string> pnl(const QueryFilter& f) = 0;
217 // One row per funding payment. The default has none (a backend without the table).
218 [[nodiscard]] virtual Result<Rows, std::string> funding(const QueryFilter& /*f*/) {
219 return Rows{};
221 // One row per venue execution or funding payment stored more than once (by venue, symbol and
222 // the venue's id of it, within an engine): what a restart booked a second time. Empty in a
223 // sound store; the default has none. Filtered by engine and instrument.
224 [[nodiscard]] virtual Result<Rows, std::string> duplicates(const QueryFilter& /*f*/) {
225 return Rows{};
227 // The economic fill ledger: one row per execution (the venue's id of it on an account, symbol
228 // and side, within an engine) however many sessions stored it, as the first one did, with when
229 // it was first received, the venue's time, the quantity the position took (booked), how many
230 // copies there are and its flags (synthetic: booked from a cum_qty jump, no venue report; late:
231 // for an order already ended; before_start: traded before the session that booked it started,
232 // so it came in through the restart's replay; repeated: stored more than once). `raw` lists
233 // every stored row instead, with its copy number. A session filter keeps the executions it
234 // booked first (raw: its rows). The default cannot answer.
235 [[nodiscard]] virtual Result<Rows, std::string> ledger(const QueryFilter& /*f*/, bool /*raw*/) {
236 return fail(std::string("this store backend has no fill ledger"));
238 // Everything stored about one client order (`f.order`), in time order: sent, each refusal, each
239 // execution, and its last known state. The default cannot answer.
240 [[nodiscard]] virtual Result<Rows, std::string> order_timeline(const QueryFilter& /*f*/) {
241 return fail(std::string("this store backend has no order timeline"));
243 // The executions stored for `q.venue`, of every session of `q.engine`, by the venue's time of the
244 // trade: the venue's trade id, order ids, side, price, quantity and the commission as reported
245 // (AuditFill::fee_asset: quote, base or other). Estimates (no trade id) are left out. Needs the
246 // venue's names and times (schema 3); the default cannot answer.
247 [[nodiscard]] virtual Result<std::vector<AuditFill>, std::string> booked_fills(
248 const BookedFillQuery& /*q*/) {
249 return fail(std::string("this store backend cannot list booked fills"));
250 }
251 // The last position snapshot per session and instrument.
252 [[nodiscard]] virtual Result<Rows, std::string> positions(const QueryFilter& f) = 0;
253 // The strategy parameters in effect at `q.at_ns` (0: the session's last update) in the session
254 // `q.session_id`, else the newest of `q.engine` that started by then: one row per parameter and
255 // scope (every instrument, or one that has its own value), with when it was set, its origin
256 // (initial, control, strategy) and source. Needs schema 8; the default cannot answer.
257 [[nodiscard]] virtual Result<Rows, std::string> params(const ParamQuery& /*q*/) {
258 return fail(std::string("this store backend keeps no parameter history"));
260 // Every parameter update, one row per value it carried, in order: the starting set (origin
261 // initial) and each update the engine applied. Filtered by engine, session, day and instrument.
262 [[nodiscard]] virtual Result<Rows, std::string> param_changes(const QueryFilter& /*f*/) {
263 return fail(std::string("this store backend keeps no parameter history"));
265 // The parameters session `a` ended with against those session `b` started with: one row per
266 // parameter and scope that differs. `a` 0: the session of b's engine that started last before b
267 // (what a restart changed).
268 [[nodiscard]] virtual Result<Rows, std::string> param_diff(std::uint64_t /*a*/,
269 std::uint64_t /*b*/) {
270 return fail(std::string("this store backend keeps no parameter history"));
271 }
272 // One row per refused order the engine recorded (`count` with the ones folded into it): when,
273 // which account, instrument and side, whether it only reduced the position, the reason, the
274 // limit or side that refused it (source) and the account's budget then. Filtered by engine,
275 // session, day and instrument. Needs schema 9.
276 [[nodiscard]] virtual Result<Rows, std::string> rejects(const QueryFilter& /*f*/) {
277 return fail(std::string("this store backend keeps no rejects"));
279 // The same summed: one row per account, instrument, side, reduces, reason and source.
280 [[nodiscard]] virtual Result<Rows, std::string> reject_summary(const QueryFilter& /*f*/) {
281 return fail(std::string("this store backend keeps no rejects"));
283 // The effective configuration (TOML, secrets omitted) of the session `q` picks as params() does.
284 [[nodiscard]] virtual Result<std::string, std::string> session_config(const ParamQuery& /*q*/) {
285 return fail(std::string("this store backend keeps no configuration"));
287 // The newest session of `f.engine`, summarised.
288 [[nodiscard]] virtual Result<Recovery, std::string> recovery(const QueryFilter& f) = 0;
289};
291} // namespace fastmm::store
Storage backend interface: what a session's fills, orders, positions, PnL and kill events are handed ...
Definition result.hpp:30
Definition reader.hpp:203
virtual Result< Rows, std::string > rejects(const QueryFilter &)
One row per refused order the engine recorded (count with the ones folded into it): when,...
Definition reader.hpp:278
virtual Result< Rows, std::string > param_changes(const QueryFilter &)
Every parameter update, one row per value it carried, in order: the starting set (origin initial) and...
Definition reader.hpp:264
virtual Result< Rows, std::string > funding(const QueryFilter &)
One row per funding payment. The default has none (a backend without the table).
Definition reader.hpp:220
virtual Result< Rows, std::string > ledger(const QueryFilter &, bool)
The economic fill ledger: one row per execution (the venue's id of it on an account,...
Definition reader.hpp:237
Reader & operator=(const Reader &)=delete
virtual Result< Rows, std::string > fills(const QueryFilter &f)=0
One row per execution.
virtual Result< Rows, std::string > reject_summary(const QueryFilter &)
The same summed: one row per account, instrument, side, reduces, reason and source.
Definition reader.hpp:282
virtual Result< Recovery, std::string > recovery(const QueryFilter &f)=0
The newest session of f.engine, summarised.
virtual Result< Rows, std::string > duplicates(const QueryFilter &)
One row per venue execution or funding payment stored more than once (by venue, symbol and the venue'...
Definition reader.hpp:226
virtual Result< Rows, std::string > positions(const QueryFilter &f)=0
The last position snapshot per session and instrument.
virtual Result< Rows, std::string > param_diff(std::uint64_t, std::uint64_t)
The parameters session a ended with against those session b started with: one row per parameter and s...
Definition reader.hpp:270
virtual Result< std::string, std::string > session_config(const ParamQuery &)
The effective configuration (TOML, secrets omitted) of the session q picks as params() does.
Definition reader.hpp:286
virtual Result< Rows, std::string > params(const ParamQuery &)
The strategy parameters in effect at q.at_ns (0: the session's last update) in the session q....
Definition reader.hpp:259
virtual Result< std::vector< AuditFill >, std::string > booked_fills(const BookedFillQuery &)
The executions stored for q.venue, of every session of q.engine, by the venue's time of the trade: th...
Definition reader.hpp:249
virtual Result< Rows, std::string > pnl(const QueryFilter &f)=0
One row per UTC day and instrument: realised, fees, unrealised, position, settlement currency.
virtual Result< Rows, std::string > sessions(const QueryFilter &f)=0
One row per session: id, engine, strategy, start, stop, PnL, fills, exit.
virtual Result< Rows, std::string > orders(const QueryFilter &f)=0
One row per order, in its last known state.
virtual Result< void, std::string > open(const BackendOptions &opts)=0
virtual Result< Rows, std::string > order_timeline(const QueryFilter &)
Everything stored about one client order (f.order), in time order: sent, each refusal,...
Definition reader.hpp:242
virtual ~Reader()=default
Minimal expected<T, E>: the hot path never throws, it returns Result.
Definition backend.hpp:39
constexpr Unexpected< std::decay_t< E > > fail(E &&e) noexcept
Definition result.hpp:25
What a backend is built with.
Definition backend.hpp:43
The executions an engine stored for one venue (Reader::booked_fills): the engine's side of a fill aud...
Definition reader.hpp:21
std::string instrument
symbol (empty: every instrument)
Definition reader.hpp:24
std::int64_t from_ms
the venue's time of the trade, inclusive (0: from the beginning)
Definition reader.hpp:25
std::string engine
[engine] name (empty: every engine)
Definition reader.hpp:22
std::string venue
[venues.<name>] (empty: every venue)
Definition reader.hpp:23
std::int64_t to_ms
inclusive (0: to the end)
Definition reader.hpp:26
Every query takes the same filter; a backend ignores the fields its query has no use for.
Definition reader.hpp:37
std::string engine
[engine] name (empty: every engine)
Definition reader.hpp:38
std::uint64_t session_id
0: the newest session that started by at_ns
Definition reader.hpp:39
std::string instrument
symbol: its own values and the shared ones (empty: every scope)
Definition reader.hpp:41
std::int64_t at_ns
wall clock; 0: now (the session's last update)
Definition reader.hpp:40
Definition reader.hpp:44
std::string from
inclusive UTC day, "YYYY-MM-DD" (empty: from the beginning)
Definition reader.hpp:48
std::string engine
[engine] name (empty: every engine)
Definition reader.hpp:45
std::uint64_t session_id
0: every session
Definition reader.hpp:46
std::string to
inclusive UTC day (empty: to the end)
Definition reader.hpp:49
std::string instrument
symbol (empty: every instrument)
Definition reader.hpp:47
std::string order
client order id (order_timeline; empty: none)
Definition reader.hpp:51
std::size_t limit
0: no limit
Definition reader.hpp:50
Executions and funding payments the engine's store holds more than once (Reader::duplicates): a resta...
Definition reader.hpp:188
std::uint32_t copies
Definition reader.hpp:195
std::string side
empty for a funding payment
Definition reader.hpp:193
std::string sessions
the sessions holding it, oldest first, space separated
Definition reader.hpp:194
std::string id
the venue's trade id or funding id
Definition reader.hpp:191
std::string symbol
Definition reader.hpp:190
std::string venue
its [venues.<name>]; "\#<id>" when the store predates schema 3
Definition reader.hpp:189
bool funding
Definition reader.hpp:196
std::string qty
decimal: the execution's quantity, the funding payment's amount
Definition reader.hpp:192
The orders of those sessions that were not terminal at their last record and that the venue had ackno...
Definition reader.hpp:100
std::string cl_ord_id
Definition reader.hpp:104
std::string symbol
Definition reader.hpp:102
std::string venue
its [venues.<name>]; empty when the store predates schema 3
Definition reader.hpp:101
std::string venue_order_id
Definition reader.hpp:103
The positions a session carries over (fastmm-live restores them before it connects; see Venue::resume...
Definition reader.hpp:83
std::string symbol
Definition reader.hpp:86
std::int64_t qty_raw
Definition reader.hpp:87
std::int64_t avg_px_raw
Definition reader.hpp:88
std::uint8_t venue_id
in the session that recorded it
Definition reader.hpp:84
std::string venue
its [venues.<name>]; empty when the store predates schema 3
Definition reader.hpp:85
The highest numeric trade id per (venue, symbol) the store holds up to the newest session that got pa...
Definition reader.hpp:157
std::string venue
empty when the store predates schema 3
Definition reader.hpp:159
std::vector< std::int64_t > known_after
ascending
Definition reader.hpp:162
std::uint8_t venue_id
Definition reader.hpp:158
std::int64_t last_id
Definition reader.hpp:161
std::string symbol
Definition reader.hpp:160
Definition reader.hpp:140
std::int64_t since_ms
the replay's start, venue time, inclusive
Definition reader.hpp:145
bool shrunk
since_ms moved later than last_fill_ms - kResumeOverlapMs
Definition reader.hpp:148
std::uint8_t venue_id
the session's VenueId
Definition reader.hpp:141
std::vector< std::string > known_exec_ids
Stored fills and funding at or after since_ms, of every session of the engine.
Definition reader.hpp:147
std::int64_t last_fill_ms
Venue time of the stored fill or funding payment the start is taken from (see above).
Definition reader.hpp:144
std::string venue
its [venues.
Definition reader.hpp:142
What the previous session left behind, for the operator who is about to start a new one.
Definition reader.hpp:55
std::vector< Duplicate > duplicates
Definition reader.hpp:199
std::vector< std::string > journals
Definition reader.hpp:73
static constexpr std::size_t kMaxPastOrders
Definition reader.hpp:106
bool clean_shutdown
Definition reader.hpp:63
std::uint64_t fills
Definition reader.hpp:70
std::uint64_t records_dropped
Definition reader.hpp:71
std::string started_utc
Definition reader.hpp:58
std::vector< std::uint16_t > session_epochs
Definition reader.hpp:95
std::int64_t fallback_since_ms
0: no replay
Definition reader.hpp:174
std::vector< VenueResume > venue_resume
One entry per venue that recorded a fill with a venue time.
Definition reader.hpp:151
bool found
Definition reader.hpp:56
static constexpr std::int64_t kResumeOverlapMs
Where each venue's execution replay resumes (Venue::resume_executions): from the venue time of the la...
Definition reader.hpp:134
std::vector< std::string > fallback_exec_ids
of every session that ran inside kFallbackIdsNs
Definition reader.hpp:175
std::vector< TradeIdMark > last_trade_ids
Definition reader.hpp:164
std::string stopped_utc
empty: the session never recorded a close (it was killed)
Definition reader.hpp:59
std::string unrealized
Definition reader.hpp:67
std::string fees
Definition reader.hpp:68
std::vector< PositionState > position_state
Definition reader.hpp:90
std::string funding
the part of realized that is funding (schema 4; "0" before)
Definition reader.hpp:66
std::string net
Definition reader.hpp:69
std::uint64_t duplicate_count
Definition reader.hpp:200
std::string kill_reason
Definition reader.hpp:61
bool journal_complete
Definition reader.hpp:72
static constexpr std::size_t kMaxSessionEpochs
The session epochs (the high bits of their client order ids) of the sessions a restart carries over,...
Definition reader.hpp:94
bool kill_latched
Definition reader.hpp:62
static constexpr std::size_t kMaxKnownExecIds
The most trade ids a venue's resume carries (the gateway's attach request holds gw::kMaxKnownExecIds ...
Definition reader.hpp:139
std::vector< std::string > positions
"SYMBOL qty \@ avg_px realized=... fees=..." per instrument with a position or a fill.
Definition reader.hpp:75
static constexpr std::int64_t kFallbackOverlapNs
The fallback for a venue with no entry above (a store from before schema 3, or a venue whose fills ca...
Definition reader.hpp:171
std::string strategy
Definition reader.hpp:60
static constexpr std::size_t kMaxDuplicates
Definition reader.hpp:198
std::vector< std::string > open_orders
"cl_ord_id SYMBOL side qty \@ price state" per order that was not terminal at the last record.
Definition reader.hpp:77
std::vector< PastOrder > past_orders
Definition reader.hpp:107
std::int64_t unbooked_since_ms
Where the replay of a venue with no stored fill starts (no venue_resume entry, in a store whose fills...
Definition reader.hpp:182
static constexpr std::int64_t kFallbackIdsNs
Definition reader.hpp:172
std::string realized
decimal, settlement currency
Definition reader.hpp:65
std::uint64_t session_id
Definition reader.hpp:57
int exit_code
Definition reader.hpp:64
std::int64_t last_fill_ns
engine time of the newest session's last fill (0: none)
Definition reader.hpp:173
Definition reader.hpp:29
std::vector< std::string > columns
Definition reader.hpp:30
std::vector< std::vector< std::string > > rows
Definition reader.hpp:31
bool empty() const noexcept
Definition reader.hpp:32