57 [[nodiscard]] std::size_t
n_assets() const noexcept {
return prices.size(); }
99 [[nodiscard]]
static std::optional<double>
102 const Eigen::MatrixXd& metric)
noexcept;
110 [[nodiscard]]
static std::optional<std::pair<double, IntervalType>>
113 const Eigen::MatrixXd& metric)
noexcept;
147 [[nodiscard]] std::optional<Eigen::MatrixXd>
148 update(
const std::vector<double>& prices);
151 [[nodiscard]] std::optional<Eigen::MatrixXd>
current_metric() const noexcept;
157 [[nodiscard]] std::
size_t n_assets() const noexcept {
return n_assets_; }
166 void reset() noexcept;
169 std::
size_t n_assets_;
171 std::
size_t obs_count_{0};
174 std::vector<Eigen::VectorXd> log_returns_window_;
175 std::size_t window_head_{0};
178 Eigen::VectorXd prev_prices_;
179 bool has_prev_{
false};
182 mutable std::optional<Eigen::MatrixXd> current_metric_;
183 bool metric_dirty_{
true};
186 void recompute_metric();
189 [[nodiscard]] Eigen::MatrixXd compute_covariance()
const;
224 [[nodiscard]]
static std::optional<TransformResult>
227 const Eigen::MatrixXd& metric)
noexcept;
236 [[nodiscard]]
static double
238 const Eigen::MatrixXd& metric)
noexcept;
279 [[nodiscard]]
static std::vector<GeodesicStep>
281 const Eigen::VectorXd& four_velocity,
282 const Eigen::MatrixXd& metric,
292 [[nodiscard]]
static std::vector<double>
294 const std::vector<MultiAssetEvent>& actual)
noexcept;
306 [[nodiscard]]
static std::vector<Eigen::VectorXd>
308 const Eigen::VectorXd& four_velocity,
309 double gross_exposure = 1.0) noexcept;
Builds the Lorentzian metric tensor from a rolling correlation matrix.
std::size_t n_assets() const noexcept
Return the number of assets.
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).
void reset() noexcept
Reset the window (clears all observations).
std::size_t observation_count() const noexcept
Return the number of observations seen so far.
const Config & config() const noexcept
Return the configuration.
N-dimensional spacetime interval between two MultiAssetEvents.
static std::optional< double > compute(const MultiAssetEvent &a, const MultiAssetEvent &b, const Eigen::MatrixXd &metric) noexcept
Compute ds² between two N-asset spacetime events.
static constexpr double kLightlikeEps
Threshold for LIGHTLIKE classification.
static IntervalType classify(double ds2) noexcept
Classify a pre-computed ds² value.
static std::optional< std::pair< double, IntervalType > > compute_and_classify(const MultiAssetEvent &a, const MultiAssetEvent &b, const Eigen::MatrixXd &metric) noexcept
Compute and classify in one call.
Applies simultaneous Lorentz boosts to N correlated price series.
static double portfolio_beta(const std::vector< double > &betas, const Eigen::MatrixXd &metric) noexcept
Compute portfolio β from individual asset velocities and the metric.
static std::optional< TransformResult > transform(const MultiAssetEvent &a, const MultiAssetEvent &b, const Eigen::MatrixXd &metric) noexcept
Apply the multi-asset Lorentz transform.
Geodesic in multi-asset spacetime: the optimal portfolio path.
static std::vector< double > deviation_series(const std::vector< GeodesicStep > &predicted, const std::vector< MultiAssetEvent > &actual) noexcept
Compute the geodesic deviation between the predicted and actual path.
static std::vector< Eigen::VectorXd > portfolio_weights(const std::vector< GeodesicStep > &steps, const Eigen::VectorXd &four_velocity, double gross_exposure=1.0) noexcept
Compute portfolio weights along the geodesic path.
static std::vector< GeodesicStep > integrate(const MultiAssetEvent &initial, const Eigen::VectorXd &four_velocity, const Eigen::MatrixXd &metric, std::size_t n_steps, double dt) noexcept
Compute the geodesic from an initial event with given four-velocity.
Physical and financial constants for the SRFM system.
Spacetime interval computations for N-asset events.
N-Asset Lorentzian Manifold for Special Relativistic Financial Mechanics.
IntervalType
Causal character of a spacetime interval.
constexpr double LIGHTLIKE_THRESHOLD
|ds²| below this value is classified as LIGHTLIKE.
Lorentz factor γ = 1/√(1−β²). Always ≥ 1.0 for valid beta.
double c_market
Market speed-of-light.
std::size_t window_size
Rolling window (number of bars).
double regularisation_eps
Ridge regularisation for ill-conditioned Σ.
A snapshot of N correlated financial assets at a point in time.
int64_t timestamp
Unix epoch milliseconds.
std::vector< std::string > symbols
Asset ticker symbols (for labelling).
std::vector< double > prices
Mid-prices for each asset.
std::vector< double > volumes
Traded volumes for each asset.
bool is_valid() const noexcept
Validate that all vectors have equal length.
std::size_t n_assets() const noexcept
Return the number of assets represented.
A single step on the geodesic path.
double proper_time
Cumulative proper time τ.
double path_length
Cumulative geodesic arc length.
MultiAssetEvent event
Predicted portfolio event.
double deviation
|actual − predicted| in price space.
Shared primitive types for the Special Relativity in Financial Modeling (SRFM) system.