Technical DocumentationUpdated June 2026

Our Methodology: Monte Carlo Simulation, Risk Models & Statistical Framework

This page describes, in full technical detail, how StressTest.pro models portfolio risk. It covers our Monte Carlo simulation engine, the statistical distribution assumptions we apply, how we handle historical dividends, and the derivation of our proprietary StressScore™ metric. We publish this document to uphold our commitment to algorithmic transparency for US investors.

Platform Overview & Trust Statement

StressTest.pro is a quantitative finance platform built to give individual US investors institutional-grade portfolio risk analytics. Every metric displayed on the platform is derived from a deterministic algorithm applied to historical market data — no black-box machine-learning models, no opaque scoring systems.

All calculations are performed on the backend using Python 3.14 / FastAPI deployed on Google Cloud Run. Price and dividend history is sourced from licensed financial data providers and stored in a CockroachDB time-series database, with hot-path caching via Redis (Upstash). Results are scoped strictly to the US equity and ETF universe unless the user explicitly adds international tickers.

What this platform is not: StressTest.pro does not provide investment advice, price targets, or buy/sell recommendations. All output is historical and statistical in nature. Past performance does not guarantee future results.


Monte Carlo Simulation Framework

Monte Carlo simulation is StressTest.pro's primary forward-looking projection engine. It models the range of possible future portfolio values by repeatedly sampling from a fitted return distribution and accumulating compounded growth over the projection horizon.

Path Generation

For each simulation run, we generate N independent paths, where N depends on the user's subscription tier:

  • Free / Premium tier: 1,000 simulation paths
  • Pro tier: 10,000 simulation paths

All return matrices are stored as float32 (32-bit floating point) rather than float64. This halves RAM consumption per simulation, enabling us to run 10,000 paths within Cloud Run's memory constraints without sacrificing meaningful precision for financial projections.

Core Simulation Formula

Each daily return for asset i at time step t is drawn as:

r_{i,t} = μ_i · Δt + σ_i · √Δt · z_{i,t}
Where μ_i is the annualised drift (mean log-return), σ_i is the annualised volatility (std dev of log-returns), Δt = 1/252 (one trading day), and z_{i,t} is a standard normal draw.

The portfolio value at time step t is then:

V_t = V_{t-1} · ∏_i (1 + w_i · r_{i,t})
Where w_i is the weight of asset i in the portfolio and V_0 is the initial portfolio value.

Output Percentiles

After all paths are generated, we report the 5th, 25th, 50th (median), 75th, and 95th percentile terminal values. The 5th percentile represents the Value at Risk (VaR) scenario — the level below which only 5% of simulated outcomes fall.


Statistical Distribution Models

Normal (Gaussian) — Base Model

By default, StressTest.pro models asset log-returns as normally distributed with parameters fitted from 10 years of daily historical data:

log(P_t / P_{t-1}) ~ N(μ, σ²)
μ = mean of historical log-returns; σ = standard deviation of historical log-returns (annualised by √252).

The Normal distribution assumption is well-understood, computationally efficient, and appropriate for long-horizon projections where the Central Limit Theorem partially offsets short-term fat tails. It is the industry-standard baseline for Monte Carlo portfolio modelling.

Student-t (Fat-Tail) — Pro Tier

For Pro tier users, the Fat-Tail Risk Score uses a Student-t distribution fitted via maximum likelihood estimation (MLE) using scipy.stats.t.fit(). The degrees-of-freedom parameter (ν) captures the excess kurtosis observed in empirical US equity return distributions — i.e., the "fat tails" that the Normal model understates.

r ~ t_ν(μ, σ) where ν = MLE-fitted degrees of freedom
A lower ν (typically 3–6 for US equities) implies heavier tails and a higher probability of extreme loss events.

Cholesky Decomposition — Correlated Multi-Asset Paths

When simulating portfolios with multiple assets, we must preserve the empirical correlation structure between them — otherwise the simulation overstates diversification benefits. We achieve this using Cholesky decomposition of the asset return correlation matrix:

σ = L · Lᵀ (Cholesky factorisation) z_corr = L · z_indep where z_indep ~ N(0, I)
Σ is the empirical covariance matrix; L is the lower-triangular Cholesky factor; z_indep is a vector of independent standard normals; z_corr is the correlated return draw.

This ensures that simulated paths for, for example, SPY.US and QQQ.US reflect their historically high positive correlation (~0.90+), rather than being modelled as independent assets. The correlation matrix is recomputed nightly from the most recent 252 trading days of data.


Historical Dividend Handling

Total-Return Basis

All historical performance metrics on StressTest.pro — including CAGR, Max Drawdown, Sharpe Ratio, and the Monte Carlo drift parameter μ — are calculated on a total-return basis. This means dividend distributions are assumed to be reinvested on the ex-dividend date at the closing price, producing a total-return price series equivalent to what a DRIP (Dividend Reinvestment Plan) investor would have experienced.

Ex-Dividend Date Handling

Dividends are applied by adjusting the price series backward from the ex-dividend date using the standard adjustment factor:

P_adj = P_raw × ∏ ((P_ex - D) / P_ex)
P_ex = closing price on the day before the ex-dividend date; D = dividend per share. Applied retrospectively to all historical prices before the ex-date.

Forward-Looking Dividend Yield

The dividend yield displayed on comparison and asset pages uses a trailing twelve-month (TTM) sum of distributions divided by the most recent closing price. This is the industry- standard method and matches how Vanguard, iShares, and Morningstar report yield for US ETFs.

Tax note (US-specific): The platform does not adjust for individual tax treatment. US investors should be aware that qualified dividends (held >60 days, from US corporations) are taxed at preferential long-term capital gains rates, while non-qualified dividends are taxed as ordinary income. Consult a licensed tax advisor for personalised guidance.


StressScore™ Proprietary Metric

The StressScore™ is a proprietary composite risk metric developed by the StressTest.pro engineering team to provide a single, interpretable number summarising an asset's stress profile. It is displayed on comparison pages alongside individual volatility and drawdown metrics.

Formula

StressScore = round( (σ_annualised × 0.5 + |MDD| × 0.5) × 100 )
σ_annualised = annualised standard deviation of daily log-returns (expressed as a decimal, e.g. 0.18 for 18%); MDD = maximum peak-to-trough drawdown magnitude (expressed as a positive decimal, e.g. 0.34 for a -34% drawdown).

Severity Tiers

Score RangeLabelInterpretation
0 – 20LowTypical of short-duration US bond funds (e.g. BIL, SHV). Very low historical stress events.
21 – 40ModerateTypical of diversified US equity index funds (e.g. VTI, SPY). Drawdowns of 20–35% in severe bear markets.
41 – 60HighTypical of sector ETFs (e.g. XLK, ARKK). Concentrated exposure amplifies both gains and drawdowns.
61+ExtremeTypical of leveraged or single-stock ETFs. Drawdowns exceeding 50% are historically common.

The 50/50 weighting between volatility (σ) and drawdown magnitude (|MDD|) reflects the view that both the day-to-day fluctuation experienced by an investor and the worst-case capital destruction event are equally important dimensions of psychological risk. An asset that is moderately volatile but experiences catastrophic drawdowns should score similarly to one with high day-to-day volatility but shallower drawdowns — both represent comparable levels of investor stress in practice.


Tier Limits & Computational Constraints

To ensure platform profitability and equitable resource allocation, computational access is tiered. Limits are enforced at the API middleware layer before any calculation is executed.

TierMax AssetsMC PathsDaily Run Limit
Free3Historical only—
Premium ($4/$10)101,00030
Pro ($30)5010,000200

Min-CVaR optimisation and Correlation Breakage chaos testing are restricted to the Pro tier exclusively, due to their non-linear computational complexity which scales significantly with asset count.


Limitations & Disclaimers

All models are approximations. The following limitations apply to StressTest.pro's quantitative outputs:

  • Stationarity assumption: Our Monte Carlo engine assumes that the statistical properties (mean, variance, correlations) of asset returns are stationary over the projection horizon. In reality, these parameters shift with macro regimes, Federal Reserve policy, and structural market changes.
  • Lookback bias: Parameters are fitted to the most recent 10-year historical window. If this window does not include a stress event representative of future conditions (e.g., a regime similar to 1970s stagflation), the model may understate true tail risk.
  • No transaction costs or taxes: Simulated returns do not deduct brokerage commissions, bid-ask spreads, fund expense ratios (beyond those embedded in historical prices), or US capital gains taxes.
  • Not investment advice: StressTest.pro is an analytical tool. No output on this platform constitutes a personalised investment recommendation. Always consult a qualified financial advisor before making investment decisions.

Ready to apply these models to your own portfolio?

Run a Monte Carlo simulation or compare two US ETFs using the same statistical framework described above.