FastMM documentation
FastMM C++ API 0.14.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
messages.hpp
Go to the documentation of this file.
1#pragma once
2// Event bus message structs (5.5). Every message:
3// * starts with a 64-byte EventHeader whose first 4 bytes are the total length and 5th
4// byte the EventType (MsgRing protocol),
5// * is trivially copyable with sizeof a multiple of 64 (explicit padding),
6// * carries a `version` so journals remain readable across layout changes.
7//
8// Messages are constructed in place inside a ring/journal buffer; use init_header().
9#include "fastmm/core/config_macros.hpp"
10#include "fastmm/core/enums.hpp"
12#include "fastmm/core/fixed_string.hpp"
15#include "fastmm/core/time.hpp"
16
17#include <cstddef>
18#include <cstdint>
19#include <cstring>
20#include <span>
21#include <string_view>
22#include <type_traits>
23
24namespace fastmm {
25
26inline constexpr std::uint8_t kMessageVersion = 1;
27
28// One price level. Shared by book messages and the L2 book.
29struct Level {
32 constexpr bool operator==(const Level&) const noexcept = default;
33};
34static_assert(sizeof(Level) == 16 && std::is_trivially_copyable_v<Level>);
35
36struct EventHeader {
37 enum Flags : std::uint8_t {
38 kSynthetic = 1U << 0, // generated locally (reconcile fill, sim), not from the venue
39 kReplayed = 1U << 1, // came from a journal
40 kSnapshot = 1U << 2, // BookDelta carries a full snapshot
41 kOutbound = 1U << 3, // engine -> venue message copied into the journal
42 // Journal only (format v2, ADR-0010): reserved0 holds the engine clock at consumption as a
43 // signed ns delta from the previous kEngineTime record or EngineTimeMsg.
44 kEngineTime = 1U << 4,
45 kDropped = 1U << 5, // journal only: outbound message the transport did not accept
46 // BookDelta: the venue's update changed more levels on this side than the message carries,
47 // and the side holds the ones nearest the touch (LevelSpill). A book level behind the last
48 // one it carries may be stale; L2Book drops those.
49 kTruncatedBids = 1U << 6,
50 kTruncatedAsks = 1U << 7,
51 };
53 std::uint32_t len; // total bytes incl. header, multiple of 64 (offset 0)
54 EventType type; // (offset 4)
55 std::uint8_t version; // kMessageVersion
57 std::uint8_t flags;
58 InstrumentId instrument; // dense id, invalid for non-instrument events (offset 8)
59 std::uint32_t reserved0; // journal: engine-time delta when kEngineTime (offset 12)
60 std::uint64_t seq; // engine consumption order; assigned by JournalWriter (16)
61 std::uint64_t venue_seq; // venue update id / sequence number (24)
62 Timestamp exch_ts; // venue event time (32)
63 Timestamp recv_ts; // T0 wall-clock (40)
64 Cycles t0_cycles; // T0 raw TSC at recv (48)
65 std::uint32_t t1_delta; // cycles T0->T1 (decoded) (56)
66 std::uint32_t t2_delta; // cycles T0->T2 (book applied) (60)
67};
68static_assert(sizeof(EventHeader) == 64);
69static_assert(offsetof(EventHeader, len) == 0 && offsetof(EventHeader, type) == 4);
70static_assert(std::is_trivially_copyable_v<EventHeader>);
71
72// For fixed-size messages len defaults to sizeof(M); BookDeltaMsg passes size_for().
73template <class M>
74constexpr void init_header(M& m,
75 EventType type,
76 InstrumentId inst = {},
77 VenueId venue = {},
78 std::uint32_t len = static_cast<std::uint32_t>(sizeof(M))) noexcept {
79 static_assert(std::is_trivially_copyable_v<M>);
80 FASTMM_ASSERT(len % 64 == 0 && len >= sizeof(EventHeader));
81 m.hdr = EventHeader{};
82 m.hdr.len = len;
83 m.hdr.type = type;
84 m.hdr.version = kMessageVersion;
85 m.hdr.venue = venue;
86 m.hdr.instrument = inst;
87}
88
89// ---- market data ---------------------------------------------------------------------
90
91// Bids then asks follow the fixed part as a flexible array of Level (bid_count + ask_count).
92// Used both for deltas (qty == 0 means delete) and full snapshots (flag kSnapshot).
93//
94// Never construct a BookDeltaMsg by value, not even with zero levels. The fixed part is 96
95// bytes but hdr.len is rounded to the 64-byte message granule, so size_for(0, 0) == 128.
96// Everything that forwards a message copies hdr.len bytes (MsgRing, journal, BookSyncer), so a
97// stack or member BookDeltaMsg is read 32 bytes past its end. Build it in place instead:
98// alignas(64) std::byte buf[BookDeltaMsg::size_for(bids, asks)]; or ring.try_reserve(len)
99struct BookDeltaMsg {
101 std::uint32_t bid_count;
102 std::uint32_t ask_count;
103 std::uint64_t first_update_id; // Binance U
104 std::uint64_t last_update_id; // Binance u / Bybit u
105 std::uint64_t prev_update_id; // Binance futures pu (0 if n/a)
107 [[nodiscard]] static constexpr std::uint32_t size_for(std::uint32_t bids,
108 std::uint32_t asks) noexcept {
109 const std::uint32_t raw =
110 static_cast<std::uint32_t>(sizeof(BookDeltaMsg)) + (bids + asks) * 16U;
111 return (raw + 63U) & ~63U;
112 }
113 [[nodiscard]] Level* levels() noexcept {
114 return reinterpret_cast<Level*>(reinterpret_cast<std::byte*>(this) + sizeof(BookDeltaMsg));
115 }
116 [[nodiscard]] const Level* levels() const noexcept {
117 return reinterpret_cast<const Level*>(reinterpret_cast<const std::byte*>(this) +
118 sizeof(BookDeltaMsg));
119 }
120 [[nodiscard]] std::span<const Level> bids() const noexcept { return {levels(), bid_count}; }
121 [[nodiscard]] std::span<const Level> asks() const noexcept {
123 }
124 [[nodiscard]] std::span<Level> bids() noexcept { return {levels(), bid_count}; }
125 [[nodiscard]] std::span<Level> asks() noexcept { return {levels() + bid_count, ask_count}; }
126 [[nodiscard]] bool is_snapshot() const noexcept {
128 }
129};
130static_assert(sizeof(BookDeltaMsg) == 96 && alignof(BookDeltaMsg) == 8);
131// The header flags of a delta whose bids and/or asks kept only the levels nearest the touch.
132[[nodiscard]] constexpr std::uint8_t truncation_flags(bool bids, bool asks) noexcept {
133 std::uint8_t f = 0;
134 if (bids) f |= EventHeader::kTruncatedBids;
135 if (asks) f |= EventHeader::kTruncatedAsks;
136 return f;
137}
138using BookSnapshotMsg = BookDeltaMsg; // same layout; hdr.type == BookSnapshot, kSnapshot set
139// EventType::OwnLevels, the same layout: each level is our resting quantity at that price as the
140// feed shows it from now on, zero for none. The update ids are unused.
143// One side of a public trade as the venue names it, on venues that publish who traded
144// (Hyperliquid: wallet addresses; Lighter: account indexes). Copied as sent; FastMM gives it no
145// meaning.
146enum class PartyIdKind : std::uint8_t {
147 None = 0, // the venue did not name this side
148 Account = 1, // a numeric account id, `bytes` holds it as a little-endian uint64 (account())
149 Address = 2, // an address or public key, `len` raw bytes in the order written (0x hex text)
150};
151
152struct PartyId {
153 static constexpr std::size_t kMaxBytes = 30;
155 std::uint8_t len; // bytes used: 8 for an Account, the address's length for an Address
156 std::uint8_t bytes[kMaxBytes];
158 [[nodiscard]] constexpr bool known() const noexcept { return kind != PartyIdKind::None; }
159 // The account id; 0 for another kind.
160 [[nodiscard]] std::uint64_t account() const noexcept {
161 std::uint64_t v = 0;
162 if (kind == PartyIdKind::Account) std::memcpy(&v, bytes, sizeof(v));
163 return v;
164 }
165 [[nodiscard]] std::span<const std::uint8_t> raw() const noexcept { return {bytes, len}; }
166 [[nodiscard]] static PartyId of_account(std::uint64_t id) noexcept {
169 p.len = sizeof(id);
170 std::memcpy(p.bytes, &id, sizeof(id));
171 return p;
172 }
173 // Empty when `raw` is longer than kMaxBytes.
174 [[nodiscard]] static PartyId of_address(std::span<const std::uint8_t> raw) noexcept {
176 if (raw.empty() || raw.size() > kMaxBytes) return p;
178 p.len = static_cast<std::uint8_t>(raw.size());
179 std::memcpy(p.bytes, raw.data(), raw.size());
180 return p;
181 }
182 constexpr bool operator==(const PartyId&) const noexcept = default;
184static_assert(sizeof(PartyId) == 32 && std::is_trivially_copyable_v<PartyId>);
185
186struct TradeParties {
189 constexpr bool operator==(const TradeParties&) const noexcept = default;
191static_assert(sizeof(TradeParties) == 64 && std::is_trivially_copyable_v<TradeParties>);
192
193// A trade whose venue names the buyer and the seller carries them in the 64 bytes after the
194// message: hdr.len is kSizeWithParties and parties() points at them. Every other trade, and every
195// trade journaled before them, is 128 bytes and parties() is null; a reader that knows nothing of
196// them steps over the tail by hdr.len. As for BookDeltaMsg, such a trade is written in place
197// (set_parties() needs kSizeWithParties bytes there), and a TradeMsg copied by value loses the
198// tail: copy *parties() instead.
199struct TradeMsg {
200 static constexpr std::uint32_t kSizeWithParties = 192;
201 // pad_[0]: the venue does not say which side took liquidity (a CME trade with AggressorSide 0, an
202 // ITCH trade against a non-displayed order or a cross); `aggressor` is then Side::Buy and means
203 // nothing, so a queue model cannot tell which side's orders the print reached.
204 static constexpr std::uint8_t kNoAggressor = 1;
209 std::uint64_t trade_id;
211 std::uint8_t pad_[39]; // pad_[0]: kNoAggressor
213 [[nodiscard]] bool has_aggressor() const noexcept { return pad_[0] != kNoAggressor; }
215 [[nodiscard]] const TradeParties* parties() const noexcept {
216 if (hdr.len < kSizeWithParties) return nullptr;
217 return reinterpret_cast<const TradeParties*>(reinterpret_cast<const std::byte*>(this) +
218 sizeof(TradeMsg));
219 }
220 void set_parties(const TradeParties& p) noexcept {
222 std::memcpy(reinterpret_cast<std::byte*>(this) + sizeof(TradeMsg), &p, sizeof(p));
223 }
224};
225static_assert(sizeof(TradeMsg) == 128);
226static_assert(TradeMsg::kSizeWithParties == sizeof(TradeMsg) + sizeof(TradeParties));
227
228struct BookTickerMsg {
234 std::uint8_t pad_[32];
236static_assert(sizeof(BookTickerMsg) == 128);
237
238// Options ticker (EventType::OptionTicker): the venue's mark, implied volatilities and greeks for
239// one option instrument. mark_price is in the instrument's price unit (the base coin for Deribit
240// inverse options); underlying_price (the forward the venue prices the option on) and
241// index_price are in the underlying's quote currency. Implied vols are annualised decimals
242// (0.312 = 31.2 %). Greeks are copied as the venue reports them (Deribit: Black-76 delta, gamma
243// per quote unit, vega and rho per 1 vol / rate point, theta per day, in the quote currency; see
244// core/options/black76.hpp). NaN marks a field the venue did not send.
245struct OptionTickerMsg {
250 double mark_iv; // 88
251 double bid_iv; // 96
252 double ask_iv; // 104
253 double delta; // 112
254 double gamma; // 120
255 double vega; // 128
256 double theta; // 136
257 double rho; // 144
258 double interest_rate; // 152 annualised decimal
259 std::uint8_t pad_[32]; // 160
261static_assert(sizeof(OptionTickerMsg) == 192);
262static_assert(offsetof(OptionTickerMsg, mark_iv) == 88 &&
263 offsetof(OptionTickerMsg, interest_rate) == 152);
264
265// ---- order events (venue -> engine) ----------------------------------------------------
266
268 // The venue amended the resting order in place (Binance Spot order.amend.keepPriority,
269 // execution type REPLACED): same venue order, same queue position, fills so far kept. Without
270 // it an ack under a new client id means a new venue order whose cumulative quantity is zero.
271 static constexpr std::uint8_t kAmendedInPlace = 1U << 0;
272
276 std::uint8_t flags;
277 std::uint8_t pad_[14];
278};
279static_assert(sizeof(OrderAckMsg) == 128);
280
285 std::uint8_t pad0_[3];
286 std::int32_t venue_code;
287 FixedString<40> text;
288 std::uint8_t pad_[7];
289};
290static_assert(sizeof(OrderRejectMsg) == 128);
291
296 std::uint8_t pad0_[7];
297 Qty cum_qty; // filled before the cancel took effect
298};
299static_assert(sizeof(OrderCancelAckMsg) == 128);
300
304 RejectReason reason; // VenueUnknownOrder => the venue has no such order
305 std::uint8_t pad0_[3];
306 std::int32_t venue_code;
307 FixedString<40> text;
308 std::uint8_t pad_[7];
309};
310static_assert(sizeof(OrderCancelRejectMsg) == 128);
311
313 // The execution comes from the venue's trade history (Venue::request_executions), not from the
314 // private stream: it may already have been booked, so cum_qty and leaves_qty are not reported and
315 // the OMS works out how much of it is new (Oms::on_fill, OmsUpdate::corrected_qty).
316 static constexpr std::uint8_t kReplayed = 1U << 0;
317 // A replayed execution naming no order whose order the connector could not look up yet and will
318 // ask for again (ReplayScheduler): a later copy with the same exec_id names it, or, once the
319 // connector gives up, a last copy without this flag says it never will. fastmm-gateway holds it
320 // back from every strategy until then; an engine books it as any fill naming no order.
321 static constexpr std::uint8_t kUnresolved = 1U << 1;
325 ExecId exec_id; // dedupe key
326 std::uint8_t pad0_[6];
328 Qty qty; // this execution
329 Qty cum_qty; // cumulative after this execution (0 with kReplayed: the venue did not say)
331 Notional fee; // >= 0 paid, < 0 rebate; in units of fee_asset
334 FeeAsset fee_asset; // Quote: `fee` is a quote amount; Base: base units; Other: not convertible
335 std::uint8_t flags; // kReplayed, kUnresolved
336 std::uint8_t pad_[52];
337};
338static_assert(sizeof(OrderFillMsg) == 256);
339
347static_assert(sizeof(OrderExpiredMsg) == 128);
348
358static_assert(sizeof(PositionUpdateMsg) == 128);
359
360// A perpetual funding payment the venue booked on the account's position in hdr.instrument
361// (EventType::Funding). `amount` is signed, in `asset` (the settlement currency): negative paid,
362// positive received. hdr.exch_ts is the venue's time of the payment. `funding_id` is the venue's
363// id of it (Binance tranId, Bybit execId); the engine and the gateway book one id per instrument
364// once, so the private stream and a replay from the venue's history may both deliver it.
366 // From the venue's history (Venue::request_executions), not the private stream.
367 static constexpr std::uint8_t kReplayed = 1U << 0;
370 ExecId funding_id; // 72 -> 113
371 FixedString<8> asset; // 113 -> 122
372 std::uint8_t flags; // 122 kReplayed
373 std::uint8_t pad_[5]; // -> 128
374};
375static_assert(sizeof(FundingMsg) == 128 && offsetof(FundingMsg, funding_id) == 72 &&
376 offsetof(FundingMsg, flags) == 122);
377
378// Money that entered or left one account other than by its trades and funding
379// (EventType::AccountFlow): a deposit, a withdrawal or a transfer between accounts, as the venue
380// reported it. `amount` is signed, in `asset`: positive in, negative out. hdr.venue is the account
381// (a pool member's own id), hdr.exch_ts the venue's time of it; hdr.instrument is invalid.
382// `flow_id` is the venue's id of it, empty when the venue gives none. The engine changes nothing
383// for it: its balances follow the venue's absolute reports (BalanceMsg), which come with it or
384// after it. The journal records it like any input, and a backtest with [backtest]
385// balances_from_journal moves the simulated account by it at its time.
389 FixedString<8> asset; // 72 -> 81
390 FixedString<40> flow_id; // 81 -> 122
391 std::uint8_t pad_[6]; // -> 128
392};
393static_assert(sizeof(AccountFlowMsg) == 128 && offsetof(AccountFlowMsg, asset) == 72 &&
394 offsetof(AccountFlowMsg, flow_id) == 81);
395// The account's holding of one asset on one venue (EventType::Balance), as the venue reports it at
396// its time hdr.exch_ts. Every amount is absolute, in `asset`: a venue update replaces the last one
397// (a delta would turn one lost message into a lasting error). hdr.instrument is invalid.
398// spot free (spendable now) and locked (held by open orders); total = free + locked;
399// equity = total; maintenance 0.
400// derivatives free = available for new orders, locked = initial margin in use (positions and
401// orders), total = wallet balance, equity = wallet + unrealised PnL, maintenance =
402// maintenance margin.
403// kAccount: the account's cross-collateral margin (Bybit's unified account, OKX's multi-currency
404// modes, Binance USD-M multi-assets mode) valued in `asset`, usually USD; the derivatives of the
405// venue draw on it instead of their settlement asset.
406// A snapshot (the balance leg of a reconciliation, a REST refresh) is a run of messages flagged
407// kSnapshot whose last one also carries kSnapshotEnd: an asset of the venue it did not name holds
408// nothing. A snapshot naming no asset is one message with an empty `asset`.
409// kWithdrawable: `withdrawable` is what the venue lets leave the account now by an internal
410// transfer (Binance USD-M maxWithdrawAmount, which unrealised profit does not count towards).
411// Without the flag a venue reports none and `free` is what can leave.
413 static constexpr std::uint8_t kSnapshot = 1U << 0;
414 static constexpr std::uint8_t kSnapshotEnd = 1U << 1;
415 static constexpr std::uint8_t kAccount = 1U << 2;
416 static constexpr std::uint8_t kWithdrawable = 1U << 3;
423 FixedString<8> asset; // 104 -> 113
424 std::uint8_t flags; // 113
425 std::uint8_t pad_[6]; // -> 120
426 Notional withdrawable; // 120, with kWithdrawable
427};
428static_assert(sizeof(BalanceMsg) == 128 && offsetof(BalanceMsg, asset) == 104 &&
429 offsetof(BalanceMsg, flags) == 113 && offsetof(BalanceMsg, withdrawable) == 120);
430
431// A record of a recorded session in the stream of a source that follows its journal, ahead of the
432// market data it must reach the runs before (backtest/follow_source.hpp): `hdr`, of type Padding,
433// which no source yields and no engine takes, then a copy of the record (ParamUpdate, Control,
434// AccountFlow, a Balance that ends a snapshot). It is never journaled and never reaches an engine.
437 [[nodiscard]] const EventHeader& record() const noexcept {
438 return *reinterpret_cast<const EventHeader*>(this + 1);
439 }
440};
441static_assert(sizeof(SessionRecordMsg) == 64);
442
443// The venue's reference prices and funding of one derivative (EventType::PerpState), from its
444// public market data. Market data: it rides the market-data ring and the journal, so a replay sees
445// the same values at the same engine times. hdr.exch_ts is the venue's time of the values.
446// `fields` names what the message carries; the engine keeps the last value of each field with the
447// time it arrived (core/perp_book.hpp), so a venue that publishes mark, index and funding on
448// separate channels sends one message per channel.
449// mark_price kMark: the price the venue values positions and liquidations at
450// index_price kIndex: the spot index the mark and the funding follow
451// funding_rate kFunding: the rate the venue will apply at next_funding, per funding
452// interval, as a decimal (0.0001 = 1 bp); positive: longs pay shorts
453// funding_interval kFunding: how often funding is paid (a continuous venue reports the rate
454// over this interval: Deribit's current_funding, 8 h)
455// next_funding kFunding: venue time of the next payment; zero when funding is continuous
456// open_interest kOpenInterest: contracts open
458 static constexpr std::uint8_t kMark = 1U << 0;
459 static constexpr std::uint8_t kIndex = 1U << 1;
460 static constexpr std::uint8_t kFunding = 1U << 2;
461 static constexpr std::uint8_t kOpenInterest = 1U << 3;
465 double funding_rate; // 80
469 std::uint8_t fields; // 112
470 std::uint8_t pad_[15]; // -> 128
471};
472static_assert(sizeof(PerpStateMsg) == 128 && offsetof(PerpStateMsg, funding_rate) == 80 &&
473 offsetof(PerpStateMsg, fields) == 112);
474
475// A venue changed an instrument's trading rules or trading status while the session ran
476// (EventType::InstrumentRules): the connector read them again (venues/instrument_rules.hpp) and
477// found them different from the last it reported. It rides the order ring, which drops nothing,
478// and the journal, so a replay changes the rules at the same engine time. `changed` names the
479// fields that differ; the engine takes those and leaves the rest of the instrument as it is, so a
480// field the session kept from its configuration ([venues.<name>] rules_mismatch = "warn") stays
481// until the venue changes it. A zero max_qty or max_notional is no limit, as in Instrument.
482// cause kRefresh: the periodic read; kRefusal: a read after the venue refused an order for its
483// rules or status
485 static constexpr std::uint8_t kTick = 1U << 0;
486 static constexpr std::uint8_t kLot = 1U << 1;
487 static constexpr std::uint8_t kMinQty = 1U << 2;
488 static constexpr std::uint8_t kMaxQty = 1U << 3;
489 static constexpr std::uint8_t kMinNotional = 1U << 4;
490 static constexpr std::uint8_t kMaxNotional = 1U << 5;
491 static constexpr std::uint8_t kStatus = 1U << 6;
492 static constexpr std::uint8_t kRefresh = 0;
493 static constexpr std::uint8_t kRefusal = 1;
495 Price tick; // 64
496 Qty lot; // 72
502 std::uint8_t changed; // 113
503 std::uint8_t cause; // 114
504 std::uint8_t pad_[13]; // -> 128
505};
506static_assert(sizeof(InstrumentRulesMsg) == 128 && offsetof(InstrumentRulesMsg, tick) == 64 &&
507 offsetof(InstrumentRulesMsg, status) == 112);
508
509// A funding id in the list of venue ids a restarted session's store already holds
510// (store::Recovery::VenueResume::known_exec_ids, next to the trade ids): the prefix keeps the two
511// id spaces apart.
512inline constexpr std::string_view kFundingIdPrefix = "funding:";
513
514// ---- engine-internal -------------------------------------------------------------------
516struct TimerMsg {
519 std::uint8_t engine; // 1: the engine's own timer (max_param_age), not the strategy's
520 std::uint8_t pad0_[3];
521 std::uint64_t user_data;
523 std::uint8_t pad_[40];
524};
525static_assert(sizeof(TimerMsg) == 128);
530 std::uint8_t pad0_[7];
531 std::uint64_t arg;
532 std::uint8_t pad_[48];
533};
534static_assert(sizeof(ControlMsg) == 128);
535// ControlCommand::TripKill's arg for a stop that was asked for (fastmm-live's --duration, a signal,
536// fastmm-ctl stop): the engine pulls its quotes and cancels as for any trip, and logs it as a stop.
537inline constexpr std::uint64_t kTripKillPlannedStop = 1;
538// ControlCommand::TripKill's arg when the store failed or dropped records and [storage]
539// kill_on_failure is set: the engine trips with KillReason::StoreFailure.
540inline constexpr std::uint64_t kTripKillStoreFailure = 2;
541
542// ControlCommand::SetLimits: a ControlMsg with the new limits after it. The prefix is a ControlMsg
543// (same type, same offsets), so the engine's dispatch reads `command` from either and only this
544// command looks past it; hdr.len tells the rings, the journal and a replay how long the record is.
545// ControlLimitsMsg::arg. A record without kLimitsCheckBalance leaves [risk] check_balance alone
546// (journals from before the flag).
547inline constexpr std::uint64_t kLimitsCheckBalance = 1; // kLimitsCheckBalanceOn is the value
548inline constexpr std::uint64_t kLimitsCheckBalanceOn = 2; // check_balance = true
549// The operator turned a limit off (fastmm-ctl limits --force); ControlUnderlyingMsg::flags too.
550inline constexpr std::uint64_t kLimitsForced = 4;
554 std::uint8_t pad0_[7];
555 std::uint64_t arg;
557 std::uint8_t pad_[16];
558};
559static_assert(sizeof(ControlLimitsMsg) == 192 && std::is_trivially_copyable_v<ControlLimitsMsg>);
560static_assert(offsetof(ControlLimitsMsg, command) == offsetof(ControlMsg, command) &&
561 offsetof(ControlLimitsMsg, arg) == offsetof(ControlMsg, arg));
562
563// ControlCommand::SetUnderlyingLimit: a ControlMsg whose `arg` is the new max_net (raw Qty, base
564// units; 0 lifts the limit) of the underlying at index `underlying` of the session's plan
565// (core/underlying.hpp), named in `name` for the log and a journal reader.
569 std::uint8_t underlying;
570 std::uint8_t flags; // kLimitsForced
571 std::uint8_t pad0_[5];
572 std::uint64_t arg;
573 FixedString<8> name;
574 std::uint8_t pad_[39];
575};
576static_assert(sizeof(ControlUnderlyingMsg) == sizeof(ControlMsg) &&
577 std::is_trivially_copyable_v<ControlUnderlyingMsg>);
578static_assert(offsetof(ControlUnderlyingMsg, command) == offsetof(ControlMsg, command) &&
579 offsetof(ControlUnderlyingMsg, arg) == offsetof(ControlMsg, arg));
580
581// ControlCommand::Transfer: one step of a pool treasury's transfer (core/treasury.hpp), on the
582// treasury's ring into the engine, which journals it. hdr.venue is the pool's primary; `arg` the
583// amount (raw Notional) of `asset` moved from account `from` to account `to`.
584//
585// With kHeld (the treasury's reserve = true) the engine keeps the payout out of the payer's
586// balance (BalanceBook::reserve), by `seq`: a Reserve holds at most the payer's free estimate, a
587// Sent sets the hold to `arg`, Failed and Released give it back, Done gives it back and moves `arg`
588// out of `from` and into `to` until their next reports. Without it the engine counts the record.
589// With kLane the record belongs to the pool's transfer lane (core/transfer_lane.hpp): the engine's
590// own Request, Planned and Done are kSynthetic, the worker's answers are inputs; `code` and
591// `http_status` carry the venue's answer to a refusal.
593 static constexpr std::uint8_t kHeld = 1;
594 static constexpr std::uint8_t kLane = 2;
598 std::uint8_t event; // TreasuryEventKind: planned (dry run), sent, done, failed, timed out, ...
599 std::uint8_t state; // TransferState of the venue's answer; Unknown without one
602 std::uint8_t flags; // kHeld
603 std::uint8_t pad0_[2];
604 std::uint64_t arg;
605 FixedString<8> asset; // 80
606 FixedString<31> client_id; // 89
607 FixedString<23> venue_ref; // 121: the venue's id of the transfer
608 std::uint8_t pad1_[7]; // 145
609 std::uint64_t seq; // 152: the treasury's counter of the transfer
610 std::int32_t code; // 160: the venue's error code, 0 without one
611 std::uint16_t http_status; // 164
612 std::uint8_t pad_[26]; // 166 -> 192
613};
614static_assert(sizeof(ControlTransferMsg) == 192 &&
615 std::is_trivially_copyable_v<ControlTransferMsg>);
616static_assert(offsetof(ControlTransferMsg, command) == offsetof(ControlMsg, command) &&
617 offsetof(ControlTransferMsg, arg) == offsetof(ControlMsg, arg) &&
618 offsetof(ControlTransferMsg, asset) == 80 &&
619 offsetof(ControlTransferMsg, client_id) == 89 &&
620 offsetof(ControlTransferMsg, venue_ref) == 121 &&
621 offsetof(ControlTransferMsg, seq) == 152 &&
622 offsetof(ControlTransferMsg, code) == 160 &&
623 offsetof(ControlTransferMsg, http_status) == 164);
624
625// ControlCommand::BaseFlow: a change of the base asset of spot instrument hdr.instrument on the
626// accounts of pool hdr.venue (the primary) that the engine's fills and transfers do not explain
627// ([engine] base_flows). `arg` is the change (raw Qty, two's complement: negative left the
628// accounts), `balance` the accounts' total of `asset` and `position` the position of the
629// instrument(s) of that base before it (raw); kBooked: the position took it. The engine journals it
630// as a record (kSynthetic); a replay finds it again.
632 static constexpr std::uint8_t kBooked = 1;
636 std::uint8_t flags; // kBooked
637 std::uint8_t pad0_[6];
638 std::uint64_t arg;
639 std::int64_t balance; // 80
640 std::int64_t position; // 88
641 FixedString<8> asset; // 96
642 std::uint8_t pad_[23]; // 105 -> 128
643};
644static_assert(sizeof(ControlBaseFlowMsg) == sizeof(ControlMsg) &&
645 std::is_trivially_copyable_v<ControlBaseFlowMsg>);
646static_assert(offsetof(ControlBaseFlowMsg, command) == offsetof(ControlMsg, command) &&
647 offsetof(ControlBaseFlowMsg, arg) == offsetof(ControlMsg, arg) &&
648 offsetof(ControlBaseFlowMsg, balance) == 80 &&
649 offsetof(ControlBaseFlowMsg, position) == 88 &&
650 offsetof(ControlBaseFlowMsg, asset) == 96);
655 std::uint8_t channel; // 0 = market data, 1 = order/user stream
656 std::uint8_t pad0_[2];
657 std::int32_t reason_code;
658 std::uint8_t pad_[56];
659};
660static_assert(sizeof(ConnectionStateMsg) == 128);
661
662// Control thread injects the venue's view after a reconnect (5.8). A reconciliation is a
663// Begin, N OpenOrder / Position records, then End.
664//
665// Begin with kSentWatermark set carries the highest client order id (New or Replace) the venue had
666// taken from the outbound ring when it requested the snapshot. Orders with a higher id were not yet
667// sent, so the snapshot cannot contain them and End must not mark them cancelled. Without the flag
668// every order of the venue missing from the snapshot is cancelled.
670 enum class Kind : std::uint8_t { Begin = 0, OpenOrder = 1, Position = 2, End = 3 };
671 static constexpr std::uint8_t kSentWatermark = 1U << 0;
672 // Begin: every execution the venue made since the last one the engine booked was replayed before
673 // this snapshot (Venue::request_executions succeeded), so the snapshot's quantities are the
674 // venue's own and nothing in it has to be guessed at. Without it the connector could not ask, and
675 // a quantity the snapshot reports that no fill covered is an estimate: see
676 // Engine::book_missed_fill and Oms::reconcile_end.
677 static constexpr std::uint8_t kExecutionsExact = 1U << 1;
682 std::uint8_t pad0_[5];
685 std::uint8_t pad1_[7];
689 Qty position_qty; // Kind::Position
690 Price avg_px; // Kind::Position
691 ClientOrderId sent_watermark; // Kind::Begin, valid with kSentWatermark
692 std::uint8_t flags; // Kind::Begin: kSentWatermark
693 std::uint8_t pad_[15];
694};
695static_assert(sizeof(ReconcileMsg) == 192);
699 std::uint8_t interval; // LatencyInterval index
700 std::uint8_t pad0_[7];
701 std::uint64_t count;
702 std::int64_t p50_ns;
703 std::int64_t p90_ns;
704 std::int64_t p99_ns;
705 std::int64_t p999_ns;
706 std::int64_t max_ns;
707 std::uint8_t pad_[8];
708};
709static_assert(sizeof(LatencySampleMsg) == 128);
710
711// Journal only: what a replay or a backtest over the journal can start from. The bytes the strategy
712// was handed to restore() at the start (Kind::Restored, flagged kAccepted when it took them), and
713// the checkpoints (Kind::Snapshot): every [engine] checkpoint_s, and at a warm standby's take-over,
714// the strategy's state() (no bytes for a strategy that keeps none), the engine's positions and its
715// open orders. One state is written as records of at most kChunkBytes each: `id` numbers the
716// states of the session, `part` says what the bytes are (kStatePart: the strategy's state;
717// kPositionsPart: StatePosition entries; kOrdersPart: StateOrder entries, format v4), and
718// `offset` / `total` place them in it. `version` is the strategy's state_version
719// (strategies/hooks.hpp) when it wrote the bytes; 0 in journals from before it was recorded. A
720// record is the 128-byte head and its bytes padded to 64. Never dispatched.
722 enum class Kind : std::uint8_t { Restored = 0, Snapshot = 1 };
723 static constexpr std::uint8_t kStatePart = 0;
724 static constexpr std::uint8_t kPositionsPart = 1;
725 static constexpr std::uint8_t kOrdersPart = 2;
726 static constexpr std::uint8_t kAccepted = 1U << 0;
727 static constexpr std::uint32_t kChunkBytes = 16384;
729 std::uint64_t id;
730 std::uint32_t total; // bytes of the part
731 std::uint32_t offset; // of this record's bytes in the part
732 std::uint32_t bytes; // after the head
734 std::uint8_t part;
735 std::uint8_t flags;
736 std::uint8_t pad0_;
737 std::uint32_t version;
738 std::uint8_t pad_[36];
739 [[nodiscard]] static constexpr std::uint32_t size_for(std::uint32_t n) noexcept {
740 return 128 + (n + 63) / 64 * 64;
742 [[nodiscard]] const std::byte* data() const noexcept {
743 return reinterpret_cast<const std::byte*>(this) + 128;
744 }
745};
746static_assert(sizeof(StrategyStateMsg) == 128 && offsetof(StrategyStateMsg, version) == 88);
747
748// One instrument's position in a StrategyStateMsg's kPositionsPart: on the account (venue) whose
749// Reconcile Position would set it.
751 std::uint32_t instrument;
752 std::uint8_t venue;
753 std::uint8_t pad_[3];
754 std::int64_t qty_raw;
755 std::int64_t avg_px_raw;
756};
757static_assert(sizeof(StatePosition) == 24 && std::is_trivially_copyable_v<StatePosition>);
758
759// One open order in a StrategyStateMsg's kOrdersPart: on the account (venue) it went to, its
760// OrderState and Order::flags, its price and what it has left.
762 std::uint64_t cl_ord_id;
763 std::uint32_t instrument;
764 std::uint8_t venue;
765 std::uint8_t side; // Side
766 std::uint8_t state; // OrderState
767 std::uint8_t flags; // Order::flags
768 std::int64_t price_raw;
769 std::int64_t leaves_raw;
770};
771static_assert(sizeof(StateOrder) == 32 && std::is_trivially_copyable_v<StateOrder>);
772
773// Journal only (format v2): the engine clock as an absolute value. Written when the engine starts
774// and finishes, and before a consumed event whose clock delta does not fit kEngineTime's int32 ns.
775// Never dispatched.
777 enum class Kind : std::uint8_t { Sync = 0, Start = 1, Finish = 2 };
781 std::uint8_t pad_[55];
782};
783static_assert(sizeof(EngineTimeMsg) == 128);
784
785// New strategy parameter values (ADR-0013): up to kMaxFields (field index, raw value) pairs, built
786// and validated off the engine thread (strategies/param_publisher.hpp). The engine applies them
787// together at one event, journals the message and calls on_params. A field index is the position
788// of the parameter in the strategy's schema; the journal header records the schema, so a replay
789// resolves indices by name. A raw value is the field's int64 form (ParamDesc::get_raw): the value
790// of an integer or bool, the raw fixed-point value of Price, Qty, Notional and Ratio, the
791// nanoseconds of a Duration and the IEEE-754 bits of a double. `origin` names the publisher (the
792// control socket's sequence is the one fastmm-ctl waits on) and `source` who asked for the change
793// (`fastmm-ctl param --source`), both zero in journals written before they existed. `arm` moves
794// the update's instruments into an arm of the [ab] test (strategies/ab_test.hpp): kArmKeep leaves
795// them where they are, kArmNone takes them out of the test, k + 1 puts them in arm k.
797 static constexpr std::size_t kMaxFields = 32;
798 static constexpr std::size_t kSourceLen = 40; // `source`, NUL-terminated
799 static constexpr std::uint8_t kArmKeep = 0;
800 static constexpr std::uint8_t kArmNone = 0xFF;
801 // hdr.instrument of an update for every instrument: the invalid id.
802 static constexpr InstrumentId kAllInstruments{};
803 enum class Origin : std::uint8_t {
804 Strategy = 0, // the strategy's own publisher (a slow tier, a model), or not recorded
805 Control = 1, // the control socket (fastmm-ctl param)
806 Experiment = 2, // the [ab] test: an arm's parameters at a block boundary, a stop, a promote
807 Config = 3, // [strategy.overrides], at the start of the session
808 };
809 // `flags`. kReset: the named parameters stop being the instrument's own and take the shared
810 // value again, which `value` carries; for every instrument, each instrument's own value of them
811 // is dropped. An update for every instrument with an arm is a reset as well.
812 static constexpr std::uint8_t kReset = 1U << 0;
815 std::uint32_t count; // pairs used
817 std::uint8_t arm; // kArmKeep, kArmNone or arm + 1
818 std::uint8_t flags; // kReset
819 std::uint8_t pad0_[1]; //
820 std::uint64_t publish_seq; // the publisher's sequence number, from 1
821 std::uint16_t field[kMaxFields]; // schema index of each pair
822 char source[kSourceLen]; // who asked for it, e.g. "manual", "scheduled:drain"
823 std::uint8_t pad1_[8]; //
824 std::int64_t value[kMaxFields]; // raw value of each pair
826 [[nodiscard]] bool all_instruments() const noexcept { return !hdr.instrument.valid(); }
827 // The update drops the instruments' own values of the parameters it names (kReset).
828 [[nodiscard]] bool resets() const noexcept {
829 return (flags & kReset) != 0 || (all_instruments() && arm != kArmKeep);
831 [[nodiscard]] std::string_view source_view() const noexcept {
832 std::size_t n = 0;
833 while (n < kSourceLen && source[n] != '\0') ++n;
834 return {source, n};
835 }
836 // Copies `s` into `source`, cut to kSourceLen - 1 bytes.
837 void set_source(std::string_view s) noexcept {
838 const std::size_t n = s.size() < kSourceLen - 1 ? s.size() : kSourceLen - 1;
839 for (std::size_t i = 0; i < kSourceLen; ++i) source[i] = i < n ? s[i] : '\0';
840 }
841};
842// "strategy", "control", "ab", "config": the store's param_updates.origin.
843[[nodiscard]] constexpr std::string_view to_string(ParamUpdateMsg::Origin o) noexcept {
844 switch (o) {
846 return "control";
848 return "ab";
850 return "config";
852 break;
853 }
854 return "strategy";
855}
856static_assert(sizeof(ParamUpdateMsg) == 448 && std::is_trivially_copyable_v<ParamUpdateMsg>);
857static_assert(offsetof(ParamUpdateMsg, count) == 64 && offsetof(ParamUpdateMsg, origin) == 68 &&
858 offsetof(ParamUpdateMsg, arm) == 69 && offsetof(ParamUpdateMsg, flags) == 70 &&
859 offsetof(ParamUpdateMsg, field) == 80 && offsetof(ParamUpdateMsg, source) == 144 &&
860 offsetof(ParamUpdateMsg, value) == 192);
861
862// ---- outbound (engine -> venue) --------------------------------------------------------
872 std::uint8_t reduce_only;
873 std::uint8_t arm; // the [ab] arm it was sent under: 0 none, k + 1 arm k (Order::arm)
874 std::uint8_t pad_[35];
875};
876static_assert(sizeof(OutNewOrderMsg) == 128 && offsetof(OutNewOrderMsg, arm) == 92);
881 VenueOrderId venue_order_id; // may be empty if not yet acked
882 std::uint8_t pad_[15];
883};
884static_assert(sizeof(OutCancelMsg) == 128);
889 ClientOrderId orig_cl_ord_id; // order being replaced
891 std::uint8_t pad0_[7];
894 std::uint8_t arm; // the [ab] arm it was sent under: 0 none, k + 1 arm k (Order::arm)
895 std::uint8_t pad_[47];
896};
897static_assert(sizeof(OutReplaceMsg) == 192 && offsetof(OutReplaceMsg, arm) == 144);
899// ---- L3 (ITCH-style) -------------------------------------------------------------------
903 std::uint64_t order_ref;
905 Qty qty;
906 Side side;
907 std::uint8_t pad_[39];
909static_assert(sizeof(OrderAddL3Msg) == 128);
911struct OrderExecL3Msg {
912 // exec_flags. Zero (E, and records written before the field existed) is a printable execution.
913 static constexpr std::uint8_t kNonPrintable = 1U << 0; // ITCH C with Printable = N
916 std::uint64_t order_ref;
918 Price exec_price; // zero -> at the order's price
919 std::uint64_t match_id;
920 std::uint8_t exec_flags;
921 std::uint8_t pad_[31];
922
923 [[nodiscard]] bool printable() const noexcept { return (exec_flags & kNonPrintable) == 0; }
925static_assert(sizeof(OrderExecL3Msg) == 128);
929 std::uint64_t order_ref;
930 Qty canceled_qty; // zero -> delete the whole order
931 std::uint8_t pad_[48];
933static_assert(sizeof(OrderCancelL3Msg) == 128);
937 std::uint64_t old_order_ref;
938 std::uint64_t new_order_ref;
939 Price price;
940 Qty qty;
941 std::uint8_t pad_[32];
942};
943static_assert(sizeof(OrderReplaceL3Msg) == 128);
945// Largest fixed-size message; BookDelta is bounded separately by kMaxBookLevelsPerMsg.
946inline constexpr std::uint32_t kMaxBookLevelsPerMsg = 1024;
947inline constexpr std::uint32_t kMaxMsgBytes =
949
950// Every message: trivially copyable with the EventHeader first. Fixed-size messages are
951// additionally a multiple of 64 bytes (BookDeltaMsg is variable-length: see size_for()).
952template <class M>
953concept MessageLike = std::is_trivially_copyable_v<M> &&
954 std::is_same_v<decltype(M::hdr), EventHeader> && alignof(M) <= 64;
955template <class M>
956concept FixedSizeMessage = MessageLike<M> && (sizeof(M) % 64 == 0);
973
974template <MessageLike M>
975[[nodiscard]] FASTMM_FORCE_INLINE const M& msg_cast(const EventHeader* h) noexcept {
976 return *reinterpret_cast<const M*>(h);
977}
978
979} // namespace fastmm
Definition config.hpp:502
Definition messages.hpp:953
Every message: trivially copyable with the EventHeader first.
Definition messages.hpp:950
All engine enumerations.
Fixed<Tag>: int64 fixed point with a global 1e-8 scale (ADR-0001).
Definition strategy.hpp:23
constexpr std::uint8_t kMessageVersion
Definition messages.hpp:28
OrderType
Definition enums.hpp:23
OrderState
Definition enums.hpp:79
constexpr std::string_view kFundingIdPrefix
A funding id in the list of venue ids a restarted session's store already holds (store::Recovery::Ven...
Definition messages.hpp:512
TradingStatus
Whether a venue takes orders on an instrument (Instrument::status, InstrumentRulesMsg).
Definition enums.hpp:436
ConnState
Definition enums.hpp:453
constexpr std::uint64_t kLimitsCheckBalanceOn
check_balance = true
Definition messages.hpp:547
FixedString< 40 > VenueOrderId
Definition strong_id.hpp:42
EventType
Message discriminator carried in EventHeader::type.
Definition enums.hpp:316
RejectReason
Ordered exactly like RiskEngine::check_new evaluates them (5.7), followed by OMS / transport / venue ...
Definition enums.hpp:123
constexpr std::uint64_t kTripKillPlannedStop
ControlCommand::TripKill's arg for a stop that was asked for (fastmm-live's --duration,...
Definition messages.hpp:536
constexpr void init_header(M &m, EventType type, InstrumentId inst={}, VenueId venue={}, std::uint32_t len=static_cast< std::uint32_t >(sizeof(M))) noexcept
For fixed-size messages len defaults to sizeof(M); BookDeltaMsg passes size_for().
Definition messages.hpp:76
Side
Definition enums.hpp:12
FeeAsset
The asset a fill's commission is charged in.
Definition enums.hpp:481
constexpr std::uint32_t kMaxMsgBytes
Definition messages.hpp:944
constexpr std::uint32_t kMaxBookLevelsPerMsg
Largest fixed-size message; BookDelta is bounded separately by kMaxBookLevelsPerMsg.
Definition messages.hpp:943
BookDeltaMsg BookSnapshotMsg
same layout; hdr.type == BookSnapshot, kSnapshot set
Definition messages.hpp:139
FASTMM_FORCE_INLINE const M & msg_cast(const EventHeader *h) noexcept
Definition messages.hpp:972
constexpr std::uint8_t truncation_flags(bool bids, bool asks) noexcept
The header flags of a delta whose bids and/or asks kept only the levels nearest the touch.
Definition messages.hpp:133
FixedString< 40 > ExecId
Definition strong_id.hpp:44
constexpr std::uint64_t kLimitsCheckBalance
ControlCommand::SetLimits: a ControlMsg with the new limits after it.
Definition messages.hpp:546
TimeInForce
Definition enums.hpp:36
constexpr std::string_view to_string(ParamType t) noexcept
Definition params.hpp:63
constexpr std::uint64_t kLimitsForced
The operator turned a limit off (fastmm-ctl limits --force); ControlUnderlyingMsg::flags too.
Definition messages.hpp:549
constexpr std::uint64_t kTripKillStoreFailure
ControlCommand::TripKill's arg when the store failed or dropped records and [storage] kill_on_failure...
Definition messages.hpp:539
Liquidity
Definition enums.hpp:483
ControlCommand
Definition enums.hpp:496
StrongId< struct VenueTag, std::uint8_t > VenueId
Definition strong_id.hpp:39
PartyIdKind
One side of a public trade as the venue names it, on venues that publish who traded (Hyperliquid: wal...
Definition messages.hpp:147
@ Account
a numeric account id, bytes holds it as a little-endian uint64 (account())
@ None
the venue did not name this side
@ Address
an address or public key, len raw bytes in the order written (0x hex text)
RiskLimits: the pre-trade limits a session runs with ([risk] in the configuration),...
Strongly typed identifiers.
Money that entered or left one account other than by its trades and funding (EventType::AccountFlow):...
Definition messages.hpp:386
FixedString< 8 > asset
72 -> 81
Definition messages.hpp:389
Notional amount
64
Definition messages.hpp:388
EventHeader hdr
Definition messages.hpp:387
std::uint8_t pad_[6]
-> 128
Definition messages.hpp:391
FixedString< 40 > flow_id
81 -> 122
Definition messages.hpp:390
The account's holding of one asset on one venue (EventType::Balance), as the venue reports it at its ...
Definition messages.hpp:412
Notional locked
72
Definition messages.hpp:419
static constexpr std::uint8_t kSnapshotEnd
Definition messages.hpp:414
static constexpr std::uint8_t kSnapshot
Definition messages.hpp:413
static constexpr std::uint8_t kWithdrawable
Definition messages.hpp:416
Notional equity
88
Definition messages.hpp:421
EventHeader hdr
Definition messages.hpp:417
Notional free
64
Definition messages.hpp:418
Notional total
80
Definition messages.hpp:420
FixedString< 8 > asset
104 -> 113
Definition messages.hpp:423
Notional maintenance
96
Definition messages.hpp:422
static constexpr std::uint8_t kAccount
Definition messages.hpp:415
Notional withdrawable
120, with kWithdrawable
Definition messages.hpp:426
std::uint8_t pad_[6]
-> 120
Definition messages.hpp:425
std::uint8_t flags
113
Definition messages.hpp:424
Bids then asks follow the fixed part as a flexible array of Level (bid_count + ask_count).
Definition messages.hpp:100
EventHeader hdr
Definition messages.hpp:101
static constexpr std::uint32_t size_for(std::uint32_t bids, std::uint32_t asks) noexcept
Definition messages.hpp:108
std::uint64_t first_update_id
Binance U.
Definition messages.hpp:104
std::uint32_t bid_count
Definition messages.hpp:102
std::uint64_t last_update_id
Binance u / Bybit u.
Definition messages.hpp:105
bool is_snapshot() const noexcept
Definition messages.hpp:127
Level * levels() noexcept
Definition messages.hpp:114
std::span< const Level > bids() const noexcept
Definition messages.hpp:121
std::uint32_t ask_count
Definition messages.hpp:103
std::uint64_t prev_update_id
Binance futures pu (0 if n/a)
Definition messages.hpp:106
std::span< const Level > asks() const noexcept
Definition messages.hpp:122
Definition messages.hpp:229
Qty ask_qty
Definition messages.hpp:234
Price ask_px
Definition messages.hpp:233
std::uint8_t pad_[32]
Definition messages.hpp:235
Price bid_px
Definition messages.hpp:231
Qty bid_qty
Definition messages.hpp:232
EventHeader hdr
Definition messages.hpp:230
Definition messages.hpp:651
ConnState state
Definition messages.hpp:653
EventHeader hdr
Definition messages.hpp:652
std::uint8_t channel
0 = market data, 1 = order/user stream
Definition messages.hpp:654
std::uint8_t pad_[56]
Definition messages.hpp:657
std::uint8_t pad0_[2]
Definition messages.hpp:655
std::int32_t reason_code
Definition messages.hpp:656
ControlCommand::BaseFlow: a change of the base asset of spot instrument hdr.instrument on the account...
Definition messages.hpp:630
std::int64_t balance
80
Definition messages.hpp:638
static constexpr std::uint8_t kBooked
Definition messages.hpp:631
FixedString< 8 > asset
96
Definition messages.hpp:640
std::uint64_t arg
Definition messages.hpp:637
ControlCommand command
Definition messages.hpp:634
std::uint8_t flags
kBooked
Definition messages.hpp:635
std::uint8_t pad_[23]
105 -> 128
Definition messages.hpp:641
EventHeader hdr
Definition messages.hpp:633
std::uint8_t pad0_[6]
Definition messages.hpp:636
std::int64_t position
88
Definition messages.hpp:639
Definition messages.hpp:550
RiskLimits limits
Definition messages.hpp:555
EventHeader hdr
Definition messages.hpp:551
std::uint8_t pad0_[7]
Definition messages.hpp:553
ControlCommand command
Definition messages.hpp:552
std::uint64_t arg
Definition messages.hpp:554
std::uint8_t pad_[16]
Definition messages.hpp:556
Definition messages.hpp:526
std::uint8_t pad_[48]
Definition messages.hpp:531
ControlCommand command
Definition messages.hpp:528
EventHeader hdr
Definition messages.hpp:527
std::uint64_t arg
Definition messages.hpp:530
std::uint8_t pad0_[7]
Definition messages.hpp:529
ControlCommand::Transfer: one step of a pool treasury's transfer (core/treasury.hpp),...
Definition messages.hpp:591
std::uint64_t arg
Definition messages.hpp:603
VenueId to
Definition messages.hpp:600
std::uint8_t pad_[26]
166 -> 192
Definition messages.hpp:611
ControlCommand command
Definition messages.hpp:596
VenueId from
Definition messages.hpp:599
std::uint8_t state
TransferState of the venue's answer; Unknown without one.
Definition messages.hpp:598
std::uint8_t flags
kHeld
Definition messages.hpp:601
static constexpr std::uint8_t kHeld
Definition messages.hpp:592
static constexpr std::uint8_t kLane
Definition messages.hpp:593
std::int32_t code
160: the venue's error code, 0 without one
Definition messages.hpp:609
std::uint16_t http_status
164
Definition messages.hpp:610
std::uint8_t pad1_[7]
145
Definition messages.hpp:607
std::uint64_t seq
152: the treasury's counter of the transfer
Definition messages.hpp:608
FixedString< 8 > asset
80
Definition messages.hpp:604
std::uint8_t pad0_[2]
Definition messages.hpp:602
FixedString< 23 > venue_ref
121: the venue's id of the transfer
Definition messages.hpp:606
std::uint8_t event
TreasuryEventKind: planned (dry run), sent, done, failed, timed out, ...
Definition messages.hpp:597
FixedString< 31 > client_id
89
Definition messages.hpp:605
EventHeader hdr
Definition messages.hpp:595
ControlCommand::SetUnderlyingLimit: a ControlMsg whose arg is the new max_net (raw Qty,...
Definition messages.hpp:565
ControlCommand command
Definition messages.hpp:567
std::uint8_t pad0_[5]
Definition messages.hpp:570
std::uint8_t pad_[39]
Definition messages.hpp:573
FixedString< 8 > name
Definition messages.hpp:572
EventHeader hdr
Definition messages.hpp:566
std::uint64_t arg
Definition messages.hpp:571
std::uint8_t flags
kLimitsForced
Definition messages.hpp:569
std::uint8_t underlying
Definition messages.hpp:568
Definition time.hpp:59
Definition time.hpp:22
Journal only (format v2): the engine clock as an absolute value.
Definition messages.hpp:775
Timestamp engine_ts
Definition messages.hpp:778
std::uint8_t pad_[55]
Definition messages.hpp:780
EventHeader hdr
Definition messages.hpp:777
Kind
Definition messages.hpp:776
Kind kind
Definition messages.hpp:779
Definition messages.hpp:38
std::uint8_t flags
Definition messages.hpp:59
Cycles t0_cycles
T0 raw TSC at recv (48)
Definition messages.hpp:66
VenueId venue
Definition messages.hpp:58
std::uint64_t venue_seq
venue update id / sequence number (24)
Definition messages.hpp:63
std::uint32_t reserved0
journal: engine-time delta when kEngineTime (offset 12)
Definition messages.hpp:61
std::uint8_t version
kMessageVersion
Definition messages.hpp:57
std::uint64_t seq
engine consumption order; assigned by JournalWriter (16)
Definition messages.hpp:62
Timestamp recv_ts
T0 wall-clock (40)
Definition messages.hpp:65
Timestamp exch_ts
venue event time (32)
Definition messages.hpp:64
std::uint32_t len
total bytes incl. header, multiple of 64 (offset 0)
Definition messages.hpp:55
Flags
Definition messages.hpp:39
@ kDropped
journal only: outbound message the transport did not accept
Definition messages.hpp:47
@ kTruncatedBids
BookDelta: the venue's update changed more levels on this side than the message carries,...
Definition messages.hpp:51
@ kEngineTime
Journal only (format v2, ADR-0010): reserved0 holds the engine clock at consumption as a signed ns de...
Definition messages.hpp:46
@ kReplayed
came from a journal
Definition messages.hpp:41
@ kSnapshot
BookDelta carries a full snapshot.
Definition messages.hpp:42
@ kSynthetic
generated locally (reconcile fill, sim), not from the venue
Definition messages.hpp:40
@ kTruncatedAsks
Definition messages.hpp:52
@ kOutbound
engine -> venue message copied into the journal
Definition messages.hpp:43
std::uint32_t t2_delta
cycles T0->T2 (book applied) (60)
Definition messages.hpp:68
InstrumentId instrument
dense id, invalid for non-instrument events (offset 8)
Definition messages.hpp:60
std::uint32_t t1_delta
cycles T0->T1 (decoded) (56)
Definition messages.hpp:67
EventType type
(offset 4)
Definition messages.hpp:56
A perpetual funding payment the venue booked on the account's position in hdr.instrument (EventType::...
Definition messages.hpp:365
std::uint8_t flags
122 kReplayed
Definition messages.hpp:372
FixedString< 8 > asset
113 -> 122
Definition messages.hpp:371
ExecId funding_id
72 -> 113
Definition messages.hpp:370
static constexpr std::uint8_t kReplayed
From the venue's history (Venue::request_executions), not the private stream.
Definition messages.hpp:367
EventHeader hdr
Definition messages.hpp:368
std::uint8_t pad_[5]
-> 128
Definition messages.hpp:373
Notional amount
64
Definition messages.hpp:369
A venue changed an instrument's trading rules or trading status while the session ran (EventType::Ins...
Definition messages.hpp:484
static constexpr std::uint8_t kMinQty
Definition messages.hpp:487
static constexpr std::uint8_t kMaxQty
Definition messages.hpp:488
static constexpr std::uint8_t kTick
Definition messages.hpp:485
Price tick
64
Definition messages.hpp:495
Notional min_notional
96
Definition messages.hpp:499
EventHeader hdr
Definition messages.hpp:494
static constexpr std::uint8_t kLot
Definition messages.hpp:486
Qty lot
72
Definition messages.hpp:496
Qty max_qty
88
Definition messages.hpp:498
std::uint8_t cause
114
Definition messages.hpp:503
std::uint8_t changed
113
Definition messages.hpp:502
static constexpr std::uint8_t kStatus
Definition messages.hpp:491
static constexpr std::uint8_t kMaxNotional
Definition messages.hpp:490
static constexpr std::uint8_t kRefusal
Definition messages.hpp:493
std::uint8_t pad_[13]
-> 128
Definition messages.hpp:504
Qty min_qty
80
Definition messages.hpp:497
TradingStatus status
112
Definition messages.hpp:501
Notional max_notional
104
Definition messages.hpp:500
static constexpr std::uint8_t kMinNotional
Definition messages.hpp:489
static constexpr std::uint8_t kRefresh
Definition messages.hpp:492
Definition messages.hpp:696
std::uint8_t pad_[8]
Definition messages.hpp:706
std::int64_t max_ns
Definition messages.hpp:705
std::int64_t p90_ns
Definition messages.hpp:702
EventHeader hdr
Definition messages.hpp:697
std::int64_t p99_ns
Definition messages.hpp:703
std::uint8_t pad0_[7]
Definition messages.hpp:699
std::uint64_t count
Definition messages.hpp:700
std::int64_t p999_ns
Definition messages.hpp:704
std::uint8_t interval
LatencyInterval index.
Definition messages.hpp:698
std::int64_t p50_ns
Definition messages.hpp:701
One price level. Shared by book messages and the L2 book.
Definition messages.hpp:31
constexpr bool operator==(const Level &) const noexcept=default
Price price
Definition messages.hpp:32
Qty qty
Definition messages.hpp:33
Options ticker (EventType::OptionTicker): the venue's mark, implied volatilities and greeks for one o...
Definition messages.hpp:246
double vega
128
Definition messages.hpp:256
double ask_iv
104
Definition messages.hpp:253
std::uint8_t pad_[32]
160
Definition messages.hpp:260
Price index_price
80
Definition messages.hpp:250
double delta
112
Definition messages.hpp:254
EventHeader hdr
Definition messages.hpp:247
double gamma
120
Definition messages.hpp:255
Price underlying_price
72
Definition messages.hpp:249
double theta
136
Definition messages.hpp:257
double bid_iv
96
Definition messages.hpp:252
double mark_iv
88
Definition messages.hpp:251
double rho
144
Definition messages.hpp:258
Price mark_price
64
Definition messages.hpp:248
double interest_rate
152 annualised decimal
Definition messages.hpp:259
Definition messages.hpp:267
std::uint8_t flags
Definition messages.hpp:276
static constexpr std::uint8_t kAmendedInPlace
The venue amended the resting order in place (Binance Spot order.amend.keepPriority,...
Definition messages.hpp:271
VenueOrderId venue_order_id
Definition messages.hpp:275
ClientOrderId cl_ord_id
Definition messages.hpp:274
std::uint8_t pad_[14]
Definition messages.hpp:277
EventHeader hdr
Definition messages.hpp:273
Definition messages.hpp:898
EventHeader hdr
Definition messages.hpp:899
Price price
Definition messages.hpp:901
Qty qty
Definition messages.hpp:902
std::uint8_t pad_[39]
Definition messages.hpp:904
Side side
Definition messages.hpp:903
std::uint64_t order_ref
Definition messages.hpp:900
Definition messages.hpp:292
Qty cum_qty
filled before the cancel took effect
Definition messages.hpp:297
VenueOrderId venue_order_id
Definition messages.hpp:295
std::uint8_t pad0_[7]
Definition messages.hpp:296
EventHeader hdr
Definition messages.hpp:293
ClientOrderId cl_ord_id
Definition messages.hpp:294
Definition messages.hpp:924
std::uint8_t pad_[48]
Definition messages.hpp:928
EventHeader hdr
Definition messages.hpp:925
std::uint64_t order_ref
Definition messages.hpp:926
Qty canceled_qty
zero -> delete the whole order
Definition messages.hpp:927
Definition messages.hpp:301
EventHeader hdr
Definition messages.hpp:302
ClientOrderId cl_ord_id
Definition messages.hpp:303
std::int32_t venue_code
Definition messages.hpp:306
FixedString< 40 > text
Definition messages.hpp:307
std::uint8_t pad0_[3]
Definition messages.hpp:305
RejectReason reason
VenueUnknownOrder => the venue has no such order.
Definition messages.hpp:304
std::uint8_t pad_[7]
Definition messages.hpp:308
Definition messages.hpp:908
Price exec_price
zero -> at the order's price
Definition messages.hpp:915
std::uint64_t match_id
Definition messages.hpp:916
std::uint8_t exec_flags
Definition messages.hpp:917
bool printable() const noexcept
Definition messages.hpp:920
std::uint64_t order_ref
Definition messages.hpp:913
EventHeader hdr
Definition messages.hpp:912
static constexpr std::uint8_t kNonPrintable
exec_flags. Zero (E, and records written before the field existed) is a printable execution.
Definition messages.hpp:910
Qty exec_qty
Definition messages.hpp:914
std::uint8_t pad_[31]
Definition messages.hpp:918
Definition messages.hpp:340
ClientOrderId cl_ord_id
Definition messages.hpp:342
VenueOrderId venue_order_id
Definition messages.hpp:343
Qty cum_qty
Definition messages.hpp:345
EventHeader hdr
Definition messages.hpp:341
std::uint8_t pad0_[7]
Definition messages.hpp:344
Definition messages.hpp:312
ExecId exec_id
dedupe key
Definition messages.hpp:325
std::uint8_t pad_[52]
Definition messages.hpp:336
FeeAsset fee_asset
Quote: fee is a quote amount; Base: base units; Other: not convertible.
Definition messages.hpp:334
static constexpr std::uint8_t kReplayed
The execution comes from the venue's trade history (Venue::request_executions), not from the private ...
Definition messages.hpp:316
Qty leaves_qty
Definition messages.hpp:330
Liquidity liquidity
Definition messages.hpp:333
Qty cum_qty
cumulative after this execution (0 with kReplayed: the venue did not say)
Definition messages.hpp:329
Notional fee
>= 0 paid, < 0 rebate; in units of fee_asset
Definition messages.hpp:331
std::uint8_t flags
kReplayed, kUnresolved
Definition messages.hpp:335
std::uint8_t pad0_[6]
Definition messages.hpp:326
VenueOrderId venue_order_id
Definition messages.hpp:324
EventHeader hdr
Definition messages.hpp:322
Side side
Definition messages.hpp:332
ClientOrderId cl_ord_id
Definition messages.hpp:323
Price price
Definition messages.hpp:327
static constexpr std::uint8_t kUnresolved
A replayed execution naming no order whose order the connector could not look up yet and will ask for...
Definition messages.hpp:321
Qty qty
this execution
Definition messages.hpp:328
Definition messages.hpp:281
EventHeader hdr
Definition messages.hpp:282
FixedString< 40 > text
Definition messages.hpp:287
std::int32_t venue_code
Definition messages.hpp:286
ClientOrderId cl_ord_id
Definition messages.hpp:283
std::uint8_t pad_[7]
Definition messages.hpp:288
std::uint8_t pad0_[3]
Definition messages.hpp:285
RejectReason reason
Definition messages.hpp:284
Definition messages.hpp:932
std::uint64_t old_order_ref
Definition messages.hpp:934
Price price
Definition messages.hpp:936
std::uint8_t pad_[32]
Definition messages.hpp:938
std::uint64_t new_order_ref
Definition messages.hpp:935
EventHeader hdr
Definition messages.hpp:933
Qty qty
Definition messages.hpp:937
Definition messages.hpp:876
EventHeader hdr
Definition messages.hpp:877
VenueOrderId venue_order_id
may be empty if not yet acked
Definition messages.hpp:879
std::uint8_t pad_[15]
Definition messages.hpp:880
ClientOrderId cl_ord_id
Definition messages.hpp:878
Definition messages.hpp:862
std::uint8_t reduce_only
Definition messages.hpp:870
Price price
Definition messages.hpp:865
std::uint8_t pad_[35]
Definition messages.hpp:872
Qty qty
Definition messages.hpp:866
std::uint8_t arm
the [ab] arm it was sent under: 0 none, k + 1 arm k (Order::arm)
Definition messages.hpp:871
OrderType type
Definition messages.hpp:868
ClientOrderId cl_ord_id
Definition messages.hpp:864
Side side
Definition messages.hpp:867
TimeInForce tif
Definition messages.hpp:869
EventHeader hdr
Definition messages.hpp:863
Definition messages.hpp:884
std::uint8_t arm
the [ab] arm it was sent under: 0 none, k + 1 arm k (Order::arm)
Definition messages.hpp:892
Qty qty
Definition messages.hpp:891
ClientOrderId cl_ord_id
new id
Definition messages.hpp:886
ClientOrderId orig_cl_ord_id
order being replaced
Definition messages.hpp:887
std::uint8_t pad0_[7]
Definition messages.hpp:889
EventHeader hdr
Definition messages.hpp:885
Price price
Definition messages.hpp:890
VenueOrderId venue_order_id
Definition messages.hpp:888
std::uint8_t pad_[47]
Definition messages.hpp:893
New strategy parameter values (ADR-0013): up to kMaxFields (field index, raw value) pairs,...
Definition messages.hpp:795
Origin
Definition messages.hpp:802
@ Experiment
the [ab] test: an arm's parameters at a block boundary, a stop, a promote
@ Strategy
the strategy's own publisher (a slow tier, a model), or not recorded
@ Control
the control socket (fastmm-ctl param)
@ Config
[strategy.overrides], at the start of the session
std::uint32_t count
pairs used
Definition messages.hpp:814
bool resets() const noexcept
The update drops the instruments' own values of the parameters it names (kReset).
Definition messages.hpp:827
static constexpr std::uint8_t kReset
flags.
Definition messages.hpp:811
std::uint8_t pad1_[8]
Definition messages.hpp:822
bool all_instruments() const noexcept
Definition messages.hpp:825
std::uint8_t arm
kArmKeep, kArmNone or arm + 1
Definition messages.hpp:816
std::int64_t value[kMaxFields]
raw value of each pair
Definition messages.hpp:823
std::uint16_t field[kMaxFields]
schema index of each pair
Definition messages.hpp:820
static constexpr std::uint8_t kArmKeep
Definition messages.hpp:798
static constexpr std::size_t kMaxFields
Definition messages.hpp:796
static constexpr InstrumentId kAllInstruments
hdr.instrument of an update for every instrument: the invalid id.
Definition messages.hpp:801
void set_source(std::string_view s) noexcept
Copies s into source, cut to kSourceLen - 1 bytes.
Definition messages.hpp:836
static constexpr std::uint8_t kArmNone
Definition messages.hpp:799
static constexpr std::size_t kSourceLen
source, NUL-terminated
Definition messages.hpp:797
Origin origin
Definition messages.hpp:815
std::string_view source_view() const noexcept
Definition messages.hpp:830
char source[kSourceLen]
who asked for it, e.g. "manual", "scheduled:drain"
Definition messages.hpp:821
std::uint8_t pad0_[1]
Definition messages.hpp:818
std::uint8_t flags
kReset
Definition messages.hpp:817
std::uint64_t publish_seq
the publisher's sequence number, from 1
Definition messages.hpp:819
EventHeader hdr
Definition messages.hpp:813
Definition messages.hpp:153
static PartyId of_account(std::uint64_t id) noexcept
Definition messages.hpp:167
static PartyId of_address(std::span< const std::uint8_t > raw) noexcept
Empty when raw is longer than kMaxBytes.
Definition messages.hpp:175
PartyIdKind kind
Definition messages.hpp:155
std::uint8_t bytes[kMaxBytes]
Definition messages.hpp:157
std::uint64_t account() const noexcept
The account id; 0 for another kind.
Definition messages.hpp:161
constexpr bool known() const noexcept
Definition messages.hpp:159
std::span< const std::uint8_t > raw() const noexcept
Definition messages.hpp:166
constexpr bool operator==(const PartyId &) const noexcept=default
std::uint8_t len
bytes used: 8 for an Account, the address's length for an Address
Definition messages.hpp:156
static constexpr std::size_t kMaxBytes
Definition messages.hpp:154
The venue's reference prices and funding of one derivative (EventType::PerpState),...
Definition messages.hpp:457
Duration funding_interval
88
Definition messages.hpp:466
std::uint8_t pad_[15]
-> 128
Definition messages.hpp:470
static constexpr std::uint8_t kOpenInterest
Definition messages.hpp:461
Price mark_price
64
Definition messages.hpp:463
Qty open_interest
104
Definition messages.hpp:468
Timestamp next_funding
96
Definition messages.hpp:467
EventHeader hdr
Definition messages.hpp:462
Price index_price
72
Definition messages.hpp:464
static constexpr std::uint8_t kMark
Definition messages.hpp:458
double funding_rate
80
Definition messages.hpp:465
static constexpr std::uint8_t kFunding
Definition messages.hpp:460
static constexpr std::uint8_t kIndex
Definition messages.hpp:459
std::uint8_t fields
112
Definition messages.hpp:469
Definition messages.hpp:349
Notional unrealized
Definition messages.hpp:354
std::uint8_t pad_[24]
Definition messages.hpp:356
EventHeader hdr
Definition messages.hpp:350
Qty qty
signed net position
Definition messages.hpp:351
Price avg_px
Definition messages.hpp:352
Notional realized
Definition messages.hpp:353
Notional fees
Definition messages.hpp:355
Definition position.hpp:20
Control thread injects the venue's view after a reconnect (5.8).
Definition messages.hpp:668
std::uint8_t pad1_[7]
Definition messages.hpp:684
EventHeader hdr
Definition messages.hpp:677
std::uint8_t pad_[15]
Definition messages.hpp:692
Qty cum_qty
Definition messages.hpp:687
Kind kind
Definition messages.hpp:678
Side side
Definition messages.hpp:679
std::uint8_t flags
Kind::Begin: kSentWatermark.
Definition messages.hpp:691
ClientOrderId sent_watermark
Kind::Begin, valid with kSentWatermark.
Definition messages.hpp:690
Kind
Definition messages.hpp:669
OrderState state
Definition messages.hpp:680
Price price
Definition messages.hpp:685
static constexpr std::uint8_t kExecutionsExact
Begin: every execution the venue made since the last one the engine booked was replayed before this s...
Definition messages.hpp:676
static constexpr std::uint8_t kSentWatermark
Definition messages.hpp:670
Qty position_qty
Kind::Position.
Definition messages.hpp:688
ClientOrderId cl_ord_id
Definition messages.hpp:682
VenueOrderId venue_order_id
Definition messages.hpp:683
std::uint8_t pad0_[5]
Definition messages.hpp:681
Price avg_px
Kind::Position.
Definition messages.hpp:689
Qty orig_qty
Definition messages.hpp:686
Definition risk_limits.hpp:18
A record of a recorded session in the stream of a source that follows its journal,...
Definition messages.hpp:435
EventHeader hdr
Definition messages.hpp:436
const EventHeader & record() const noexcept
Definition messages.hpp:437
One open order in a StrategyStateMsg's kOrdersPart: on the account (venue) it went to,...
Definition messages.hpp:760
std::uint32_t instrument
Definition messages.hpp:762
std::int64_t leaves_raw
Definition messages.hpp:768
std::uint8_t flags
Order::flags.
Definition messages.hpp:766
std::uint8_t venue
Definition messages.hpp:763
std::uint8_t state
OrderState.
Definition messages.hpp:765
std::uint8_t side
Side.
Definition messages.hpp:764
std::int64_t price_raw
Definition messages.hpp:767
std::uint64_t cl_ord_id
Definition messages.hpp:761
One instrument's position in a StrategyStateMsg's kPositionsPart: on the account (venue) whose Reconc...
Definition messages.hpp:749
std::uint8_t venue
Definition messages.hpp:751
std::int64_t avg_px_raw
Definition messages.hpp:754
std::int64_t qty_raw
Definition messages.hpp:753
std::uint32_t instrument
Definition messages.hpp:750
std::uint8_t pad_[3]
Definition messages.hpp:752
Journal only: what a replay or a backtest over the journal can start from.
Definition messages.hpp:720
std::uint32_t bytes
after the head
Definition messages.hpp:731
static constexpr std::uint8_t kOrdersPart
Definition messages.hpp:724
std::uint8_t pad_[36]
Definition messages.hpp:737
std::uint64_t id
Definition messages.hpp:728
EventHeader hdr
Definition messages.hpp:727
static constexpr std::uint8_t kAccepted
Definition messages.hpp:725
Kind kind
Definition messages.hpp:732
static constexpr std::uint8_t kStatePart
Definition messages.hpp:722
static constexpr std::uint32_t size_for(std::uint32_t n) noexcept
Definition messages.hpp:738
std::uint32_t version
Definition messages.hpp:736
std::uint32_t total
bytes of the part
Definition messages.hpp:729
const std::byte * data() const noexcept
Definition messages.hpp:741
std::uint8_t part
Definition messages.hpp:733
std::uint8_t flags
Definition messages.hpp:734
static constexpr std::uint32_t kChunkBytes
Definition messages.hpp:726
Kind
Definition messages.hpp:721
std::uint8_t pad0_
Definition messages.hpp:735
static constexpr std::uint8_t kPositionsPart
Definition messages.hpp:723
std::uint32_t offset
of this record's bytes in the part
Definition messages.hpp:730
constexpr bool valid() const noexcept
Definition strong_id.hpp:31
Definition messages.hpp:515
std::uint64_t user_data
Definition messages.hpp:520
std::uint8_t engine
1: the engine's own timer (max_param_age), not the strategy's
Definition messages.hpp:518
TimerId timer_id
Definition messages.hpp:517
Timestamp fire_ts
Definition messages.hpp:521
std::uint8_t pad0_[3]
Definition messages.hpp:519
EventHeader hdr
Definition messages.hpp:516
std::uint8_t pad_[40]
Definition messages.hpp:522
Definition time.hpp:45
A trade whose venue names the buyer and the seller carries them in the 64 bytes after the message: hd...
Definition messages.hpp:200
bool has_aggressor() const noexcept
Definition messages.hpp:214
static constexpr std::uint8_t kNoAggressor
pad_[0]: the venue does not say which side took liquidity (a CME trade with AggressorSide 0,...
Definition messages.hpp:205
void set_parties(const TradeParties &p) noexcept
Definition messages.hpp:221
std::uint8_t pad_[39]
pad_[0]: kNoAggressor
Definition messages.hpp:212
EventHeader hdr
Definition messages.hpp:207
const TradeParties * parties() const noexcept
Definition messages.hpp:216
Price price
Definition messages.hpp:208
Side aggressor
Definition messages.hpp:211
std::uint64_t trade_id
Definition messages.hpp:210
Qty qty
Definition messages.hpp:209
static constexpr std::uint32_t kSizeWithParties
Definition messages.hpp:201
Definition messages.hpp:187
constexpr bool operator==(const TradeParties &) const noexcept=default
PartyId seller
Definition messages.hpp:189
PartyId buyer
Definition messages.hpp:188
Time primitives.