Skip to content

Methods

Definitions, conventions & limitations

These are the exact conventions implemented in the computational engine. Full derivations and numerical tests are in the repository's MATHEMATICS.md and TESTING.md.

Measures

The Probability Field, Risk Observatory and Stress Laboratory simulate under the physical measure P, with drift estimated from history (or set to zero), and label every output as model-generated. The Derivatives Reactor prices under the risk-neutral measure Q with drift r − q. Historical expected returns are never used as risk-neutral drifts. Calibration uses only observations dated on or before the calibration end date. Historical drift estimates carry a standard error of roughly σ/√years, which is shown next to each estimate.

Stochastic models

GBM
dS = μS dt + σS dW. Exact: ln S_{t+Δ} = ln S_t + (μ − σ²/2)Δ + σ√Δ Z. Multi-asset: Z = Lε, L = chol(R).
Ornstein–Uhlenbeck
dX = κ(θ − X)dt + σ dW on X = ln S, exact Gaussian transition. Calibrated by AR(1) OLS on log prices.
Merton jump diffusion
Adds compound-Poisson log jumps N~Poisson(λΔ), Y~N(m, s²), with compensated drift so E[S_T] = S_0 e^{μT}. Calibration: robust-threshold jump detection (heuristic).
Heston
dS = μS dt + √v S dW₁, dv = κ(θ − v)dt + ξ√v dW₂, ρ = corr(dW₁, dW₂). Full-truncation Euler (O(Δ) bias). Physical-measure parameters are a GARCH-based moment proxy, not an MLE.
Historical bootstrap
i.i.d. resampling of joint daily return vectors (keeps cross-sectional dependence, drops serial dependence).
Block bootstrap
Politis–Romano stationary bootstrap, geometric blocks of mean L, circular.

Statistics

Log return
r_t = ln(P_t / P_{t−1}) on adjusted daily closes. Simple return R_t = P_t/P_{t−1} − 1 = e^{r_t} − 1.
Annualisation
P observations per year: 252 for equities/FX (trading days), 365 for crypto (calendar days). Mean × P, volatility × √P. Mixed-calendar portfolios use common dates and P = 252.
Historical volatility
Sample standard deviation (ddof = 1) of daily log returns × √P.
Annualised return
Geometric: (Π(1+R_p,t))^{P/T} − 1 for a portfolio rebalanced daily to target weights. Arithmetic: mean(R_p) × P.
Covariance / correlation
Sample covariance of daily simple returns; Pearson correlation. Correlation matrices used for simulation are checked for positive definiteness and repaired by eigenvalue clipping when needed (reported).
Value at Risk (VaR_c)
Loss L = −R (positive = loss). VaR_c is the empirical c-quantile of L using the inverted-CDF order statistic L_(⌈cN⌉). 95% CI from binomial order-statistic bounds (distribution-free).
Expected Shortfall (ES_c / CVaR)
Mean of the worst ⌈(1−c)N⌉ losses. Gaussian ES = −μ + σ φ(z_c)/(1−c).
Maximum drawdown
min_t (W_t / max_{s≤t} W_s − 1) on the daily wealth index W.
Downside deviation
√(mean(min(R_t − r_f,daily, 0)²)) × √P.
Sharpe ratio
mean(R_p − r_f,daily) / sd(R_p) × √P. r_f from FRED DTB3 (3-month T-bill), converted from discount yield.
Sortino ratio
mean(R_p − r_f,daily) / downside deviation × √P.
Beta
Cov(R_p, R_b) / Var(R_b) on common daily simple returns.
Risk contribution
Euler allocation RC_i = w_i (Σw)_i / σ_p; Σ RC_i = σ_p. Shown as a share of portfolio volatility.
Concentration
HHI = Σ w_i²; effective number of assets = 1/HHI.
VaR backtest
1-day 95% historical VaR from the previous 250 observations only, compared with the next day's loss; Kupiec (1995) proportion-of-failures LR test, χ²(1).
EWMA
σ²_{t+1} = λ σ²_t + (1−λ) r_t², λ = 0.94 (RiskMetrics).
GARCH(1,1)
σ²_t = ω + α r²_{t−1} + β σ²_{t−1}, Gaussian quasi-MLE on de-meaned returns, constrained ω>0, α,β≥0, α+β<1. h-step forecast σ²_{t+h} = V_L + (α+β)^{h−1}(σ²_{t+1} − V_L).
Regimes
Two-state Gaussian hidden Markov model by Baum–Welch (scaled forward–backward). Filtered probabilities use data to t only; smoothed use the whole sample.
Forecast evaluation
Out-of-sample: parameters on the first 70%, one-step forecasts on the remainder. MSE and QLIKE vs r².

Reproducibility

Batch b of a simulation draws from NumPy PCG64 seeded with SeedSequence(seed, spawn_key=(b,)). The batch size depends only on the workload, so (seed, request, input data) determine the result bit-for-bit on the same library versions. Saved experiments store SHA-256 digests of the numerical result and of the input price matrix. When a provider later revises history (for example, a new split adjustment), reproduction reports that the input data changed.

Known limitations

  • Daily data only. No intraday calibration.
  • Crypto daily candles close at 00:00 UTC while equities close at 16:00 ET. Correlations across asset classes are therefore biased toward zero.
  • No transaction costs except the explicit stress-test exit cost. Portfolios are rebalanced daily in the historical analytics and held buy-and-hold in simulation.
  • Options: dividends are a continuous yield, the rate is flat, and only the binomial tree handles early exercise.
  • No GPU is used by this deployment. All reported timings are CPU timings on the stated hardware.