|
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
|
Parameter sweep (8.4/8.5): cartesian grid over strategy parameters run on a std::jthread pool; every worker owns its own data cursor (source_factory) and backend, results come back in grid order (first parameter varies slowest). More...
#include "fastmm/backtest/backtest_runner.hpp"#include <cstddef>#include <cstdint>#include <functional>#include <limits>#include <memory>#include <string>#include <string_view>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| struct | fastmm::bt::SweepPoint |
| struct | fastmm::bt::WalkForwardFold |
| struct | fastmm::bt::WalkForwardReport |
Namespaces | |
| namespace | fastmm |
| namespace | fastmm::bt |
Typedefs | |
| using | fastmm::bt::ParamGrid = std::vector< std::pair< std::string, std::vector< std::string > > > |
| using | fastmm::bt::SourceFactory = std::function< std::unique_ptr< MdSource >()> |
| may return nullptr | |
| using | fastmm::bt::RunFn = std::function< BacktestResult(const BacktestConfig &, MdSource *)> |
| using | fastmm::bt::ScoreFn = double(*)(const BacktestResult &) |
| Ranking metric of a run, higher is better: "net_pnl", "realized_pnl", "sharpe_bar" or "spread_captured_bps". | |
Functions | |
| std::vector< ParamMap > | fastmm::bt::expand_grid (const ParamGrid &grid) |
| Expands the grid in order: [{k1: v11, k2: v21}, {k1: v11, k2: v22}, ...]. | |
| std::vector< SweepPoint > | fastmm::bt::sweep (const BacktestConfig &base, const ParamGrid &grid, const SourceFactory &source_factory, const RunFn &run, int threads=0) |
Generic driver; run is called once per point on a worker thread. | |
| template<StrategyLike S> | |
| std::vector< SweepPoint > | fastmm::bt::sweep (const BacktestConfig &base, const ParamGrid &grid, const SourceFactory &source_factory={}, int threads=0) |
| std::vector< SweepPoint > | fastmm::bt::sweep_by_name (const BacktestConfig &base, std::string strategy, const ParamGrid &grid, const SourceFactory &source_factory={}, int threads=0) |
| ScoreFn | fastmm::bt::score_metric (std::string_view name) |
| WalkForwardReport | fastmm::bt::walk_forward (const BacktestConfig &base, const ParamGrid &grid, const SourceFactory &source_factory, const RunFn &run, int folds, std::string_view metric="net_pnl", int threads=0) |
Splits the data's event-time range into folds equal slices and runs the whole grid on each one (a fresh backtest per point and fold, all on one pool of threads workers). | |
| WalkForwardReport | fastmm::bt::walk_forward_by_name (const BacktestConfig &base, std::string strategy, const ParamGrid &grid, const SourceFactory &source_factory, int folds, std::string_view metric="net_pnl", int threads=0) |
Parameter sweep (8.4/8.5): cartesian grid over strategy parameters run on a std::jthread pool; every worker owns its own data cursor (source_factory) and backend, results come back in grid order (first parameter varies slowest).
walk_forward() runs the same grid on K consecutive time slices (folds) of the data and scores the in-sample winner of fold i-1 on fold i: an out-of-sample check of the sweep's best row.