FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
messages.hpp File Reference

Event bus message structs (5.5). More...

#include "fastmm/core/config_macros.hpp"
#include "fastmm/core/enums.hpp"
#include "fastmm/core/fixed_point.hpp"
#include "fastmm/core/fixed_string.hpp"
#include "fastmm/core/risk_limits.hpp"
#include "fastmm/core/strong_id.hpp"
#include "fastmm/core/time.hpp"
#include <cstddef>
#include <cstdint>
#include <span>
#include <string_view>
#include <type_traits>

Go to the source code of this file.

Classes

struct  fastmm::Level
 One price level. Shared by book messages and the L2 book. More...
 
struct  fastmm::EventHeader
 
struct  fastmm::BookDeltaMsg
 Bids then asks follow the fixed part as a flexible array of Level (bid_count + ask_count). More...
 
struct  fastmm::TradeMsg
 
struct  fastmm::BookTickerMsg
 
struct  fastmm::OptionTickerMsg
 Options ticker (EventType::OptionTicker): the venue's mark, implied volatilities and greeks for one option instrument. More...
 
struct  fastmm::OrderAckMsg
 
struct  fastmm::OrderRejectMsg
 
struct  fastmm::OrderCancelAckMsg
 
struct  fastmm::OrderCancelRejectMsg
 
struct  fastmm::OrderFillMsg
 
struct  fastmm::OrderExpiredMsg
 
struct  fastmm::PositionUpdateMsg
 
struct  fastmm::FundingMsg
 A perpetual funding payment the venue booked on the account's position in hdr.instrument (EventType::Funding). More...
 
struct  fastmm::BalanceMsg
 The account's holding of one asset on one venue (EventType::Balance), as the venue reports it at its time hdr.exch_ts. More...
 
struct  fastmm::PerpStateMsg
 The venue's reference prices and funding of one derivative (EventType::PerpState), from its public market data. More...
 
struct  fastmm::TimerMsg
 
struct  fastmm::ControlMsg
 
struct  fastmm::ControlLimitsMsg
 ControlCommand::SetLimits: a ControlMsg with the new limits after it. More...
 
struct  fastmm::ControlUnderlyingMsg
 ControlCommand::SetUnderlyingLimit: a ControlMsg whose arg is the new max_net (raw Qty, base units; 0 lifts the limit) of the underlying at index underlying of the session's plan (core/underlying.hpp), named in name for the log and a journal reader. More...
 
struct  fastmm::ControlTransferMsg
 ControlCommand::Transfer: one step of a pool treasury's transfer (core/treasury.hpp), on the treasury's ring into the engine, which journals it. More...
 
struct  fastmm::ConnectionStateMsg
 
struct  fastmm::ReconcileMsg
 Control thread injects the venue's view after a reconnect (5.8). More...
 
struct  fastmm::LatencySampleMsg
 
struct  fastmm::StrategyStateMsg
 Journal only: what a replay or a backtest over the journal can start from. More...
 
struct  fastmm::StatePosition
 One instrument's position in a StrategyStateMsg's kPositionsPart: on the account (venue) whose Reconcile Position would set it. More...
 
struct  fastmm::EngineTimeMsg
 Journal only (format v2): the engine clock as an absolute value. More...
 
struct  fastmm::ParamUpdateMsg
 New strategy parameter values (ADR-0013): up to kMaxFields (field index, raw value) pairs, built and validated off the engine thread (strategies/param_publisher.hpp). More...
 
struct  fastmm::OutNewOrderMsg
 
struct  fastmm::OutCancelMsg
 
struct  fastmm::OutReplaceMsg
 
struct  fastmm::OrderAddL3Msg
 
struct  fastmm::OrderExecL3Msg
 
struct  fastmm::OrderCancelL3Msg
 
struct  fastmm::OrderReplaceL3Msg
 

Namespaces

namespace  fastmm
 

Concepts

concept  fastmm::MessageLike
 Every message: trivially copyable with the EventHeader first.
 
concept  fastmm::FixedSizeMessage
 

Typedefs

using fastmm::BookSnapshotMsg = BookDeltaMsg
 same layout; hdr.type == BookSnapshot, kSnapshot set
 

Functions

template<class M >
constexpr void fastmm::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().
 
constexpr std::uint8_t fastmm::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.
 
template<MessageLike M>
FASTMM_FORCE_INLINE const M & fastmm::msg_cast (const EventHeader *h) noexcept
 

Variables

constexpr std::uint8_t fastmm::kMessageVersion = 1
 
constexpr std::string_view fastmm::kFundingIdPrefix = "funding:"
 A funding id in the list of venue ids a restarted session's store already holds (store::Recovery::VenueResume::known_exec_ids, next to the trade ids): the prefix keeps the two id spaces apart.
 
constexpr std::uint64_t fastmm::kTripKillPlannedStop = 1
 ControlCommand::TripKill's arg for a stop that was asked for (fastmm-live's --duration, a signal, fastmm-ctl stop): the engine pulls its quotes and cancels as for any trip, and logs it as a stop.
 
constexpr std::uint32_t fastmm::kMaxBookLevelsPerMsg = 1024
 Largest fixed-size message; BookDelta is bounded separately by kMaxBookLevelsPerMsg.
 
constexpr std::uint32_t fastmm::kMaxMsgBytes
 

Detailed Description

Event bus message structs (5.5).

Every message:

  • starts with a 64-byte EventHeader whose first 4 bytes are the total length and 5th byte the EventType (MsgRing protocol),
  • is trivially copyable with sizeof a multiple of 64 (explicit padding),
  • carries a version so journals remain readable across layout changes.

Messages are constructed in place inside a ring/journal buffer; use init_header().