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

Record stream: the engine's second outbound queue, next to the journal. More...

#include "fastmm/core/capacity_price.hpp"
#include "fastmm/core/config_macros.hpp"
#include "fastmm/core/enums.hpp"
#include "fastmm/core/fixed_point.hpp"
#include "fastmm/core/messages.hpp"
#include "fastmm/core/msg_ring.hpp"
#include "fastmm/core/order.hpp"
#include "fastmm/core/position.hpp"
#include "fastmm/core/risk_limits.hpp"
#include "fastmm/core/strong_id.hpp"
#include "fastmm/core/time.hpp"
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <string_view>
#include <type_traits>

Go to the source code of this file.

Classes

struct  fastmm::RecordHeader
 
struct  fastmm::FillRecord
 One execution. More...
 
struct  fastmm::OrderRecord
 The OMS record after a transition. More...
 
struct  fastmm::PositionRecord
 One instrument's position and the portfolio totals at the same instant. More...
 
struct  fastmm::FundingRecord
 A funding payment the engine booked (FundingMsg): amount in the instrument's settlement currency, negative paid. More...
 
struct  fastmm::KillRecord
 A kill switch trip. hdr.flags & kVenue marks a per-venue trip (hdr.venue names it). More...
 
struct  fastmm::ReplayedRecord
 A venue's execution replay ended complete (a reconciliation began with ReconcileMsg::kExecutionsExact): every execution the venue made before it is in the records before this one. More...
 
struct  fastmm::ParamRecord
 A strategy parameter update the engine applied (ParamUpdateMsg): after the header, the message's bytes past its own header, so the fields sit at the same offsets. More...
 
struct  fastmm::LimitsRecord
 An operator's limits command the engine applied (ControlCommand::SetLimits or SetUnderlyingLimit): the [risk] limits and check_balance before and after it, or one underlying's max_net. More...
 
struct  fastmm::RejectRecord
 One order refused: by the pre-trade checks (the engine's) or by its venue (an OrderReject), with the account's order budget as the engine saw it then (ctx.order_budget). More...
 
struct  fastmm::MarkoutRecord
 The instrument's mid horizon_ms after one of its fills, 0 at the fill ([engine] markout_ms). More...
 
struct  fastmm::CapacityRecord
 A minute of one account's capacity price ([capacity], core/capacity_price.hpp): the actions priced, those refused below their price and those that would have been (observe), and the price paid. More...
 
struct  fastmm::ContextNamesRecord
 The names the strategy gave the values of its quote context (StrategyContext:: quote_context_names), in slot order; an empty name leaves a slot unnamed. More...
 
class  fastmm::RecordWriter
 Engine-side producer. More...
 

Namespaces

namespace  fastmm
 

Enumerations

enum class  fastmm::RecordType : std::uint8_t {
  fastmm::Fill = 1 , fastmm::Order = 2 , fastmm::Position = 3 , fastmm::Kill = 4 ,
  fastmm::Funding = 5 , fastmm::Replayed = 6 , fastmm::Param = 7 , fastmm::Reject = 8 ,
  fastmm::Limits = 9 , fastmm::Markout = 10 , fastmm::Capacity = 11 , fastmm::ContextNames = 12
}
 Never 0: the ring reserves type 0 for padding. More...
 
enum class  fastmm::RejectSource : std::uint8_t {
  fastmm::Risk = 0 , fastmm::RiskBucket = 1 , fastmm::AccountPaused = 2 , fastmm::AccountOrders10s = 3 ,
  fastmm::AccountOrders1m = 4 , fastmm::AccountOrders1d = 5 , fastmm::VenueLocal = 6 , fastmm::Venue = 7 ,
  fastmm::Capacity = 8
}
 What refused an order (RejectRecord::source): the limit behind a rate-limit refusal, or the side that refused it otherwise. More...
 

Functions

constexpr std::string_view fastmm::to_string (RecordType t) noexcept
 
constexpr std::string_view fastmm::to_string (RejectSource s) noexcept
 

Variables

constexpr std::uint8_t fastmm::kRecordVersion = 1
 

Detailed Description

Record stream: the engine's second outbound queue, next to the journal.

engine thread --RecordWriter--> MsgRing --store thread--> a storage backend

The journal is the byte-exact stream a replay consumes; this is the interpreted one, the fills, orders, positions and kill events a store turns into rows. Both are written the same way: the engine copies a trivially copyable record into an SPSC ring and never waits. A full ring drops the record and counts it (EngineStats::records_dropped); nothing in the trading path depends on a record being consumed, so a slow or broken store cannot stall or kill a session. The journal is the authority for anything a drop lost (docs/reference/storage.md).

Records share the MsgRing prefix (4-byte length, 1-byte non-zero type) and are a multiple of 64 bytes, like the event messages, but they carry their own RecordType space and version: the store format is free to change without touching the journal format.