|
ITCHCPP 1.6.0
High-Performance NASDAQ TotalView-ITCH 5.0 Parser & Market-Data Platform
|
Replays a parsed ITCH stream paced by message timestamps. More...
#include <replay.hpp>
Public Member Functions | |
| ReplayEngine (double speed_multiplier=1.0) noexcept | |
| Constructs an engine with a speed multiplier. | |
| auto | set_speed (double speed_multiplier) noexcept -> void |
| Sets the speed multiplier (see the constructor). | |
| auto | speed () const noexcept -> double |
| The current speed multiplier. | |
| auto | replay (std::span< const std::byte > data, const MessageCallback &callback) const -> std::uint64_t |
Parses data and invokes callback for each message, paced by the message timestamps. | |
Replays a parsed ITCH stream paced by message timestamps.
For realistic backtesting and system simulation, a consumer often needs the feed delivered at its original wall-clock cadence rather than as fast as the CPU can parse it. The replay engine parses a buffer and invokes the callback for each message, sleeping between messages so the inter-message gaps match the differences in their nanoseconds-past-midnight timestamps, optionally scaled by a speed factor.
Definition at line 27 of file replay.hpp.
|
inlineexplicitnoexcept |
Constructs an engine with a speed multiplier.
| speed_multiplier | Wall-clock speed relative to the original feed: 1.0 replays in real time, 2.0 twice as fast, 0.5 half speed. A value less than or equal to 0 replays with no pacing (as fast as possible). |
Definition at line 34 of file replay.hpp.
|
inlinenoexcept |
Sets the speed multiplier (see the constructor).
| speed_multiplier | Wall-clock speed relative to the original feed (see the constructor for the exact semantics). |
Definition at line 41 of file replay.hpp.
|
inlinenoexcept |
The current speed multiplier.
Definition at line 48 of file replay.hpp.
| auto itch::ReplayEngine::replay | ( | std::span< const std::byte > | data, |
| const MessageCallback & | callback | ||
| ) | const -> std::uint64_t |
Parses data and invokes callback for each message, paced by the message timestamps.
| data | A view over the contiguous buffer containing ITCH data. |
| callback | A function to be called for each successfully parsed message. |
Definition at line 18 of file replay.cpp.
References itch::Parser::parse().