|
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
|
JournalSource: market-data events of an .fmj journal (BookDelta / BookSnapshot / Trade / BookTicker records, in sequence order). More...
#include "fastmm/backtest/data_source.hpp"#include "fastmm/backtest/own_orders.hpp"#include "fastmm/core/instrument.hpp"#include "fastmm/core/journal.hpp"#include "fastmm/sim/sim_account.hpp"#include <cstdint>#include <memory>#include <string>#include <string_view>#include <vector>Go to the source code of this file.
Classes | |
| class | fastmm::bt::JournalSource |
Namespaces | |
| namespace | fastmm |
| namespace | fastmm::bt |
Functions | |
| std::uint64_t | fastmm::bt::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 .fmj with JournalFileWriter (instrument table + header stamped with seed); used to produce fixtures. | |
JournalSource: market-data events of an .fmj journal (BookDelta / BookSnapshot / Trade / BookTicker records, in sequence order).
Everything else the journal holds (order events, timers, outbound copies) is skipped: the backtest re-derives those.
parts: a session recorded with [engine] journal_max_bytes is several files, x.fmj then x.1.fmj, x.2.fmj, ... (JournalFileWriter::part_path), each a complete journal that repeats the prologue. Given x.fmj, the source reads the later parts after it, in order, until one is missing, as one stream; their prologues are never events, so nothing repeats. A part of another session (its session_id differs) is refused. The sequence numbers continue across parts; a part whose first does not follow the previous part's last is read anyway, and seq_gaps() / note() say so: a part is missing in between, or the previous one was cut short.
strip_own: the journal is a live session's, whose venue feed shows the session's own resting orders; take them out of the depth and top of book (OwnOrderStripper, own_orders.hpp) so the backtest does not see its live twin as someone else's liquidity. A BookTicker whose best bid or ask was only ours is dropped. Public trades are kept, our own fills included: the aggressor existed whether or not our order did, and without it would have traded with the next order at that price, which is what a simulated order there stands for.
remap: the journal numbers its instruments as the recording session did, so two recordings of different instrument sets both count from 0 and, merged, overwrite each other's books. Given the backtest configuration's table, every event's instrument id becomes that of the instrument with the same symbol there (the recording's venue first, else any venue listing the symbol) and its venue that instrument's; an event whose symbol the configuration lacks is dropped, and note() counts them. The copy holds up to kMaxMsgBytes: a recorded snapshot can be deeper than an EventBuf. Remap applies after strip_own.