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::portfolio::MinkowskiCovariance Class Reference

#include <portfolio_manifold.hpp>

Public Member Functions

 MinkowskiCovariance (double c_market=constants::SPEED_OF_INFORMATION) noexcept
 
void add_asset (AssetEvent event)
 
std::size_t size () const noexcept
 Return the number of asset events currently stored.
 
std::optional< Eigen::MatrixXd > compute_spacetime_covariance () const noexcept
 
std::optional< double > interval_correlation (std::size_t i, std::size_t j) const noexcept
 
std::optional< manifold::IntervalType > classify_pair (std::size_t i, std::size_t j) const noexcept
 
const std::vector< AssetEvent > & events () const noexcept
 Read-only access to the stored asset events.
 
void clear () noexcept
 Clear all stored events.
 

Detailed Description

Accumulates a set of AssetEvents and computes an NxN covariance matrix whose (i,j) entry is derived from the spacetime interval between asset i and asset j.

Algorithm

For each ordered pair (i, j): ds²(i,j) = −c²·Δt² + ΔP² + ΔV² + ΔM² where Δx = event_j − event_i in each coordinate.

The covariance entry C(i,j) is defined as: C(i,j) = exp(−|ds²(i,j)|) (Gaussian kernel over interval)

This maps:

The diagonal is set to 1.0 (each asset is perfectly correlated with itself).

Usage

mc.add_asset(AssetEvent{"AAPL", 1.0, 150.0, 1e8, 2.4e12});
mc.add_asset(AssetEvent{"MSFT", 1.0, 290.0, 8e7, 2.1e12});
// cov is a 2x2 Eigen::MatrixXd
std::optional< Eigen::MatrixXd > compute_spacetime_covariance() const noexcept

Definition at line 97 of file portfolio_manifold.hpp.

Constructor & Destructor Documentation

◆ MinkowskiCovariance()

srfm::portfolio::MinkowskiCovariance::MinkowskiCovariance ( double  c_market = constants::SPEED_OF_INFORMATION)
explicitnoexcept

Construct with optional speed-of-information parameter.

Parameters
c_marketSpeed-of-information constant (default: 1.0).

Definition at line 43 of file portfolio_manifold.cpp.

Member Function Documentation

◆ add_asset()

void srfm::portfolio::MinkowskiCovariance::add_asset ( AssetEvent  event)

Add an asset event to the manifold.

Events are stored in insertion order. The i-th added event becomes row/column i of the output covariance matrix.

Parameters
eventAsset event to add.

Definition at line 46 of file portfolio_manifold.cpp.

◆ classify_pair()

std::optional< manifold::IntervalType > srfm::portfolio::MinkowskiCovariance::classify_pair ( std::size_t  i,
std::size_t  j 
) const
noexcept

Classify the spacetime interval between asset pair (i, j).

Parameters
iIndex of first asset (0-based).
jIndex of second asset (0-based).
Returns
IntervalType (TIMELIKE / LIGHTLIKE / SPACELIKE), or nullopt if indices are out of range.

Definition at line 89 of file portfolio_manifold.cpp.

◆ clear()

void srfm::portfolio::MinkowskiCovariance::clear ( )
noexcept

Clear all stored events.

Definition at line 58 of file portfolio_manifold.cpp.

◆ compute_spacetime_covariance()

std::optional< Eigen::MatrixXd > srfm::portfolio::MinkowskiCovariance::compute_spacetime_covariance ( ) const
noexcept

Compute the NxN Minkowski covariance matrix.

Requires at least 2 assets; returns nullopt if fewer are stored.

Returns
NxN Eigen::MatrixXd where N = size(), or nullopt on failure.

Definition at line 102 of file portfolio_manifold.cpp.

◆ events()

const std::vector< AssetEvent > & srfm::portfolio::MinkowskiCovariance::events ( ) const
noexcept

Read-only access to the stored asset events.

Definition at line 54 of file portfolio_manifold.cpp.

◆ interval_correlation()

std::optional< double > srfm::portfolio::MinkowskiCovariance::interval_correlation ( std::size_t  i,
std::size_t  j 
) const
noexcept

Compute the raw spacetime interval ds²(i, j) between asset pair (i, j).

Parameters
iIndex of first asset (0-based).
jIndex of second asset (0-based).
Returns
ds²(i, j), or nullopt if indices are out of range.

Definition at line 80 of file portfolio_manifold.cpp.

◆ size()

std::size_t srfm::portfolio::MinkowskiCovariance::size ( ) const
noexcept

Return the number of asset events currently stored.

Definition at line 50 of file portfolio_manifold.cpp.


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