algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
folds.hpp File Reference

Fold ranges for rolling and expanding windows and walk-forward tests: positions in a time index the caller supplies, never bars or durations. More...

#include <cstddef>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for folds.hpp:

Go to the source code of this file.

Classes

struct  algotradelib::backtest::IndexRange
 A half-open range of positions, [begin_, end_). More...
struct  algotradelib::backtest::FoldLengths
 The lengths of a fold, in positions. More...
struct  algotradelib::backtest::Fold
 One fold: its training and test ranges, and where each one's history starts. More...
struct  algotradelib::backtest::Rolling
 Training on the train_ positions just before each test range. More...
struct  algotradelib::backtest::Expanding
 Training on every position from the end of the first history to each test range. More...
struct  algotradelib::backtest::is_window_scheme< Scheme, typename >
 Whether Scheme can choose a fold's training range: true when a const Scheme has a member train(std::size_t, const FoldLengths&) returning something convertible to IndexRange. More...
struct  algotradelib::backtest::is_window_scheme< Scheme, std::enable_if_t< std::is_convertible_v< decltype(std::declval< const Scheme & >().train(std::size_t{}, std::declval< const FoldLengths & >())), IndexRange > > >
 A scheme with the member train that folds calls. More...

Namespaces

namespace  algotradelib
 The library: broker-neutral types (core), and the modules below.
namespace  algotradelib::backtest
 Replays a strategy over stored bars: fill and cost models, the replay ledger, and the report.

Functions

template<typename Scheme = Rolling>
std::vector< Fold > algotradelib::backtest::folds (std::size_t count, const FoldLengths &lengths, const Scheme &scheme=Scheme{})
 Lists the folds over a time index of count positions.

Detailed Description

Fold ranges for rolling and expanding windows and walk-forward tests: positions in a time index the caller supplies, never bars or durations.

Definition in file folds.hpp.