|
Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
|
<picture> <source media="(prefers-color-scheme: dark)" srcset="assets/hero-dark.png">
</picture>
Project site · Quick start · What it computes · Results · SRFM family
SRFM treats every OHLCV bar as an event in a four-dimensional spacetime (time, price, volume, momentum). This C++20 library computes each bar's price velocity β against a market "speed of information" c, its Lorentz factor γ, and the Minkowski interval ds² to the previous bar, then labels the bar timelike (ds² < 0, inside the light cone) or spacelike (ds² > 0, outside it). On top sit a metric tensor, Christoffel symbols, an RK4 geodesic solver and a geodesic-deviation signal, plus Python scripts that test whether the labels mean anything.
Research code, not financial advice. This explores a mathematical analogy; it does not claim markets obey special relativity. Nothing here is a tested trading strategy.
CMake 3.25+ and a C++20 compiler (GCC 12+, Clang 17+ or MSVC 19.38+). Eigen is vendored in third_party/; GoogleTest, Google Benchmark and fmt are fetched on the first configure, so there is nothing to install first.
Linux / macOS
Windows (Visual Studio 2022 or newer)
Clone to a short path on Windows: MSBuild's intermediate files hit the 260-character path limit under deep directories. CI runs exactly these commands on ubuntu-latest and windows-latest.
What the last command prints (real output, SPY daily bars committed in the repo):
Columns: ticker, bar_index, interval_type, next_bar_abs_return, next_bar_return, beta, geodesic_deviation. β is clamped at 0.9999, so on daily equity bars most values sit at the cap.
| Target | What it is |
|---|---|
regime_validator | Reads an OHLCV CSV, labels every bar, writes the CSV that validation/analyze_q1.py consumes |
backtest_runner | Geodesic-deviation strategy over a regime_validator output file |
lorentz_basics | The library example below |
srfm | Small CLI over srfm::core::Engine: --backtest <csv>, --stream (stdin), --help |
bench_beta_gamma | Google Benchmark suite for the SIMD β/γ kernels |
srfm_* static libraries | momentum, lorentz, manifold, tensor, geodesic, engine, core, backtest, stream, portfolio, simd_* and more; see cmake/*.cmake |
| test executables | 41 CTest suites (GoogleTest and small self-contained runners) |
| Piece | What it does |
|---|---|
| β and γ | lorentz::BetaCalculator turns a window of prices into a velocity against c; lorentz::LorentzTransform::gamma returns γ = 1/√(1 − β²), with β clamped below BETA_MAX_SAFE = 0.9999. |
| Interval class | manifold::MarketManifold::process z-scores price, volume and momentum over a rolling window (CoordinateNormalizer, window 20), computes ds² = −c²dt² + dP² + dV² + dM² to the previous bar and classifies it as timelike, lightlike or spacelike. |
| Curvature | MetricTensor, Christoffel symbols by central differences or exact dual numbers, an RK4 geodesic solver, and a deviation signal between the observed path and the geodesic. |
| Batch and streaming | AVX2 / AVX-512 β and γ kernels with runtime dispatch, and a lock-free SPSC tick pipeline (include/srfm/stream/). |
examples/lorentz_basics.cpp is compiled by CI; this is its source and its output.
Link against srfm_manifold and srfm_lorentz in your own CMake project, or install with cmake --install build --prefix <dir> and use find_package(srfm CONFIG REQUIRED) with srfm::srfm_engine, srfm::srfm_tensor and friends (the installed package needs Eigen 3.4 findable by CMake).
The hypothesis: a spacelike bar (price moved "faster than light" for the time elapsed) is followed by more return variance than a timelike bar. regime_validator labels ten tickers and validation/analyze_q1.py compares next-bar variance between the two groups.
<picture> <source media="(prefers-color-scheme: dark)" srcset="assets/regimes-dark.png">
</picture>
| Pooled over 10 tickers | Committed (validation/Q1_RESULTS.md) | Re-run with today's build |
|---|---|---|
| Bars, timelike / spacelike | 3,256 / 9,855 | 3,252 / 9,769 |
| Variance ratio, spacelike / timelike | 1.27 | 1.26 |
| Bartlett p (assumes normal returns) | 6.0 x 10^-16 | 4.0 x 10^-15 |
| Levene p (robust to fat tails) | 0.083 | 0.098 |
| Cohen's d | 0.037 | 0.034 |
| Tickers significant after Bonferroni | 5 of 10 Bartlett, 0 of 10 Levene | 5 of 10 Bartlett, 0 of 10 Levene |
Read together: the direction matches the hypothesis and Bartlett is highly significant, but Bartlett is known to over-reject on fat-tailed returns, the robust Levene test is not significant at 5%, and the effect is small. Treat it as an open research result, not an edge. The re-run differs slightly because the current validator skips a warm-up window before labelling.
The files in validation/data/ are named *_1m.csv but hold daily bars from March 2021 to February 2026 (about 1,256 per ticker). The paper describes a 1-minute Q1 2025 study whose data is not in this repository.
All 41 CTest suites pass (100% tests passed, 0 tests failed out of 41, MSVC Release, 2026-09-25), and CI runs them on Linux GCC and Windows MSVC for every push. Suites that ever regress can be parked in ci/known-failing-tests.txt, which is empty today. The Python validation tests and the Rust unit tests run in CI too, minus the few listed in ci/known-failing-pytest.txt and ci/known-failing-rust-tests.txt.
include/, src/, cmake/): the part this README documents. Built in CI with GCC and MSVC at -Wall -Wextra -Wpedantic / /W4; -DSRFM_WARNINGS_AS_ERRORS=ON turns warnings into errors.validation/ (data fetch, statistical tests, optimizer and dashboard demos) and python/ (pure-Python fallback API and optional pybind11 bindings).tokio-prompt-orchestrator) holding an LLM orchestration service and exploratory physics-analogy modules. It is not needed for the C++ library. cargo test --lib runs its unit tests; the integration tests under tests/*.rs target modules that were removed and do not compile.paper/ (LaTeX) and Paper 1.1.pdf.| Repository | What it is |
|---|---|
| Special-Relativity-in-Financial-Modeling (this repo) | C++20 core: β, γ, interval labels, Christoffel symbols and geodesic deviation on OHLCV bars, plus Python validation scripts |
| srfm-lab (site) | Multi-language research lab built on the idea: the black-hole signal, Monte Carlo backtests, a paper trader and an idea engine |
| srfm-python | Pure-Python SDK: a pandas df.srfm accessor and a Polars wrapper for the Lorentz-factor pipeline |
| srfm-paper-impl | The paper (PDF), scripts and a notebook that regenerate its figures, and a small Rust reference of the core formulas |
The Rust crate fin-stream also ships a streaming lorentz module built on the same transform.
| CMake option | Default | Effect |
|---|---|---|
SRFM_WARNINGS_AS_ERRORS | OFF | Adds -Werror / /WX on top of -Wall -Wextra -Wpedantic / /W4 |
SRFM_BUILD_INTEGRATION_TESTS | ON | Builds the srfm::core::Engine end-to-end suites |
SRFM_FUZZ | OFF | Builds the libFuzzer targets in fuzz/ (Clang only) |
CMAKE_BUILD_TYPE | none | Use Release with single-config generators; pass --config Release with Visual Studio |
Optional packages are picked up when installed (for example through a vcpkg toolchain file): Eigen3, GTest, fmt, spdlog, Google Benchmark and RapidCheck. RapidCheck enables the ten prop_* property-test suites (10,000 inputs each); without it they are skipped. Everything else falls back to the vendored or fetched copy.
Python dependencies for validation/:
Spacetime embedding. Each bar becomes an event (t, P, V, M): bar time, close price, volume, and a momentum proxy (price_return * volume in srfm::core::Engine). regime_validator z-scores P, V and M over a rolling 20-bar window (CoordinateNormalizer) before computing intervals, so the three spatial axes live on comparable scales.
Velocity and Lorentz factor.
Interval.
| Class | ds² | Model's reading |
|---|---|---|
| TIMELIKE | < 0 | Move inside the light cone; the hypothesis is that momentum carries information |
| LIGHTLIKE | ≈ 0 | On the cone |
| SPACELIKE | > 0 | Move "faster than light" for the time elapsed; treated as noise |
Relativistic momentum signal. p_rel = gamma(beta) * m_eff * p_raw.
Geodesics. d²x^mu/dtau² + Gamma^mu_{nu rho} (dx^nu/dtau)(dx^rho/dtau) = 0, integrated with RK4. Christoffel symbols come from O(h²) central differences or exact forward-mode dual numbers (eps² = 0). Deviation from the geodesic is the geodesic_deviation column.
Relativistic Sharpe. SR_rel = (w^T mu - rf) / sqrt(w^T Sigma_st w), where Sigma_st discounts the covariance of SPACELIKE asset pairs by (1 - s_i * s_j) with s_k = 1 - timelike_fraction_k.
Core engine and CSV loader (include/srfm/engine.hpp, include/srfm/data_loader.hpp, target srfm_core). DataLoader accepts numeric or ISO-8601 timestamps. c defaults to 1.0 in price units, so on dollar prices β saturates at the cap; set EngineConfig::max_market_velocity to your instrument's scale.
N-asset portfolio manifold (include/portfolio_manifold.hpp)
Relativistic optimizer (include/relativistic_optimizer.hpp)
Streaming and SIMD (examples/stream_and_simd.cpp, compiled in CI)
The batch β divides by the running maximum velocity, so the largest input maps to the 0.9999 cap and γ ≈ 70.7.
CI runs every suite except those listed in ci/known-failing-tests.txt.
The 41 CTest suites cover: momentum and edge cases; Lorentz transform, β calculator and online β; Lorentz invariants; metric tensor, Christoffel symbols (finite-difference and dual-number), metric singularity and geodesics; interval gaps; SIMD agreement across scalar, AVX2 and AVX-512; backtester, performance metrics, γ-sizing and precision; the event-driven backtester; portfolio manifold, optimizer, geodesic path, Minkowski momentum and proper time; five N-asset suites; nine lock-free streaming suites; and the srfm::core::Engine integration suites.
bench_beta_gamma measures the scalar, AVX2 and AVX-512 batch β and γ kernels and the runtime dispatcher with Google Benchmark. `bench/BENCHMARK_RESULTS.md` records one earlier run on an Intel Xeon (Ice Lake); only that hand-written summary is committed, and it has not been reproduced for this README, so no speedup is claimed here. The benchmark skips the AVX-512 cases on CPUs without AVX-512F. Run it on your own hardware:
BENCHMARKS.md at the repository root describes the Rust layer, not these kernels.
Extended validation across BTC, ETH, and configurable altcoins using public Binance kline data. Tests whether the TIMELIKE/SPACELIKE classification replicates the equity variance result in 24/7 crypto markets.
Statistical pipeline:
Detailed notes per feature, in roughly the order they were added.
Interprets a portfolio's statistical moments as a 4-vector in financial spacetime and applies a Lorentz boost along the return-volatility plane.
Portfolio 4-vector:
Boost transformation (β ∈ (-1, 1), γ = 1/√(1 − β²)):
Minkowski invariant (conserved under all boosts):
| Class | Role |
|---|---|
PortfolioFourVector | Portfolio moments (ret, vol, skew, kurt) with sharpe() helper |
LorentzFactor | γ = 1/√(1 − β²); throws std::domain_error if |β| ≥ 1 |
LorentzBoost::transform(pf, β) | Apply boost, returns boosted PortfolioFourVector |
PortfolioInvariant::compute(pf) | Minkowski norm squared I |
OptimalBoost::find(target_sharpe, pf, step) | Grid-search β ∈ (−0.99, 0.99) to maximise ret'/vol' |
Tests: tests/lorentz/test_lorentz_portfolio.cpp (20+ GTest cases)
src/causal_cone.cppandsrc/hawking.cppare not part of any CMake target yet, so the APIs below are documented in their headers but not built or tested by CMake.
Applies the light-cone causality concept to financial OHLCV bar sequences. For each bar B, only past bars A with ds²(A→B) < 0 (TIMELIKE) are considered causally connected, SPACELIKE bars are excluded as "causally disconnected" noise.
Core types:
| Type | Responsibility |
|---|---|
CausalHistory | Causal predecessors of one bar; causal_fraction() metric |
CausalConeFilter | Scans a bar sequence and builds CausalHistory for every bar |
CausalSignal | Feature vector built only from causal bars (mean return, vol, momentum) |
CausalBacktest | Comparison: CausalSignal strategy vs all-bars baseline |
Hypothesis: signals derived exclusively from causally-connected bars should exhibit higher predictive accuracy because they exclude stochastic SPACELIKE noise.
Applies the Hawking radiation concept to detect price "event horizons": points of no return where a trend exhausts itself.
Hawking Temperature formula:
where z = (P − μ) / σ is the Bollinger Band z-score.
|z| ≥ bb_sigma (outside the 3σ Bollinger Band)Signal classification:
| T_H | Direction | Action |
|---|---|---|
> +2.0 | Reversal | Fade the extreme move |
< −2.0 | Continuation | Follow the trend |
[−2, +2] | Neutral | No position |
Key types:
HawkingTemperature { temperature, z_score, delta_z, bollinger_mean, bollinger_std, near_horizon }HawkingSignal { temperature, direction, strength, action }PriceEventHorizon, stateful Bollinger Band trackerHawkingBacktest, comparison against the TIMELIKE baselineA lightweight priority-queue event simulation engine that replays market events in strict timestamp order and dispatches them to a pluggable Strategy.
| Type | Role |
|---|---|
BacktestEvent | Market event: timestamp_ms, price, volume, EventType (Trade/Quote/Bar), symbol |
BacktestEngine | Priority-queue event loop; add_event(), run() → BacktestResult |
Strategy | Abstract base: on_trade(), on_bar(), on_start(), on_end() |
Order | Symbol, Buy/Sell side, quantity, Market/Limit type, limit_price |
Fill | Confirmed execution: fill_price, fill_qty, commission |
Portfolio | cash, positions map, equity_curve vector |
BacktestResult | total_return, sharpe_ratio, max_drawdown, num_trades, win_rate, profit_factor |
RelativisticStrategy | Concrete strategy: rejects spacelike events via SpacetimeInterval::classify() |
RelativisticStrategy converts each pair of consecutive market events into SpacetimeEvent structs and calls SpacetimeInterval::classify():
ds² < 0 (TIMELIKE): the price move is causally connected to the previous event, the strategy generates a momentum order.ds² > 0 (SPACELIKE): the move is faster than the market's "speed of information", the event is rejected as stochastic noise.This means only trades that respect the relativistic causal structure of financial spacetime are acted upon. spacelike_rejections() and timelike_accepts() counters are exposed for post-run analysis.
The CMake library target is srfm_event_backtest; link it with -lsrfm_event_backtest -lsrfm_manifold -lsrfm_backtest.
In financial spacetime, the geodesic between two portfolio states is the path of minimum action under the Lagrangian:
The Euler-Lagrange equations yield simple harmonic oscillator motion per weight dimension:
Analytical solution with boundary conditions w_i(0) = start[i], w_i(1) = end[i]:
| Class | Role |
|---|---|
PortfolioState | weights: vector<double> + timestamp_ms: int64_t |
Geodesic | states: vector<PortfolioState>, discretised path from start to end |
GeodesicSolver::solve(start, end, n_steps, lambda) | Returns a Geodesic with n_steps+1 waypoints satisfying boundary conditions |
| GeodesicLength::compute(geodesic) | Integrated arc length sum(||dw_i - dw_{i-1}||) |
Library target: srfm_geodesic_path Tests: tests/portfolio/test_geodesic_path.cpp (20+ GTest tests, test_geodesic_path binary)
Extends classical momentum to financial spacetime by representing a portfolio's exposure profile as a four-momentum vector p^μ = (E, p_x, p_y, p_z):
| Component | Physics | Finance |
|---|---|---|
E | Energy (time-like) | Portfolio return |
p_x | x-momentum | Equity exposure |
p_y | y-momentum | Bond exposure |
p_z | z-momentum | Commodity exposure |
A portfolio with m² > 0 (time-like) has total return exceeding its combined directional exposures, the financial analogue of a well-diversified, non-tachyonic portfolio. The signed square root m = sign(m²) * sqrt(|m²|) is the Minkowski invariant mass and is preserved under all Lorentz boosts (regime transformations).
Rapidity is additive under successive equity-space boosts, making it a natural measure of compounded equity momentum that avoids the non-additivity of ordinary velocity.
| Class | Key Methods |
|---|---|
FourMomentum | Data struct: energy, px, py, pz |
MinkowskiMomentum | invariant_mass_sq(p), invariant_mass(p), rapidity(p), transverse_momentum(p), spatial_magnitude(p) |
FourMomentumConservation | sum(trades), conserves(trades, reference, tol) |
MomentumPortfolioOptimizer | optimize(returns, exposures, config), gradient-ascent maximises m² |
Tests: tests/portfolio/test_minkowski_momentum.cpp, 20+ GTest cases covering invariant mass algebra, Lorentz invariance, rapidity edge cases, conservation checks, and the gradient-ascent portfolio optimiser.
Models portfolio dynamics using the proper time formalism from Special Relativity. A high-volatility ("fast-moving") portfolio is analogous to a relativistic observer: it experiences less proper time per calendar day, effectively taking longer to reach the same information state.
| Class | Role |
|---|---|
ProperTime | Static helpers: compute(t, v), gamma_factor(v), to_velocity(vol, max_vol) |
ProperTimeClock | Integrates dτ = dt / γ(v) over streaming volatility observations |
PortfolioAgingModel | Computes effective_age = t * γ and adj_sharpe = sharpe / √(effective_age) |
RelativisticRebalanceTimer | Fires rebalance events when accumulated proper time Δτ > threshold, reduces turnover in high-vol regimes |
Tests: tests/portfolio/test_proper_time.cpp, 25 GTest cases covering all classes and edge conditions.
src/multi_asset.cpp is compiled by python/setup.py for the Python extension, not by CMake.
Extends the single-asset framework to handle N correlated financial assets simultaneously, using a rolling correlation-based Lorentzian metric.
| Class | Responsibility |
|---|---|
MultiAssetEvent | N-asset spacetime event: symbols, prices, volumes, timestamp |
MultiAssetInterval | ds² in (N+1)-dimensional spacetime using the full metric tensor |
CorrelationMetric | Rolling correlation matrix → Lorentzian (N+1)×(N+1) metric with Cholesky regularisation |
MultiAssetLorentz | Per-asset and portfolio Lorentz boosts; metric-weighted portfolio β |
PortfolioGeodesic | Inertial portfolio trajectory; geodesic deviation as trading signals; geodesic weights |
Full Python API via pybind11, with a pure-Python fallback (no build required):
See examples/quickstart.ipynb for a complete walkthrough.
Full options pricing framework extending the financial manifold to derivative instruments. Replaces Black-Scholes constant-vol assumption with the Minkowski spacetime interval derived from the underlying's price trajectory.
| Type | Description |
|---|---|
RelativisticBlackScholes | B-S where σ is replaced by the spacetime metric |
LightconeOptionPricing | Two-regime vol surface: TIMELIKE < σ_base < SPACELIKE |
SpacetimeDelta | Relativistic hedge ratio Δ_rel = γ(β) · Δ_BS |
RelOrbitArbitrage | Flags options mispriced relative to spacetime regime |
Key derivations:
σ_eff = σ_base · √(1 − β²) for TIMELIKE, enhanced for SPACELIKE by σ_base / γ.e^{−rτ} where τ = T · √(1 − β²) < T for TIMELIKE trajectories.Δ_rel = γ(β) · N(d₁), larger hedge in fast-moving regimes because a unit price move covers more proper distance.Extends the Q1 2025 equity validation to cryptocurrency markets (BTC, ETH, and configurable altcoins) via the public Binance REST API.
Statistical tests:
Benchmarks:
Output: LaTeX + Markdown reports with confidence intervals.
Interactive egui-based visualizations for the SRFM financial manifold.
**SpacetimePlotter**, 2D Minkowski diagram:
**PortfolioManifoldViewer**, 3D scatter plot:
Simplified, pip-installable Python interface for the research community. Wraps the existing srfm package and exposes a dataclass-based API for options pricing, delta hedging, and portfolio manifold computation.
validation/portfolio_optimizer.py implements RelativisticPortfolioOptimizer, a multi-asset portfolio construction engine that uses the Minkowski metric to distinguish causal (TIMELIKE) from stochastic (SPACELIKE) cross-asset interactions.
| Class | Description |
|---|---|
AssetManifold | Asset worldline, prices, timestamps, per-bar beta and interval type |
PortfolioResult | Weights, relativistic Sharpe, TIMELIKE exposure, max drawdown |
RelativisticPortfolioOptimizer | Main optimizer class |
The optimizer computes a spacetime-weighted covariance matrix:
where spacelike_k = 1 - timelike_fraction_k. TIMELIKE-dominant assets retain full classical covariance; SPACELIKE-dominant assets are discounted, reducing their influence on portfolio risk.
validation/tick_streamer.py implements a real-time (or simulated) tick streaming pipeline that classifies each completed bar using SRFM and fires a BarSignal with momentum and alert flags.
| Class | Description |
|---|---|
Tick | Single market tick (timestamp, price, volume, bid, ask) |
BarSignal | Completed bar with beta, interval_type, ds^2, momentum, alert flags |
SimulatedTickFeed | Regime-switching synthetic tick generator (async) |
SRFMTickProcessor | Assembles ticks into bars, classifies, computes signals |
YahooFinanceFeed | Polling-based Yahoo Finance 1-minute bar stream |
| Field | Type | Description | |—|—|—| | beta | float | Normalised price velocity |dp| / (c * dt) | | interval_type | str | "TIMELIKE", "LIGHTLIKE", or "SPACELIKE" | | spacetime_interval | float | ds^2 = dp^2 - (c*dt)^2 | | momentum | float | Exponentially weighted rolling beta signal | | regime_change | bool | True on TIMELIKE <-> SPACELIKE transition | | lightlike_crossing | bool | True when |beta - 1| < 0.01 |
validation/signal_dashboard.py renders a live ANSI terminal dashboard for one or more symbols.
Each symbol renders a panel showing:
dashboard.update_weight(symbol, weight))The root Cargo.toml builds a Rust crate named tokio-prompt-orchestrator: an async LLM-inference orchestration service (TUI, HTTP/WebSocket API) that runs in mock mode with no external services. src/*.rs also holds a large set of exploratory physics-analogy modules (relativistic options, Penrose diagrams, gravitational waves, and more speculative ones such as string theory, dark matter and loop quantum gravity). These are concept code: they are not part of the C++ pipeline or the empirical study, and you do not need Rust to build or use the C++ library.
| Flag | Description |
|---|---|
tui | Ratatui terminal dashboard |
web-api | Axum HTTP/WebSocket server |
viz | egui interactive spacetime plotter (new in v2.0) |
| Module | Description |
|---|---|
relativistic_options | Options pricing via spacetime metric (new v2.0) |
viz | Interactive Minkowski diagram + portfolio scatter plot (new v2.0) |
geodesic_signals | Geodesic curvature trading signals |
proper_time | Proper-time portfolio correlation |
gravitational_waves | Matched-filter shock propagation |
penrose | Penrose diagram causal structure |
Requires the
web-apifeature. All inference endpoints requireAuthorization: Bearer <API_KEY>whenAPI_KEYis set. Public endpoints (/health,/metrics,/api/v1/schema) are always unauthenticated.
| Method | Path | Auth | Description |
|---|---|---|---|
POST | /api/v1/infer | Yes | Submit inference request; returns request_id |
POST | /api/v1/stream | Yes | SSE token stream; events: start, token, done |
GET | /api/v1/status/{id} | Yes | Poll request status |
GET | /api/v1/result/{id} | Yes | Block until result ready |
GET | /api/v1/ws | Yes | WebSocket bidirectional streaming |
GET | /api/v1/schema | No | OpenAPI 3.0 JSON schema |
GET | /health | No | {"status":"healthy","version":"..."} |
GET | /metrics | No | Prometheus text-format metrics |
Q: What does "financial speed of light" mean? A: It is the normalised unit velocity c = 1.0 that sets the boundary between TIMELIKE (causal, β < 1) and SPACELIKE (stochastic, β > 1) market movements. Its numerical value is calibrated to the instrument's volatility scale.
Q: Is this model physically rigorous? A: No, it is a mathematical analogy. Special relativity's formalism (Lorentz transforms, spacetime intervals, geodesics) is borrowed because the invariant interval ds² = −c²dt² + dP² + dV² + dM² produces empirically useful market-regime labels. We make no claim that financial markets obey special relativity.
Q: Why does TIMELIKE imply lower next-bar variance? A: That is the hypothesis. The pooled Bartlett test in validation/Q1_RESULTS.md supports it (p = 6×10⁻¹⁶), but the robust Levene test does not reach significance (p = 0.083); see The empirical question. TIMELIKE bars have |ΔP| < c·Δt, the price change is "sub-light" relative to the time elapsed, characteristic of momentum-driven, low-noise regimes.
Q: Can I use the Python package without building the C++ extension? A: Yes. python/srfm/__init__.py provides a complete pure-Python fallback for all classes. Install with pip install -e python/, no compiler or CMake required.
Q: What is the difference between SpacetimeInterval and MultiAssetInterval? A: SpacetimeInterval handles a single asset in 4D spacetime (t, P, V, M) with a fixed Minkowski metric. MultiAssetInterval handles N assets in (N+1)-dimensional spacetime where the spatial block is the rolling sample covariance matrix.
Q: How do I extend the metric to time-varying correlations? A: Call CorrelationMetric::update() with each new price bar. The metric is recomputed over the rolling window on every update.
Q: Do I need Rust to build the C++ library? A: No. The Rust crate provides the optional Tokio orchestration layer and TUI dashboard. The C++ library (CMakeLists.txt) builds independently.
Q: How does relativistic options pricing differ from classical Black-Scholes? A: Three key changes: (1) the effective volatility σ_eff is derived from the Minkowski spacetime interval rather than being a constant, TIMELIKE regimes get σ_eff = σ_base · √(1−β²), reducing vol in causal markets; (2) time-to-expiry is measured in proper time τ = T·√(1−β²), so options decay faster in TIMELIKE regimes; (3) the delta hedge ratio is multiplied by γ(β), amplifying the hedge in fast-moving markets.
Q: What is relfinance.py vs python/srfm/__init__.py? A: srfm/__init__.py is a comprehensive Python/pybind11 binding for the full SRFM C++ library. relfinance.py is a simpler, higher-level API focused on ease of use, it wraps srfm internally and adds the v2.0 options pricing and portfolio manifold APIs in a single flat module.
Q: How do I use the spacetime plotter interactively? A: Build with --features viz and embed SpacetimePlotter in an eframe app; there is no --viz command-line entry point yet. The plotter has a controls panel for zoom and the geodesic toggle and an inspect panel on hover. Feed data with SpacetimePlotter::push_raw(coord_time, log_price, beta).
The LaTeX source is in paper/ (main.tex, sections/01_abstract.tex to sections/08_conclusion.tex, bibliography.bib); a built copy is paper/main.pdf. The standalone paper repository with figure scripts is srfm-paper-impl.
Build the paper:
Before a PR:
Remove a suite from ci/known-failing-tests.txt when you make it pass; CI then keeps it green.
API contract (C++)
Every public function must:
std::optional<T> for all fallible paths; never throw.@brief, @param, and @return Doxygen tags.std::nullopt return).Python style
from __future__ import annotations).validation/requirements.txt.MIT, see [LICENSE](LICENSE). Version history in CHANGELOG.md.