Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
Public Member Functions | List of all members
srfm::backtest::Backtester Class Reference

#include <backtest.hpp>

Public Member Functions

 Backtester (BacktestConfig config=BacktestConfig{})
 Construct with configuration.
 
std::optional< BacktestComparison > run (std::span< const BarData > bars, std::span< const double > asset_returns) const noexcept
 
std::optional< LorentzCorrectedSeries > apply_corrections (std::span< const BarData > bars) const noexcept
 

Detailed Description

Runs raw and relativistic strategies side by side and reports metrics.

Usage pattern:

cfg.risk_free_rate = 0.02 / 252.0; // daily r_f
cfg.annualisation = 252.0;
Backtester bt(cfg);
auto cmp = bt.run(bars, returns);
if (cmp) fmt::print("{}\n", cmp->to_string());
Configuration for a backtest run.
Definition backtest.hpp:113

Definition at line 249 of file backtest.hpp.

Constructor & Destructor Documentation

◆ Backtester()

srfm::backtest::Backtester::Backtester ( BacktestConfig  config = BacktestConfig{})
explicit

Construct with configuration.

Definition at line 21 of file backtester.cpp.

Member Function Documentation

◆ apply_corrections()

std::optional< LorentzCorrectedSeries > srfm::backtest::Backtester::apply_corrections ( std::span< const BarData >  bars) const
noexcept

Compute only the Lorentz-corrected signal series (no strategy eval). Useful for inspection / visualisation.

Definition at line 26 of file backtester.cpp.

◆ run()

std::optional< BacktestComparison > srfm::backtest::Backtester::run ( std::span< const BarData >  bars,
std::span< const double >  asset_returns 
) const
noexcept

Run a full side-by-side backtest.

Arguments

  • bars — One entry per time step: raw signal, β, benchmark return.
  • returns — Realised asset returns aligned to bars (same length). Signalling rule: strategy return = sign(signal) × asset ret.

Returns

BacktestComparison containing both metric sets, or nullopt if:

  • Input lengths mismatch
  • Fewer than MIN_RETURN_SERIES_LENGTH bars provided
  • Any metric calculation is numerically degenerate

Definition at line 58 of file backtester.cpp.


The documentation for this class was generated from the following files: