Slick Sim 0.10.1
Exchange simulator that shadows real venues for risk-free strategy testing
Loading...
Searching...
No Matches
slick::sim::md_feed::ReplayGate Class Reference

Whether a pcap replay has been started. More...

#include <md_feed/replay_gate.hpp>

Collaboration diagram for slick::sim::md_feed::ReplayGate:

Public Member Functions

 ReplayGate (std::function< uint64_t()> position={})
 position returns the md_queue's write index (see slick::queue::initial_reading_index), called on the exchange thread when the gate opens.
void open () noexcept
 Exchange thread, after its last write to md_queue for the held book.
bool is_open_at (uint64_t index) const noexcept
 True once open, for a publisher that is about to read the md_queue frame at index.
bool is_open () const noexcept

Detailed Description

Whether a pcap replay has been started.

Closed while the book is built, so the market-data publisher sends no market data; opened once, by the exchange thread, when a client starts the replay, after which every instrument is published. Read from the publisher's thread.

The publisher runs behind the exchange thread, so the frames written to md_queue while the book was built may still be waiting when the gate opens. The gate therefore records where the queue's write position was, and the publisher treats it as open only for the frames from there on: what was written before describes the held book, and goes out as the snapshot, not as updates.

Definition at line 21 of file replay_gate.hpp.

Constructor & Destructor Documentation

◆ ReplayGate()

slick::sim::md_feed::ReplayGate::ReplayGate ( std::function< uint64_t()> position = {})
inlineexplicit

position returns the md_queue's write index (see slick::queue::initial_reading_index), called on the exchange thread when the gate opens.

Without it the gate opens for every frame, which is right where nothing is queued.

Definition at line 26 of file replay_gate.hpp.

Member Function Documentation

◆ is_open()

bool slick::sim::md_feed::ReplayGate::is_open ( ) const
inlinenodiscardnoexcept

Definition at line 43 of file replay_gate.hpp.

◆ is_open_at()

bool slick::sim::md_feed::ReplayGate::is_open_at ( uint64_t index) const
inlinenodiscardnoexcept

True once open, for a publisher that is about to read the md_queue frame at index.

Definition at line 39 of file replay_gate.hpp.

◆ open()

void slick::sim::md_feed::ReplayGate::open ( )
inlinenoexcept

Exchange thread, after its last write to md_queue for the held book.

Opening an open gate does nothing: the publisher may be reading open_index_, so it is written once.

Definition at line 30 of file replay_gate.hpp.


The documentation for this class was generated from the following file: