Slick Sim 0.10.1
Exchange simulator that shadows real venues for risk-free strategy testing
Loading...
Searching...
No Matches
feed_info.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <common/types.hpp>
4#include <md_feed/md_feed.hpp>
5#include <format>
6#include <stdexcept>
7#include <string>
8#include <vector>
9
10namespace slick::sim::exch {
11
19
22inline void reject_mixed_feeds(const std::vector<FeedInfo> &feeds) {
23 for (const auto &live : feeds) {
24 for (const auto &pcap : feeds) {
25 if (live.kind == md_feed::FeedKind::LIVE && pcap.kind == md_feed::FeedKind::PCAP &&
26 live.venue == pcap.venue) {
27 throw std::runtime_error(std::format(
28 "live feed '{}' and pcap feed '{}' can't run together: an exchange has one kind or the other",
29 live.name, pcap.name));
30 }
31 }
32 }
33}
34
36inline std::string list_feeds(const std::vector<FeedInfo> &feeds) {
37 std::string out;
38 for (const auto &feed : feeds) {
39 if (!out.empty()) {
40 out += '\n';
41 }
42 out += md_feed::kind_name(feed.kind);
43 out += ' ';
44 out += feed.name;
45 }
46 return out;
47}
48
49} // namespace slick::sim::exch
Helpers for a venue whose one config entry describes several independent exchange instances,...
Definition exchange.hpp:30
void reject_mixed_feeds(const std::vector< FeedInfo > &feeds)
Throws when one venue has both live and pcap feeds, in whichever of its instances: a venue's market i...
Definition feed_info.hpp:22
std::string list_feeds(const std::vector< FeedInfo > &feeds)
<live|pcap> <name> per feed, one per line: the CLI's answer to feeds.
Definition feed_info.hpp:36
constexpr const char * kind_name(FeedKind kind) noexcept
As the CLI lists it.
Definition md_feed.hpp:19
FeedKind
Where a feed's market data comes from.
Definition md_feed.hpp:13
@ PCAP
Recorded captures.
Definition md_feed.hpp:15
@ LIVE
The venue, as it happens.
Definition md_feed.hpp:14
One enabled market-data feed, as Exchange::enabledFeeds() reports it.
Definition feed_info.hpp:13
md_feed::FeedKind kind
Definition feed_info.hpp:15
std::string name
<venue>/<feed>, or for a feed without a name its exchange's <venue>[/<instance>].
Definition feed_info.hpp:17