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

Namespaces

namespace  detail

Classes

class  MDFeed
struct  packet_feed_traits
 Counts the queue bytes a receiver overwrote before the exchange thread drained them. More...
class  MulticastPacketFeed
 The transport half of a live multicast feed: one receiver thread that polls every joined group ("line"), handing the packets to the exchange thread through one lock-free queue. More...
class  PcapControlServer
 The channel between a pcap replay and its clients, apart from the market data (multicast) and the orders (the TCP order gateway), neither of which can say that the book is still loading or ask for the replay to begin. More...
struct  PcapFeedConfig
 What a pcap feed's config entry says, beyond its venue's multicast groups. More...
class  PcapFeedBase
 A venue's market data replayed from captured multicast, behind a control channel. More...
struct  PcapPacket
 One UDP datagram read from a capture. More...
class  PcapReader
 Reads UDP payloads, in capture order, out of one pcap or pcapng file. More...
struct  PcapLine
 One multicast group of a replay, as the venue knows it (an enum value below MulticastPacketFeed::MAX_LINES, like the live feeds). More...
class  PcapReplaySource
 Replays several captured multicast groups as one packet stream in capture-time order. More...
class  ReplayPacer
 Decides when a packet captured at some time is due, on the wall clock. More...
class  ReplayGate
 Whether a pcap replay has been started. More...
class  ReplayGateView
 A publisher channel's view of the gate: whether it may publish yet, for the md_queue frame it is working on. More...
class  CoinbaseLiveWSFeed
struct  HyperliquidFeedCallbacks
class  HyperliquidLiveWSFeed

Enumerations

enum class  FeedKind : uint8_t { LIVE , PCAP }
 Where a feed's market data comes from. More...

Functions

constexpr const char * kind_name (FeedKind kind) noexcept
 As the CLI lists it.
uint64_t parse_utc_time_ns (const std::string &text)
 Parses a UTC "YYYY-MM-DDTHH:MM:SS[.fraction][Z]" into nanoseconds since the epoch.
std::vector< PcapLine > parse_pcap_lines (const nlohmann::json &config, std::span< const std::pair< const char *, uint8_t > > keys)
 The multicast groups of a pcap feed's config: for each {key, line} that the config names, { "address", "port" } and optionally "path" (one capture file, used instead of the root directory's layout) or "paths" (several, oldest first).
uint32_t parse_ipv4 (const std::string &text)
 Packs a dotted quad such as "224.0.31.1" into host byte order, the form PcapPacket::dst_addr uses.
std::vector< std::string > resolve_pcap_files (const std::string &root, const std::string &address, uint16_t port, uint64_t begin_ns, uint64_t end_ns)
 The capture files of group address:port that can hold packets in [begin_ns, end_ns].

Enumeration Type Documentation

◆ FeedKind

enum class slick::sim::md_feed::FeedKind : uint8_t
strong

Where a feed's market data comes from.

Enumerator
LIVE 

The venue, as it happens.

PCAP 

Recorded captures.

Definition at line 13 of file md_feed.hpp.

Function Documentation

◆ kind_name()

const char * slick::sim::md_feed::kind_name ( FeedKind kind)
nodiscardconstexprnoexcept

As the CLI lists it.

Definition at line 19 of file md_feed.hpp.

References PCAP.

Referenced by slick::sim::exch::list_feeds().

◆ parse_ipv4()

uint32_t slick::sim::md_feed::parse_ipv4 ( const std::string & text)
inlinenodiscard

Packs a dotted quad such as "224.0.31.1" into host byte order, the form PcapPacket::dst_addr uses.

Throws on anything else.

Definition at line 39 of file pcap_reader.hpp.

◆ parse_pcap_lines()

std::vector< PcapLine > slick::sim::md_feed::parse_pcap_lines ( const nlohmann::json & config,
std::span< const std::pair< const char *, uint8_t > > keys )
nodiscard

The multicast groups of a pcap feed's config: for each {key, line} that the config names, { "address", "port" } and optionally "path" (one capture file, used instead of the root directory's layout) or "paths" (several, oldest first).

Definition at line 109 of file pcap_feed.cpp.

References slick::sim::md_feed::PcapLine::address, slick::sim::md_feed::PcapLine::line, slick::sim::md_feed::PcapLine::paths, and slick::sim::md_feed::PcapLine::port.

◆ parse_utc_time_ns()

uint64_t slick::sim::md_feed::parse_utc_time_ns ( const std::string & text)
nodiscard

Parses a UTC "YYYY-MM-DDTHH:MM:SS[.fraction][Z]" into nanoseconds since the epoch.

Throws std::runtime_error when text is anything else.

Definition at line 39 of file pcap_feed.cpp.

◆ resolve_pcap_files()

std::vector< std::string > slick::sim::md_feed::resolve_pcap_files ( const std::string & root,
const std::string & address,
uint16_t port,
uint64_t begin_ns,
uint64_t end_ns )
inlinenodiscard

The capture files of group address:port that can hold packets in [begin_ns, end_ns].

The recorded layout is <root>/<YYYY-MM-DD>/<address>:<port>/<address>:<port>.pcap.zst, one file per group per day. A day's file starts in the evening before its date, so the dates from the day before begin_ns to the day after end_ns (UTC) are all candidates. Days with no file are skipped; the packets inside a file are filtered by timestamp. Those : names can't exist on Windows, where a feed must list its files (parse_pcap_lines).

Definition at line 46 of file pcap_replay_source.hpp.