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::RelativisticPortfolio Class Reference

#include <relativistic_optimizer.hpp>

Public Member Functions

 RelativisticPortfolio (OptimizerConfig config=OptimizerConfig{}) noexcept
 Construct with optional configuration.
 
void add_asset (AssetEvent event, double expected_return)
 
std::size_t n_assets () const noexcept
 Return the number of assets currently in the portfolio.
 
std::optional< Eigen::VectorXd > relativistic_returns () const noexcept
 
std::optional< Eigen::MatrixXd > spacetime_covariance () const noexcept
 
std::optional< OptimizationResult > optimize_weights (double target_return, double risk_tolerance=1.0) const noexcept
 
void clear () noexcept
 Remove all assets from the portfolio.
 

Detailed Description

Relativistic portfolio optimizer: Markowitz on the financial manifold.

Workflow

  1. Construct with a list of AssetEvents (one per asset in the portfolio).
  2. Set expected returns via set_expected_returns().
  3. Call optimize_weights(target_return, risk_tolerance).

The spacetime covariance matrix Σ_st is computed internally from the AssetEvents using MinkowskiCovariance and used as the geodesic metric.

Example

rp.add_asset(AssetEvent{"AAPL", 1.0, 150.0, 1e8, 2.4e12}, 0.12);
rp.add_asset(AssetEvent{"MSFT", 1.0, 290.0, 8e7, 2.1e12}, 0.10);
auto result = rp.optimize_weights(0.08, 0.5);
if (result) {
std::cout << result->weights << "\n";
}
void add_asset(AssetEvent event, double expected_return)
std::optional< OptimizationResult > optimize_weights(double target_return, double risk_tolerance=1.0) const noexcept

Definition at line 106 of file relativistic_optimizer.hpp.

Constructor & Destructor Documentation

◆ RelativisticPortfolio()

srfm::portfolio::RelativisticPortfolio::RelativisticPortfolio ( OptimizerConfig  config = OptimizerConfig{})
explicitnoexcept

Construct with optional configuration.

Definition at line 33 of file relativistic_optimizer.cpp.

Member Function Documentation

◆ add_asset()

void srfm::portfolio::RelativisticPortfolio::add_asset ( AssetEvent  event,
double  expected_return 
)

Add an asset with its annualised expected return.

Parameters
eventAssetEvent providing spacetime coordinates.
expected_returnAnnualised expected return for this asset (e.g. 0.10 = 10%).

Definition at line 38 of file relativistic_optimizer.cpp.

◆ clear()

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

Remove all assets from the portfolio.

Definition at line 48 of file relativistic_optimizer.cpp.

◆ n_assets()

std::size_t srfm::portfolio::RelativisticPortfolio::n_assets ( ) const
noexcept

Return the number of assets currently in the portfolio.

Definition at line 44 of file relativistic_optimizer.cpp.

◆ optimize_weights()

std::optional< OptimizationResult > srfm::portfolio::RelativisticPortfolio::optimize_weights ( double  target_return,
double  risk_tolerance = 1.0 
) const
noexcept

Run the relativistic portfolio optimization.

Formulates the problem as a geodesic minimization on the financial manifold and solves it via projected gradient descent on the simplex.

Parameters
target_returnMinimum required relativistic expected return.
risk_toleranceScalar multiplier on the geodesic risk term (higher = more risk-averse; default 1.0).
Returns
OptimizationResult, or nullopt if fewer than 2 assets are loaded or the covariance is degenerate.

Definition at line 160 of file relativistic_optimizer.cpp.

◆ relativistic_returns()

std::optional< Eigen::VectorXd > srfm::portfolio::RelativisticPortfolio::relativistic_returns ( ) const
noexcept

Compute the gamma-weighted (relativistic) expected return vector.

For each asset i: μ_rel_i = γ(β_i) · μ_i where β_i = |ΔP_i| / (c_market · |Δt_i|) approximated from the event coordinates relative to a reference event at the origin.

Returns
Vector of length n_assets(), or nullopt if no assets added.

Definition at line 82 of file relativistic_optimizer.cpp.

◆ spacetime_covariance()

std::optional< Eigen::MatrixXd > srfm::portfolio::RelativisticPortfolio::spacetime_covariance ( ) const
noexcept

Compute the NxN spacetime covariance matrix Σ_st.

Uses MinkowskiCovariance internally. Returns nullopt if fewer than 2 assets are loaded.

Returns
NxN Eigen::MatrixXd, or nullopt on failure.

Definition at line 100 of file relativistic_optimizer.cpp.


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