|
FastMM C++ API 0.14.0
Public headers, tier 1 and tier 2
|
State that survives a process restart: the session epoch (client order ids) and the latched risk state (kill switch and cumulative PnL). More...
#include "fastmm/core/enums.hpp"#include "fastmm/core/fixed_point.hpp"#include "fastmm/core/result.hpp"#include <cstdint>#include <string>#include <string_view>Go to the source code of this file.
Classes | |
| class | fastmm::SessionEpochStore |
| The 16-bit session epoch is the high half of every ClientOrderId, so two sessions that share one would let a venue's late message from the earlier session match an order of the later one. More... | |
| struct | fastmm::KillState |
| Cumulative risk state across sessions. More... | |
| class | fastmm::KillStateStore |
Namespaces | |
| namespace | fastmm |
Functions | |
| Result< void, std::string > | fastmm::write_file_atomic (const std::string &path, std::string_view contents) |
Writes contents to path atomically: <path>.tmp, fsync, rename, fsync of the directory. | |
| Result< bool, std::string > | fastmm::load_strategy_state (const std::string &path, std::string &out) |
| The strategy state file ([strategy] state_file, written by write_file_atomic): its bytes, true when it exists, false when there is no such file (a first start); an error when it cannot be read. | |
| Result< void, std::string > | fastmm::write_strategy_state (const std::string &path, std::string_view bytes, std::uint32_t version) |
| The [strategy] state_file as the engine's state() bytes go into it: a 16-byte head ("FMSTATE1", the strategy's state_version as a little-endian u32, 4 zero bytes), then the bytes. | |
| Result< bool, std::string > | fastmm::read_strategy_state (const std::string &path, std::string &out, std::uint32_t &version) |
| constexpr std::int64_t | fastmm::utc_day_start (std::int64_t wall_ns) noexcept |
00:00 UTC of the day wall_ns falls in. | |
| bool | fastmm::start_loss_period (KillState &s, std::int64_t period_start_ns) noexcept |
Starts the loss budget's period that holds wall_ns when the state counts an earlier one: realized and fees go back to zero, the latch stays. | |
State that survives a process restart: the session epoch (client order ids) and the latched risk state (kill switch and cumulative PnL).
Both are text files next to the journal, written through a temporary file + fsync + rename, so a crash leaves the old file or the new one, never a truncated one. Both stores fail closed: a session that cannot read or bump them must not trade.