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::stream::BetaCalculator< N > Class Template Reference

Online β estimator with a sliding window of N log-returns. More...

#include <beta_calculator.hpp>

Public Member Functions

 BetaCalculator (double c_market=DEFAULT_C_MARKET) noexcept
 Construct with a market speed-of-light calibration constant.
 
void update (double close) noexcept
 Ingest one new close price and update the rolling log-return buffer.
 
double beta () const noexcept
 Current β estimate.
 
bool warmed_up () const noexcept
 Whether enough data has been seen to produce a reliable β.
 
std::size_t close_count () const noexcept
 Number of close prices ingested so far.
 
std::size_t ret_count () const noexcept
 Number of log-returns accumulated (capped at N).
 
double c_market () const noexcept
 Configured market speed-of-light constant.
 
void reset () noexcept
 Reset all state as if no ticks have been seen.
 

Detailed Description

template<std::size_t N = 3u>
class srfm::stream::BetaCalculator< N >

Online β estimator with a sliding window of N log-returns.

Template parameter N determines how many log-returns are averaged. FIX-3 mode (default) uses N=3.

Template Parameters
NNumber of log-returns in the averaging window. Must be ≥ 1.

Definition at line 64 of file beta_calculator.hpp.

Constructor & Destructor Documentation

◆ BetaCalculator()

template<std::size_t N = 3u>
srfm::stream::BetaCalculator< N >::BetaCalculator ( double  c_market = DEFAULT_C_MARKET)
inlineexplicitnoexcept

Construct with a market speed-of-light calibration constant.

Parameters
c_marketThe denominator used to normalise raw log-returns into β. Must be strictly positive and finite. Defaults to 0.02.

Definition at line 75 of file beta_calculator.hpp.

Member Function Documentation

◆ beta()

template<std::size_t N = 3u>
double srfm::stream::BetaCalculator< N >::beta ( ) const
inlinenoexcept

Current β estimate.

Returns 0.0 until N log-returns have been accumulated. Guaranteed: |result| < BETA_MAX_SAFE.

Note
noexcept.

Definition at line 113 of file beta_calculator.hpp.

◆ c_market()

template<std::size_t N = 3u>
double srfm::stream::BetaCalculator< N >::c_market ( ) const
inlinenoexcept

Configured market speed-of-light constant.

Definition at line 142 of file beta_calculator.hpp.

◆ close_count()

template<std::size_t N = 3u>
std::size_t srfm::stream::BetaCalculator< N >::close_count ( ) const
inlinenoexcept

Number of close prices ingested so far.

Definition at line 136 of file beta_calculator.hpp.

◆ reset()

template<std::size_t N = 3u>
void srfm::stream::BetaCalculator< N >::reset ( )
inlinenoexcept

Reset all state as if no ticks have been seen.

Definition at line 149 of file beta_calculator.hpp.

◆ ret_count()

template<std::size_t N = 3u>
std::size_t srfm::stream::BetaCalculator< N >::ret_count ( ) const
inlinenoexcept

Number of log-returns accumulated (capped at N).

Definition at line 139 of file beta_calculator.hpp.

◆ update()

template<std::size_t N = 3u>
void srfm::stream::BetaCalculator< N >::update ( double  close)
inlinenoexcept

Ingest one new close price and update the rolling log-return buffer.

Parameters
closeCurrent bar's close price. Must be positive and finite; non-positive / non-finite values are silently ignored (no state change) to protect the pipeline from bad data.
Note
noexcept.

Definition at line 89 of file beta_calculator.hpp.

◆ warmed_up()

template<std::size_t N = 3u>
bool srfm::stream::BetaCalculator< N >::warmed_up ( ) const
inlinenoexcept

Whether enough data has been seen to produce a reliable β.

True once N+1 close prices have been ingested (N log-returns computed).

Definition at line 133 of file beta_calculator.hpp.


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