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

BookSyncer: venue-agnostic snapshot/delta synchronisation FSM (5.4), instantiated per instrument on the net thread. More...

#include "fastmm/core/config_macros.hpp"
#include "fastmm/core/messages.hpp"
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <memory>

Go to the source code of this file.

Classes

struct  fastmm::BinanceSpotSyncTraits
 Binance Spot: snapshot via REST (lastUpdateId = L). More...
 
struct  fastmm::BinanceFuturesSyncTraits
 Binance USDT-M futures: first applied delta must have U <= L and u >= L; afterwards each delta's pu must equal the previous delta's u. More...
 
struct  fastmm::BybitSyncTraits
 Bybit v5: the stream itself sends a snapshot first (kSnapshot flag), then deltas whose u must be strictly increasing; u == 1 means the venue restarted the book (treated as a snapshot marker -> resubscribe). More...
 
class  fastmm::BookSyncer< Traits, Sink >
 

Namespaces

namespace  fastmm
 

Enumerations

enum class  fastmm::SyncState : std::uint8_t { fastmm::Idle = 0 , fastmm::Buffering = 1 , fastmm::Synced = 2 , fastmm::Resync = 3 }
 
enum class  fastmm::SyncReason : std::uint8_t {
  fastmm::None = 0 , fastmm::SequenceGap = 1 , fastmm::BufferOverflow = 2 , fastmm::SnapshotTooOld = 3 ,
  fastmm::Explicit = 4 , fastmm::SnapshotMarker = 5 , fastmm::ChecksumMismatch = 6
}
 

Functions

constexpr const char * fastmm::to_string (SyncReason r) noexcept
 
constexpr const char * fastmm::to_string (SyncState s) noexcept
 

Detailed Description

BookSyncer: venue-agnostic snapshot/delta synchronisation FSM (5.4), instantiated per instrument on the net thread.

Venue rules are supplied by SyncTraits; the engine only ever sees normalised BookSnapshot / BookDelta events, so replay is protocol-free.

Idle --start()--> Buffering --snapshot ok--> Synced --gap--> Resync --start()--> Buffering

Sink interface (a struct or lambda-holder): void on_snapshot(const BookDeltaMsg&) // kSnapshot set void on_delta(const BookDeltaMsg&) void on_resync(SyncReason) // emitted before the next snapshot request void request_snapshot() // REST fetch (venues with kNeedsRestSnapshot)

Buffered deltas are copied into a fixed byte arena (no allocation after construction).