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

Builds the Lorentzian metric tensor from a rolling correlation matrix. More...

#include <multi_asset.hpp>

Classes

struct  Config
 Construction parameters. More...
 

Public Member Functions

 CorrelationMetric (std::size_t n_assets, Config cfg={})
 Construct with given configuration.
 
std::optional< Eigen::MatrixXd > update (const std::vector< double > &prices)
 Add a new bar observation and update the metric.
 
std::optional< Eigen::MatrixXd > current_metric () const noexcept
 Return the current metric tensor (last computed).
 
std::optional< Eigen::MatrixXd > correlation_matrix () const noexcept
 Return the rolling correlation matrix (spatial block only).
 
std::size_t n_assets () const noexcept
 Return the number of assets.
 
std::size_t observation_count () const noexcept
 Return the number of observations seen so far.
 
const Config & config () const noexcept
 Return the configuration.
 
void reset () noexcept
 Reset the window (clears all observations).
 

Detailed Description

Builds the Lorentzian metric tensor from a rolling correlation matrix.

Maintains a sliding window of N-asset price observations and computes the (N+1)×(N+1) metric tensor g_μν with:

The Cholesky decomposition of the spatial block is checked on every update; if the covariance matrix is not positive-definite (ill-conditioned or singular correlation), the metric is regularised by adding regularisation_eps × I to the spatial block.

Definition at line 131 of file multi_asset.hpp.

Constructor & Destructor Documentation

◆ CorrelationMetric()

srfm::multi_asset::CorrelationMetric::CorrelationMetric ( std::size_t  n_assets,
Config  cfg = {} 
)
explicit

Construct with given configuration.

Definition at line 103 of file multi_asset.cpp.

Member Function Documentation

◆ config()

const Config & srfm::multi_asset::CorrelationMetric::config ( ) const
inlinenoexcept

Return the configuration.

Definition at line 163 of file multi_asset.hpp.

◆ correlation_matrix()

std::optional< Eigen::MatrixXd > srfm::multi_asset::CorrelationMetric::correlation_matrix ( ) const
noexcept

Return the rolling correlation matrix (spatial block only).

Definition at line 151 of file multi_asset.cpp.

◆ current_metric()

std::optional< Eigen::MatrixXd > srfm::multi_asset::CorrelationMetric::current_metric ( ) const
noexcept

Return the current metric tensor (last computed).

Definition at line 146 of file multi_asset.cpp.

◆ n_assets()

std::size_t srfm::multi_asset::CorrelationMetric::n_assets ( ) const
inlinenoexcept

Return the number of assets.

Definition at line 157 of file multi_asset.hpp.

◆ observation_count()

std::size_t srfm::multi_asset::CorrelationMetric::observation_count ( ) const
inlinenoexcept

Return the number of observations seen so far.

Definition at line 160 of file multi_asset.hpp.

◆ reset()

void srfm::multi_asset::CorrelationMetric::reset ( )
noexcept

Reset the window (clears all observations).

Definition at line 167 of file multi_asset.cpp.

◆ update()

std::optional< Eigen::MatrixXd > srfm::multi_asset::CorrelationMetric::update ( const std::vector< double > &  prices)

Add a new bar observation and update the metric.

Parameters
pricesNew price observations for each asset.
Returns
Updated metric tensor, or std::nullopt if fewer than 2 observations.

Definition at line 116 of file multi_asset.cpp.


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