33#include "fastmm/backtest/own_orders.hpp"
35#include "fastmm/core/journal.hpp"
36#include "fastmm/sim/recorded_session.hpp"
46class JournalSource final :
public MdSource {
52 bool strip_own =
false,
56 void reset()
override;
59 [[nodiscard]]
const JournalReader&
reader() const noexcept {
return parts_.front(); }
61 [[nodiscard]]
const std::vector<std::string>&
paths() const noexcept {
return paths_; }
63 [[nodiscard]] std::size_t
seq_gaps() const noexcept {
return seq_gaps_; }
64 [[nodiscard]] std::size_t
md_events() const noexcept {
return md_events_; }
66 [[nodiscard]]
const OwnOrderStripper*
stripper() const noexcept {
return stripper_.get(); }
68 [[nodiscard]] std::size_t
dropped() const noexcept {
return dropped_; }
69 [[nodiscard]] std::string
note()
const override;
76 [[nodiscard]]
const sim::RecordedSession*
recorded()
const override {
return &session_; }
90 std::vector<JournalReader> parts_;
91 std::vector<std::string> paths_;
93 std::size_t seq_gaps_ = 0;
96 std::size_t md_events_ = 0;
97 std::unique_ptr<OwnOrderStripper> stripper_;
98 std::size_t orders_ = 0;
100 sim::RecordedSession session_;
102 static constexpr std::uint32_t kUnmapped = 0xFFFF'FFFF;
104 std::vector<std::uint32_t> map_;
105 std::vector<VenueId> map_venue_;
106 std::size_t unmapped_ = 0;
107 std::size_t dropped_ = 0;
108 std::vector<std::uint64_t> rbuf_;
115 const std::string& path,
118 std::string_view strategy =
"data",
119 std::uint64_t max_events = 0);
Dense-by-id table built at startup; symbol lookup is a sorted FlatMap keyed by (venue,...
Definition instrument.hpp:147
Definition journal_source.hpp:48
static bool own_ticker(const EventHeader &h) noexcept
A ticker a backtest's simulated venue sent because our order changed the touch: ours,...
Definition journal_source.hpp:87
const JournalReader & reader() const noexcept
The first part: its header, instrument table and configuration are every part's.
Definition journal_source.hpp:61
const EventHeader * next() override
static bool is_market_data(EventType t) noexcept
Definition journal_source.hpp:80
const OwnOrderStripper * stripper() const noexcept
Null unless strip_own.
Definition journal_source.hpp:68
std::size_t dropped() const noexcept
remap: events dropped so far because the configuration lacks their symbol.
Definition journal_source.hpp:70
const std::vector< std::string > & paths() const noexcept
The files read, in order; the first is path.
Definition journal_source.hpp:63
std::string note() const override
const sim::RecordedSession * recorded() const override
What the parts say about the session (sim/recorded_session.hpp): its states and checkpoints (journal_...
Definition journal_source.hpp:78
std::size_t seq_gaps() const noexcept
Parts whose first sequence number did not follow the previous part's last.
Definition journal_source.hpp:65
Timestamp start_ts() const override
Definition journal_source.hpp:59
std::size_t md_events() const noexcept
Definition journal_source.hpp:66
DataSource (8.4): a timestamp-ordered stream of normalized market-data events consumed by the simulat...
Instrument: the single definition of a tradable contract (5.3 / 5.15).
Definition backtest_config.hpp:44
std::uint64_t write_md_journal(MdSource &source, const std::string &path, const InstrumentTable &instruments, std::uint64_t seed, std::string_view strategy="data", std::uint64_t max_events=0)
Writes the events of source (all, or the first max_events when non-zero) to a fresh ....
EventType
Message discriminator carried in EventHeader::type.
Definition enums.hpp:316
@ OptionTicker
mark / implied vols / greeks of one option (OptionTickerMsg)
@ PerpState
mark, index and funding of one derivative (PerpStateMsg)
@ InstrumentRules
A venue's trading rules or trading status of one instrument changed while the session ran (Instrument...