Quantitative Methodology

How MAISNER Works

A technical reference for the mathematical models underlying the platform. Written for quantitative professionals, portfolio managers, and technically minded investors.

Portfolio Optimization — Mean-Variance

MAISNER implements Markowitz Mean-Variance Optimization (MVO) with several institutional-grade enhancements. The core problem maximizes the Sharpe ratio subject to linear constraints.

Objective Function

Max Sharpe Portfolio
\[ \max_{\mathbf{w}} \frac{\mathbf{w}^\top \boldsymbol{\mu} - r_f}{\sqrt{\mathbf{w}^\top \boldsymbol{\Sigma} \mathbf{w}}} \]
where w = portfolio weights, μ = expected return vector, Σ = covariance matrix, rf = risk-free rate (3.80%)

Constraints

Standard Constraints
\[ \sum_i w_i = 1, \quad w_i \geq 0, \quad w_i \leq w_{max} \]
Full investment, long-only, individual weight cap (default 35%)

Three portfolios are computed simultaneously: Max Sharpe, Minimum Variance, and Equal Weight. This allows direct comparison of optimization strategies against a naive benchmark.

ParameterValueDescription
RISK_FREE3.80%Risk-free rate (ECB rate proxy)
WEIGHT_MAX35%Maximum weight per asset
FREQ252 / 12Daily if ≥400 obs, else monthly

Constrained Optimization

The Constrained Optimizer allows portfolio managers to impose explicit structural requirements on individual positions and sectors, then optimizes the remaining free budget using the same RMT-MVO engine. This is the institutional standard for managing client mandates, regulatory constraints, and conviction-driven overrides.

Asset Partition

All assets in the portfolio are classified into one of three sets before optimization begins.

Partition of Assets
\[ \mathcal{A} = \mathcal{L} \cup \mathcal{B} \cup \mathcal{F} \]
𝓛 = locked set (fixed weight: wi = wilock)
𝓑 = bounded set (per-ticker bounds: lbi ≤ wi ≤ ubi)
𝓕 = free set (standard bounds: 0 ≤ wi ≤ wmax)

Remaining Budget

Free Budget After Locking
\[ c_{\mathcal{F}} = 1 - \sum_{i \in \mathcal{L}} w_i^{\text{lock}} \]
The optimizer distributes c𝓕 across 𝓑 ∪ 𝓕. If locked weights sum to more than 1, the problem is infeasible and an error is raised before optimization.

Full Optimization Problem

Constrained Max Sharpe
\[ \max_{\mathbf{w}} \frac{\mathbf{w}^\top \boldsymbol{\mu} - r_f}{\sqrt{\mathbf{w}^\top \boldsymbol{\Sigma} \mathbf{w}}} \] \[ \text{subject to} \quad \sum_i w_i = 1 \] \[ w_i = w_i^{\text{lock}}, \quad i \in \mathcal{L} \] \[ \mathrm{lb}_i \leq w_i \leq \mathrm{ub}_i, \quad i \in \mathcal{B} \] \[ 0 \leq w_i \leq w_{\max}, \quad i \in \mathcal{F} \] \[ \sum_{i \in \text{sector}_k} w_i \leq s_k^{\max}, \quad \forall k \]
Locked positions enter the covariance matrix in full — they affect the risk structure of the free portfolio. Sector caps are applied to the entire weight vector, including locked positions.
Locked positions shift the covariance structure of the optimization subproblem. Adding a zero-weight locked asset changes the T/N ratio in the RMT filter and the Cholesky decomposition — this is mathematically correct behavior, not a bug.

Constraint Types

TypeSyntaxDescription
Locked weightwi = cPosition fixed at exact percentage. Optimizer cannot move it.
Locked sharesni = kFixed number of shares. Weight derived from current market price.
Min/max per tickerlbi ≤ wi ≤ ubiOptimizer chooses within the specified range.
Sector floorΣsector ≥ sminForces minimum allocation to a sector.
Sector ceilingΣsector ≤ smaxCaps total allocation to a sector (default 40%).

Feasibility — checked before and after optimising

Before optimising, the complete linear system (Σw = 1, per-asset bounds, user sector floors/ceilings, or the default 40% sector caps and 50% combined ETF cap when no sector constraint is given and n ≥ 8) is solved as a feasibility linear programme (HiGHS). If no portfolio satisfies it, the job stops with the reason shown to the user: e.g. “the per-asset maximums allow at most 60% to be invested”, “sector minimums add up to 110%”, or a sector floor on a sector the portfolio does not hold. After optimising, every returned weight vector is checked against the same system (tolerance 10−4); a violation is an error, never a silently returned portfolio. (Before November 2026 an infeasible set returned the optimiser’s start vector — e.g. 50/50 over a 35% cap.)

Small books. Free assets use the cap max(WEIGHT_MAX, min(0.50, max(1.5/n, 1/(n−1)))) when n < 8 — the same adaptive bound as the main optimizer — so a 2-asset book can still be fully invested.

Sector names. Sector constraints are matched to the canonical sector groups (Technology, Financials, Energy, Healthcare, Consumer Staples, …); legacy labels (Finance, Oil/Gas, Consumer, Banks, …) are accepted as aliases. An unknown name is rejected — it used to be dropped silently, which also switched off the default caps. Sectors come from FMP when available, otherwise from the last FMP answer stored on disk, otherwise from the Stocks.xlsx sector column, so the same tickers always get the same sectors.

Units. The UI sends fractions (5% → 0.05). API callers may send fractions or percents; a value greater than 1 is read as a percent.

Risk-Free Rate and the Cost of Constraints

The Sharpe objective, the reported Sharpe ratios and the constraint-cost analysis all use the user’s risk-free rate. The cost of constraints compares the constrained optimum with the true unconstrained long-only maximum-Sharpe portfolio (only w ≥ 0, Σw = 1; no caps, no tilts), obtained by homogenisation y = κw:

min yTΣy   s.t. (μ − rf)Ty = 1, y ≥ 0  ⇒  wunc = y / Σy,    cost = SR(wunc) − SR(w*) ≥ 0

Multi-Asset · CVaR Engine

The CVaR engine replaces variance by Conditional Value-at-Risk at the user’s confidence level α (default 95%), estimated on S historical monthly scenarios rs (months where every asset has a price; simple returns, re-centred so each asset’s scenario mean equals its expected return / 12 — history supplies the tail shape and co-movement, the engine supplies the expected return). At least 36 common months are required. Every problem is a linear programme (Rockafellar & Uryasev, 2000) over the same linear constraint system as the MVO engine:

CVaRα(w) = minζ ζ + (1/((1−α)S)) Σs max(0, −rsTw − ζ)
ModeProblem
Conservativemin CVaRα(w)
Standardmax STARR = (μ − rf)Tw / CVaRα(w) — homogenised LP: max (μ−rf)Ty s.t. CVaRα(y) ≤ 1, constraints scaled by κ
Balancedthe STARR portfolio, blended toward min-CVaR until σ ≤ vol cap
Aggressivemax μTw (identical in both engines)
Dividendmax yieldTw − 0.3·√12·CVaRα(w)

The result reports the 1-month CVaRα of the optimal, minimum-risk and equal-weight portfolios (and the current holdings in the analyzer). Until November 2026 the “Multi-Asset (CVaR)” button ran the MVO engine unchanged.

Random Matrix Theory — Covariance Cleaning

Raw sample covariance matrices are notoriously noisy for typical portfolio sizes. MAISNER applies Marchenko-Pastur filtering to separate signal eigenvalues from noise eigenvalues.

Marchenko-Pastur Distribution

Noise Eigenvalue Bounds
\[ \lambda_{\pm} = \sigma^2 \left(1 \pm \sqrt{\frac{N}{T}}\right)^2 = \left(1 \pm \frac{1}{\sqrt{q}}\right)^2,\qquad q = \frac{T}{N},\ \sigma^2 = 1 \]
T = observations of the sample the correlation was estimated on, N = assets. Eigenvalues of the correlation matrix below λ+ are noise and are replaced by their mean (trace preserved); the matrix is rebuilt and re-normalised to a unit diagonal. At least nsectors eigenvalues are always kept as signal.

Ledoit-Wolf Shrinkage (small q)

Shrinkage of the Correlation Toward the Identity
\[ C_{LW} = (1-\alpha)\,C + \alpha\,I,\qquad \Sigma = D\,C_{LW}\,D,\quad D = \mathrm{diag}(\sigma_i) \]
α = Ledoit-Wolf (2004) intensity estimated on the standardised sample (OAS when no complete sample is available). Only the correlation is shrunk — the annualised volatilities σi are kept exactly. Method by q: q ≥ 10 → Marchenko-Pastur; 3 ≤ q < 10 → Marchenko-Pastur then Ledoit-Wolf; q < 3 → Ledoit-Wolf only.

The ratio Q = T/N determines the noise floor. For small portfolios with limited history, RMT cleaning provides substantial improvement in out-of-sample covariance estimates. The cleaned matrix retains the information eigenvalues (genuine risk factors) while suppressing estimation error.

MAISNER uses 2-year daily log returns for both the volatilities and the correlation matrix, and the RMT threshold and the Ledoit-Wolf intensity are computed from that same daily sample (e.g. T = 501, N = 10 → q = 50, Marchenko-Pastur). If daily prices are unavailable, the correlation falls back to the last 24 monthly returns of the price database (q small → Ledoit-Wolf) and the volatilities to the stored 1-year volatility. A hybrid approach (10-year monthly + 2-year daily) was tested but produced spurious correlations between unrelated assets.

Quality Tilt

Pure Sharpe maximization concentrates in a few names and ignores fundamentals. The Standard and Balanced modes therefore optimise a regularised Sharpe objective (8 or more assets; smaller portfolios use the pure Sharpe ratio):

Standard / Balanced Objective
\[ \max_{\mathbf{w}}\; \frac{\mathbf{w}^\top\boldsymbol{\mu} - r_f}{\sqrt{\mathbf{w}^\top\Sigma\mathbf{w}}} \;-\; 0.30\,\frac{\ln N - H(\mathbf{w})}{\ln N} \;-\; 0.15\,\max\!\left(0,\ 0.45 - \mathbf{w}^\top\mathbf{q}\right) \;+\; 0.05\,\mathbf{w}^\top\mathbf{m} \]
H(w) = −Σ wi ln wi (entropy; the second term is 0 for equal weights), q = quality scores in [0, 1], m = 52-week momentum rescaled to [0, 1] within the portfolio, rf = the user's risk-free rate. Subject to Σw = 1, 0 ≤ wi ≤ max weight, sector floor/cap (40%), ETF combined cap 50%. Among the SLSQP restarts, the portfolio with the highest Sharpe ratio is reported. Balanced adds σp ≤ cap. Conservative = minimum variance (no sector constraints); Aggressive = maximum return; Dividend = max Σwiyi − 0.3σp.

Quality Score

Sector-specific composite in [0, 1]; each metric is mapped to a sub-score in [0, 1] and averaged with the weights below (weights of missing metrics are dropped and the rest renormalised). Percent fields are used in their stored units: ROE, ROA, margins and revenue growth as decimals (ROE 118% = 1.18), FCF yield and payout ratio in percent.

Asset typeMetrics (weight)
ETFyield (0.40), 52w momentum (0.35), max drawdown (0.25)
FinanceROE (0.25), ROA (0.15), P/E (0.15), P/B (0.10), FCF yield (0.15), payout (0.10), momentum (0.10)
Other stockscurrent ratio (0.10), gross margin (0.10), operating margin (0.10), ROE (0.15), ROA (0.05), P/E (0.10), D/E (0.10), interest coverage (0.05), FCF yield (0.10), revenue growth (0.05), payout (0.05), momentum (0.05)
QUALITY_THRESH0.45 (portfolio quality below this is penalised)

CVaR Optimization

For multi-asset portfolios including options and non-linear instruments, mean-variance optimization is inappropriate. MAISNER uses Conditional Value-at-Risk (CVaR) minimization via linear programming.

CVaR Definition

Expected Shortfall
\[ \text{CVaR}_\alpha = \mathbb{E}[L \mid L \geq \text{VaR}_\alpha] \]
α = 0.95. CVaR is the expected loss given that losses exceed the 95th percentile VaR.

Correlated Scenario Generation

Cholesky Decomposition
\[ \mathbf{R}_{sim} = \mathbf{L} \mathbf{Z}, \quad \mathbf{\Sigma} = \mathbf{L} \mathbf{L}^\top \]
L = Cholesky factor of the RMT-cleaned covariance matrix. Z = matrix of independent standard normal draws. Produces correlated return scenarios preserving cross-asset dependencies.
ParameterValue
Scenarios5,000
Alpha0.95
MethodLP (linear programming)
CorrelationCholesky on RMT-cleaned Σ

Monte Carlo Simulation

Long-horizon wealth projections for the Optimizer, Analyzer and Constrained engines simulate the value of the (rebalanced) portfolio as a single Geometric Brownian Motion, with the portfolio volatility from the RMT-cleaned covariance matrix — correlations enter through σp = √(wᵀΣw).

GBM Portfolio Value
\[ V_T = V_0 \exp\left[\left(\mu_{MC} - \frac{\sigma_p^2}{2}\right)T + \sigma_p \sqrt{T}\, Z\right], \quad Z \sim \mathcal{N}(0,1) \] \[ \text{median} = e^{(\mu_{MC}-\sigma_p^2/2)T}, \quad P_{5/95} = e^{(\mu_{MC}-\sigma_p^2/2)T \mp 1.645\,\sigma_p\sqrt{T}}, \quad P(\text{loss}) = \Phi\!\left(-\frac{(\mu_{MC}-\sigma_p^2/2)T}{\sigma_p\sqrt{T}}\right) \]
The terminal value is drawn exactly from its lognormal law (10,000 draws, fixed seed); the fan chart bands are the exact lognormal quantiles at each t, so the chart and the read-out agree. Validated against the closed forms above (median, P5/P95, P(loss), P(×2)).

Which μ is simulated

CAPM-implied drift
\[ \mu_{MC} = r_f + \beta_p \cdot \text{ERP}, \qquad \beta_p = \sum_i w_i \beta_i, \qquad \text{ERP} = 5\% \]
rf = your risk-free rate, βi from the fundamentals database, ERP = equity risk premium (the same 5% the hedging engine uses).

Everywhere else in MAISNER the expected return of an asset is its trailing 5-year price CAGR. That is a reasonable ranking input for the optimizer, but as a 10-year forward drift it extrapolates an exceptional half-decade: a conservative large-cap book with a 19.9% trailing CAGR projected a ×6.8 median and a 0.0% probability of loss over ten years (×34 for an aggressive book). No forecaster would sign that. The simulation therefore uses the return the market is compensated for bearing the book's systematic risk; the same book projects μ ≈ 7.6%, median ≈ ×2.0, P(loss) ≈ 4%. The historical CAGR is still shown next to the simulation (μ HIST 5Y) for comparison, but it is not simulated. A book with β ≈ 0 (e.g. market-neutral) is projected at the risk-free rate — any alpha is deliberately not extrapolated.

ParameterValue
Draws10,000 (terminal value, exact lognormal)
Horizon10 years
DriftCAPM: rf + βp × 5% (historical CAGR shown, not simulated)
Output5th / 50th / 95th percentile
MetricsP(loss), P(2×), Median@10y, Range

Stress Testing

Three engines share one category model: a historical replay on monthly closes, a category-impact estimate for any of the 53 catalogued crises, and a custom scenario builder.

Category of a position

Each position is mapped to one category: first by asset class (bond ETFs → bonds, high-yield ETFs → high_yield, gold ETFs → gold, broad indices → equities, regional ETFs → em / europe / uk / china / japan), otherwise by its sector, with the industry separating banks and insurers inside Financials. The crisis impact is then looked up along a fallback chain — e.g. banks → financials → equities, telecom → media → equities. Bonds, high yield, gold and commodities never inherit the equity shock: if a crisis has no entry for their class they are held flat and the breakdown says so.

Historical replay (monthly closes)

Return over the crisis window
\[ r_i = \frac{P_i(\text{last})}{P_i(\text{base})} - 1, \qquad R = \sum_i w_i\, r_i \]
Monthly bars are month-end closes. base = close of the month before the crisis starts, last = close of the month in which it ends (COVID 2020-02-01 → 2020-04-01: Jan close → Mar close). A position without both closes (listed later, or a crisis before the price history begins) takes its category impact instead; coverage reports the share of the book replayed from prices.

With every position covered the chart is the actual buy-and-hold value of the book month by month, V(t) = 1 + Σ wi(Pi(t)/Pi(base) − 1): the max drawdown is realised and the recovery time runs from the start of the crisis until V is back at 1 on the closes after it (not recovered if it never is within the data).

Category-impact estimate and illustrative path

Portfolio shock and Brownian-bridge path
\[ R = \sum_i w_i\, s_{c(i)}, \qquad \ln V_t = \sigma W_t - \tfrac{t}{T}\sigma W_T + \tfrac{t}{T}\ln(1+R) \]
sc = crisis impact of category c, σ = the crisis volatility, T = its duration. The bridge is a Brownian path pinned at the crisis outcome: its volatility is σ and it ends exactly at 1 + R. It illustrates a route to the outcome; its drawdown is indicative and no recovery time is reported for it.
Shock in σ
\[ z = \frac{\ln(1+R)}{\sigma\sqrt{T}} \]
The loss in units of the volatility over the shock period (σ√T); −2σ is roughly a 1-in-40 move for that period under normality. σ is the crisis volatility in both modes — two or three month-end closes cannot estimate a volatility (the replay shows a realised volatility only when the window has at least six monthly returns).
CrisisWindowT (y)σEquitiesOther categories
Global Financial Crisis (2007–2009)2007-10-01 → 2009-03-011.550%-55%financials -60%, banks -70%, technology -40%, energy -30%, bonds +10%, real_estate -35%, consumer -40%, industrials -45%
COVID-19 Crash (2020)2020-02-01 → 2020-04-010.260%-35%technology -30%, energy -50%, travel -60%, bonds +5%, healthcare -5%, defense +10%, consumer -40%
Inflation Shock (2022)2022-01-01 → 2022-10-010.830%-20%technology -25%, energy +10%, bonds -15%, commodities +25%, financials -12%, banks -10%
Dot-Com Bubble (2000–2002)2000-03-01 → 2002-10-012.640%-45%technology -75%, financials -20%, telecom -50%, media -60%, consumer -30%
SVB Collapse (2023)2023-03-01 → 2023-03-310.140%-10%financials -25%, banks -30%, technology -5%

Advanced Stress — Custom Shocks

Per position the first match wins: a ticker shock, a sector shock (along the same category chain, so a Financials shock reaches banks), the base crisis impact, then the market shock — which applies to equity-like categories only; bonds, gold and commodities move only when shocked explicitly. Spillover adds λ × Σ (shocks of the other shocked sectors) to equity-like positions, excluding the sector chain the position already took. The path is the same Brownian bridge with the scenario σ and T.

Leverage Analysis

The Leverage Analyzer quantifies the risk and return impact of applying financial leverage to a portfolio. It combines the Kelly Criterion for optimal leverage sizing with continuous-time volatility decay, margin call analytics, and Monte Carlo liquidation probability.

Kelly Criterion — Optimal Leverage

Kelly Optimal Leverage
\[ f^* = \frac{\mu_p - r_f}{\sigma_p^2} \]
μp = annualised portfolio return, rf = your risk-free rate (Settings; default 3.80%), σp = annualised portfolio volatility. f* is the leverage ratio that maximises the long-run geometric growth rate. Half Kelly (f*/2) is the standard practical optimum. The portfolio Sharpe shown next to Kelly uses the same rf.
Which μ. As everywhere in MAISNER, μp = Σ wi·CAGRi — the weighted 5-year price CAGR, a geometric rate. The Kelly formula and the GBM drift are written for the arithmetic mean, which is higher by about σ²/2. Using the CAGR is the conservative side: on an AAPL/MSFT/JNJ/GLD book f* = 8.04 instead of 8.40 (−4%), and the liquidation probability moves by less than 0.2 pp. It is kept for consistency with the optimizer's expected returns.

Drawdown Leverage Cap (Paleologo)

Maximum Leverage for a Loss Budget
\[ L_{\max} = \frac{D}{\sigma_p\sqrt{T}\,\left(\kappa z_p - SR\sqrt{T}\right)},\qquad z_p = -\Phi^{-1}(p),\quad SR = \frac{\mu_p - r_f}{\sigma_p} \]
G. Paleologo, Advanced Portfolio Management (APM), §10.1, eq. 10.3. The return of one unit of equity levered L times over horizon T is modelled as N(L·SR·σp·T, (L·κσp√T)²), with leverage financed at the risk-free rate (the book's convention). Lmax is the largest leverage at which a loss of more than D has probability at most p. Inputs: D = tolerated loss of equity (default 20%), p = accepted probability (default 5%), T = horizon in years (default 1), κ = fat-tail multiplier on volatility (1 = normal). If κzp ≤ SR√T the denominator is not positive: a loss beyond D then has probability below p at any leverage and the budget sets no cap (shown as "not binding"); margin-call and liquidation risk still apply. The screen also reports the probability of a loss beyond D at the selected leverage: Φ((−D/L − SR·σp·T)/(κσp√T)).

Leveraged Return and Volatility

Leveraged Portfolio Metrics
\[ \mu_L = L \cdot \mu_p - (L - 1) \cdot r_m \] \[ \sigma_L = L \cdot \sigma_p \] \[ S_L = \frac{\mu_L - r_f}{\sigma_L} \]
L = leverage ratio, rm = margin borrowing rate. Net return subtracts the financing cost on the borrowed fraction (L−1) of portfolio value. Volatility scales linearly with leverage.

Volatility Decay (Continuous-Time Drag)

Leverage Decay
\[ \text{decay} = -\frac{1}{2}(L^2 - L)\,\sigma_p^2 \]
Arises from the Itô correction in continuous-time GBM. At L=1 decay is zero; at L=2 it equals −½σ². Grows quadratically — a 3× levered position on a 20% vol portfolio loses ~3.6% per year to decay alone before financing costs.

Margin Call Threshold

Margin Call Drop (FINRA Rule 4210)
\[ \text{equity}_t = L P_t - (L-1), \qquad \frac{\text{equity}_t}{L P_t} < m \;\Longleftrightarrow\; P_t < \theta = \frac{L-1}{L(1-m)} \] \[ \Delta_{MC} = 1 - \theta \]
Pt = unleveraged portfolio value (P0 = 1), m = maintenance margin as a fraction of the CURRENT position value: 25% (US FINRA; EU professional clients — brokers set their own; 50% is the ESMA initial margin for retail CFDs, not a maintenance level). At 2× leverage: θ = 0.667, ΔMC = 33.3%; at 3×: ΔMC = 11.1%. At the trigger, equity / position = m exactly.

Monte Carlo Liquidation Probability

MAISNER simulates 5,000 GBM paths of the unleveraged portfolio over 252 trading days and checks them against the margin-call barrier every day. The loan accrues margin interest, so the barrier rises over the year: a book that is safe today can be called later at the same price.

GBM Path (Daily) and Rising Barrier
\[ P_{t+1} = P_t \cdot \exp\!\left[\left(\mu_p - \frac{\sigma_p^2}{2}\right)\frac{1}{252} + \sigma_p \sqrt{\frac{1}{252}}\, Z_t\right] \] \[ \text{loan}_t = (L-1)\,e^{r_m t} \;\Rightarrow\; \theta_t = \theta\, e^{r_m t}, \qquad \text{liquidation} \iff \exists\, t \le 1:\; P_t < \theta_t \]
Zt ~ N(0,1), seeded deterministically (seed=42). rm = margin rate. Liquidation probability = fraction of the 5,000 paths that cross θt. Validated against the closed-form first-passage probability (Broadie–Glasserman–Kou correction for daily monitoring) and an independent 40,000-path simulation.

Historical Stress Scenarios

ScenarioS&P 500 DrawdownApplied to Leveraged Portfolio
2008 GFC−56.8%DD × L (floored at −100% of equity), then check MC threshold
2020 COVID−33.9%DD × L, then check MC threshold
2022 Rate Shock−25.4%DD × L, then check MC threshold
2000 Dot-com−49.1%DD × L, then check MC threshold
1987 Black Monday−22.6%DD × L, then check MC threshold

The equity loss is L × shock, floored at −100%: a margin account is called long before its equity goes negative, and a loss beyond equity needs a price gap through the call. A row that reaches −100% is marked WIPED (e.g. GFC at 3×: −170% unfloored).

Kelly f* is an upper bound, not a recommendation. Leverage above Half Kelly introduces path-dependency risk where adverse sequences can permanently impair capital even when expected returns are positive. MAISNER displays Half Kelly and Quarter Kelly alongside f* for this reason.
ParameterValueDescription
MC_PATHS_LEV5,000GBM paths for liquidation probability
MC_HORIZON_LEV252 days1-year daily simulation
US Maintenance25%FINRA Rule 4210 maintenance margin (of current position value)
EU Maintenance25%Professional clients (broker-set); 50% is the ESMA retail initial margin, not maintenance
Leverage range1× – 3×Table computed at 1.0, 1.5, 2.0, 2.5, 3.0

Stop Loss Calculator

The Stop Loss Calculator derives position-level and portfolio-level exit thresholds from the volatility structure of the portfolio. The methodology follows Giuseppe Paleologo's Advanced Portfolio Management (2021), which frames stop-loss placement as a statistical inference problem rather than an ad-hoc rule.

Position-Level Volatility Stop

Each position's stop is calibrated to its realised volatility (from the RMT-cleaned covariance diagonal) and the chosen horizon. The parameter k controls the width — how many volatility-adjusted standard deviations separate entry from exit.

Vol-Based Stop (Paleologo APM)
\[ \sigma_i^{\text{daily}} = \sqrt{\frac{\Sigma_{ii}}{252}} \] \[ \text{stop\%}_i = k \cdot \sigma_i^{\text{daily}} \cdot \sqrt{T} \] \[ S_i^{\text{stop}} = S_i^{\text{entry}} \cdot (1 - \text{stop\%}_i) \] \[ \text{Dollar Risk}_i = w_i \cdot V \cdot \text{stop\%}_i \]
Σii = annualised variance (RMT covariance diagonal), T = horizon in trading days, k ∈ {1.5, 2.0, 2.5}, V = portfolio value. The square-root scaling places the stop at the k-σ level of the price distribution over the horizon.

Portfolio Drawdown Limit

The portfolio-level stop integrates correlation structure via the full covariance matrix, capturing diversification effects that position-level stops ignore.

Portfolio Drawdown and VaR
\[ \sigma_p^{\text{daily}} = \sqrt{\frac{\mathbf{w}^\top \boldsymbol{\Sigma}\, \mathbf{w}}{252}} \] \[ \text{MaxDD\%} = k \cdot \sigma_p^{\text{daily}} \cdot \sqrt{T} \] \[ \text{VaR}_\alpha = \sigma_p \cdot \sqrt{T/252} \cdot \Phi^{-1}(\alpha) \]
σp = annualised portfolio volatility, α ∈ {0.90, 0.95, 0.99}. VaR is the parametric normal-distribution estimate; MaxDD is the k-σ loss bound over the horizon.

Sharpe-Adjusted Stop

A strategy with a genuine edge is expected to be ahead after T, so a given loss is stronger evidence against it than against a zero-edge random walk: the higher the Sharpe, the tighter the limit. The formula is Paleologo's drawdown condition (Advanced Portfolio Management, §10.1, footnote 2 to eq. 10.3) solved for the loss level instead of the leverage, with the annual horizon generalised to T.

Sharpe-Adjusted Stop (Paleologo APM §10.1)
\[ R_T \sim \mathcal{N}\!\left(SR\,\sigma_p T,\; (\kappa\,\sigma_p\sqrt{T})^2\right), \qquad P(R_T \le -D) = \Phi\!\left(-\frac{SR\sqrt{T}}{\kappa} - \frac{D}{\kappa\,\sigma_p\sqrt{T}}\right) = p \] \[ D = \sigma_p \sqrt{T}\,\bigl(k - SR\sqrt{T}\bigr), \qquad k = \kappa\,z_p,\; z_p = -\Phi^{-1}(p),\; T = \tfrac{\text{horizon days}}{252} \]
σp = annualised portfolio volatility, SR = annualised Sharpe at your risk-free rate, κ = stress multiple on volatility (Paleologo: 1–3), p = tolerated probability. k combines both; Paleologo's worked example (κ = 2, p = 2.5%) gives k ≈ 4 for an annual leverage cap — the calculator's k ∈ {1.5, 2.0, 2.5} is a tighter, shorter-horizon stop. With SR = 0 it reduces to the pure-volatility stop k·σp√T.
When D ≤ 0 (SR·√T ≥ k) the expected return over the horizon is larger than the k-band: under the stated Sharpe even a flat result is a tail event. The calculator then shows a required gain of |D| — the book must be up at least that much to stay consistent with its Sharpe, and any loss is evidence the Sharpe is overstated. In Paleologo's leverage setting the same condition means the drawdown constraint puts no cap on leverage; for a stop it is the strictest case, not a reason to ignore the stop. (Earlier versions divided the Sharpe term by k and labelled this case "non-binding" — corrected Nov 2026.)

GBM First-Passage Barrier Probability (Analytical)

The probability that a position touches its stop before the horizon is computed analytically using the reflection principle for Geometric Brownian Motion — no Monte Carlo required.

First-Passage Probability (Shreve 2004, reflection principle)
\[ P\!\left(\min_{0 \le t \le T} S_t \le S_0(1-\text{stop\%})\right) = \mathcal{N}(-d_1) + e^{-2\nu\lambda/\sigma^2}\,\mathcal{N}(-d_2) \] \[ \lambda = -\ln(1 - \text{stop\%}), \quad \nu = \mu - \tfrac{\sigma^2}{2}, \quad d_1 = \frac{\lambda + \nu T}{\sigma\sqrt{T}}, \quad d_2 = \frac{\lambda - \nu T}{\sigma\sqrt{T}} \]
λ = log-distance to barrier. ν = μ − σ²/2 is the log-space (physical) drift. Positive drift reduces the barrier probability: the exponent −2νλ/σ² < 0 when ν > 0, dampening the reflection term. The exponent is clamped to [−40, 40] to prevent overflow.

Kelly Connection

The Kelly Criterion provides a natural consistency check: a stop that implies a maximum loss exceeding the Kelly-optimal risk budget is oversized relative to the strategy's edge.

Kelly Fraction and Stop Consistency
\[ f^* = \frac{\mu_p - r_f}{\sigma_p^2} \] \[ \text{Max Loss}_i^{\text{Kelly}} = f^* \cdot V \cdot \text{stop\%}_i \cdot w_i \]
The total Kelly max-loss across positions should not exceed the portfolio drawdown limit. If it does, the stop widths are inconsistent with Kelly-optimal sizing and the positions are oversized.

Re-Entry Level

After a stop is triggered, the re-entry level accounts for the short-term mean-reversion noise band estimated as 0.5-σ over 5 trading days.

Re-Entry Price
\[ S_i^{\text{reentry}} = S_i^{\text{stop}} \cdot \left(1 - 0.5\,\sigma_i^{\text{daily}}\,\sqrt{5}\right) \]
Provides a slightly lower re-entry point after exit, accounting for the expected noise band at the 0.5-σ level over a 5-day window (roughly one trading week).
ParameterValuesDescription
k_multiplier1.5 / 2.0 / 2.5Stop width in daily-vol units × √T
horizon_days30 / 60 / 90Horizon for √T scaling
confidence α0.90 / 0.95 / 0.99VaR confidence level (parametric)
RF3.80%Risk-free rate (Kelly denominator)
Covariance sourceRMT diagonalPer-ticker variance from Marchenko-Pastur cleaned Σ

Options Pricing

European Options — Black-Scholes

Black-Scholes Call Price
\[ C = S_0 N(d_1) - K e^{-rT} N(d_2) \] \[ d_1 = \frac{\ln(S_0/K) + (r + \sigma^2/2)T}{\sigma\sqrt{T}}, \quad d_2 = d_1 - \sigma\sqrt{T} \]

American Options — Barone-Adesi Whaley (BAW)

American-style options cannot be priced with Black-Scholes due to early exercise. MAISNER implements the Barone-Adesi Whaley approximation, which provides a closed-form solution by decomposing the American option into a European component and an early exercise premium.

European Component with Dividend Yield q (Merton)
\[ c = S e^{-qT} N(d_1) - K e^{-rT} N(d_2), \qquad d_1 = \frac{\ln(S/K) + (r - q + \sigma^2/2)T}{\sigma\sqrt{T}} \]
The early-exercise premium A2(S/S*)q2 (calls) or A1(S/S*)q1 (puts) is added to this European value, with the critical price S* solved numerically. Without dividends an American call equals the European call. Checked against a 4,000-step binomial tree (validation Module 43). The live option screens price with Black-Scholes; BAW is used where an American value is requested.

Implied Volatility

When live market prices are available, MAISNER back-calculates implied volatility using Brent's method — a bracketed root-finding algorithm that is guaranteed to converge. If the IV calculation fails (e.g., deep ITM/OTM with negligible time value), the platform falls back to historical volatility.

Bond Analytics

Price, Duration and Convexity

Full Price on the Exact Cash-Flow Schedule
\[ P = \sum_{k=1}^{n} \frac{CF_k}{(1 + y/f)^{\tau + k - 1}}, \qquad n = \lceil T f \rceil,\quad \tau = Tf - (n-1) \in (0, 1] \] \[ D_{mac} = \frac{1}{P}\sum_k \frac{e_k}{f}\,\frac{CF_k}{(1+y/f)^{e_k}}, \qquad D_{mod} = \frac{D_{mac}}{1 + y/f}, \qquad C = \frac{1}{P f^2}\sum_k \frac{e_k(e_k+1)\,CF_k}{(1+y/f)^{e_k+2}}, \qquad e_k = \tau + k - 1 \]
f = coupons per year, T = years to maturity, the next coupon is τ periods away (fractional for a bond between coupon dates). P is the full (dirty) price; a market quote is a clean price, so accrued interest (1 − τ)·coupon is added before solving for the yield. DV01 = Dmod·P·0.0001. A zero-coupon bond has Macaulay duration equal to its maturity.

Vasicek Interest Rate Model

Bond returns in stress scenarios and portfolio projections use the Vasicek mean-reverting short rate model for interest rate simulation.

Vasicek SDE
\[ dr_t = \kappa(\theta - r_t)\,dt + \sigma_r\,dW_t \]
κ = mean reversion speed, θ = long-run rate, σr = rate volatility
ParameterValue
BOND_MAX60% of portfolio
CONVEXITY_THRESH0.05
Credit ratingsAAA → CCC (FMP data)

Factor Analysis

The Factor Explorer computes Information Coefficient (IC) and related statistics for 11 cross-sectional factors.

Information Coefficient

IC — Rank Correlation
\[ IC_t = \text{Spearman}\left(\text{rank}(f_{t}),\; \text{rank}(r_{t+1})\right) \]
Rank correlation between factor scores at time t and forward returns at t+1. Robust to outliers; range [−1, +1].

Information Ratio

ICIR
\[ ICIR = \frac{\bar{IC}}{\sigma_{IC}} \]
Annualised ratio of mean IC to IC volatility. ICIR > 0.5 indicates a reliably predictive factor.
FactorCategory
momentum_12mMomentum (12-1)
momentum_1mShort-term reversal
value_compositeP/E, P/B, EV/EBITDA
quality_compositeROE, margins, debt
low_volatility12-month realised vol
fcf_yieldFCF / Market cap
earnings_revisionEPS estimate changes
sizeLog market cap
dividend_yieldTrailing dividend yield
growth_compositeRevenue + EPS growth
short_interestShort % of float

Backtesting & Probabilistic Sharpe Ratio

Point-in-Time Simulation

The strategy is a fixed rule (select · weight · rebalance) — nothing is fitted. At the end of each month t the rule ranks the assets on prices up to and including t and the new weights earn month t+1. The first decision needs a full 12-month lookback; an asset is eligible only once it has 12 months of history. Between rebalances the weights drift with prices (buy-and-hold), and every rebalance pays the transaction cost on the turnover Σ|wnew − wdrifted|. Benchmark: equal weight of the assets that have a return in the month, rebalanced monthly.

Monthly Step
\[ V_{t+1} = V_t\,\big(1 + \textstyle\sum_i w_{i,t}\,r_{i,t+1}\big), \qquad w_{i,t+1}^{\text{drift}} = \frac{w_{i,t}(1+r_{i,t+1})}{1+\sum_j w_{j,t} r_{j,t+1}}, \qquad V \leftarrow V\,(1 - c\,\text{turnover}) \]
Price factors (momentum 1/3/6/12 M, low volatility = −σ of the 12 monthly log returns) are computed from the lookback only. Fundamental factors (value, quality, growth, dividend and FCF yield, leverage) hold TODAY's values at every past date — a strategy using them is marked not point-in-time and the result carries a look-ahead warning until historical filings are stored.

In-Sample / Out-of-Sample Split

The history is split (default 60 / 40) for reporting: Sharpe, return, volatility and drawdown are shown for the first part (IS), the second part (OOS) and the whole period, at the user's risk-free rate. Because the rule is fixed, the split matters when you tune the rule on IS and then look at OOS — a large IS→OOS drop is the overfitting signal.

Probabilistic Sharpe Ratio

PSR (Bailey & López de Prado, 2012)
\[ PSR = \Phi\left(\frac{\widehat{SR}\,\sqrt{T-1}}{\sqrt{1 - \gamma_3 \widehat{SR} + \frac{\gamma_4-1}{4}\widehat{SR}^2}}\right) \]
SR̂ = monthly Sharpe of the OOS returns (excess over rf/12), T = number of OOS months, γ3 = skewness, γ4 = kurtosis (non-excess). PSR = probability that the true Sharpe is above 0 given its estimation error. It does NOT correct for the number of strategies you tried (that would be the Deflated Sharpe Ratio, with SR* = expected maximum of N trials); after testing many variants, read PSR with that in mind.
PSR < 0.75 typically means the OOS Sharpe is within noise. On pure random walks without drift the mean OOS Sharpe of a momentum rule is ≈ 0 (verified on 40 synthetic histories).

Performance Attribution

MAISNER implements the Brinson-Hood-Beebower (BHB) three-effect decomposition, which explains the difference between portfolio return and benchmark return as the sum of allocation, selection, and interaction effects. The benchmark is a sector blend: the benchmark ETF's sector weights at the start of the period times the returns of the SPDR sector ETFs. The attribution is a single-period, buy-and-hold decomposition in USD total returns.

Brinson-Hood-Beebower Decomposition

Let wp = portfolio sector weight, wb = benchmark sector weight, Rp = portfolio sector return, Rb = benchmark sector return, Rbtotal = total benchmark return.

Allocation Effect
\[ A_s = (w_s^p - w_s^b)(R_s^b - R_{\text{total}}^b) \]
Measures the value added by over- or under-weighting a sector relative to the benchmark. Positive when the portfolio over-weights a sector that outperforms the overall benchmark.
Selection Effect
\[ S_s = w_s^b (R_s^p - R_s^b) \]
Measures the value added by selecting securities that outperform the sector benchmark. Uses benchmark weight to isolate pure security selection skill.
Interaction Effect
\[ I_s = (w_s^p - w_s^b)(R_s^p - R_s^b) \]
Cross-effect from simultaneously over-weighting and outperforming a sector. Represents the combined effect of active allocation and active selection.
Active Return Decomposition
\[ R_{\text{active}} = R^p - R^b = \sum_s (A_s + S_s + I_s) \]
The total active return equals the sum of all sector-level effects. Effects are expressed in basis points (bp = 0.01%).

Portfolio Returns and Weights

Each position's return is the total return (adjusted close, dividends reinvested) from the first trading day on or after the period start to the latest close, converted to USD: \( r_i^{\$} = (1+r_i^{\text{local}})(1+r^{FX}_i) - 1 \), where \( r^{FX} \) is the change of the listing currency's USD rate (Yahoo {CCY}USD=X) over the same window; the currency is that of the listing (London pence → pounds). A position without a price within 10 days of the start (listed later) or without a price in the last 10 days is excluded and named in the result; the remaining weights are rescaled. Duplicate tickers are summed.

Weights — fractions of capital
\[ w_i = \frac{x_i}{D},\qquad D = \begin{cases} \left|\sum_j x_j\right| & \text{if } \left|\sum_j x_j\right| \ge 0.2\sum_j |x_j| \\ \sum_j |x_j| & \text{otherwise} \end{cases},\qquad w_{\text{cash}} = 1 - \sum_i w_i \]
A long-only or 130/30 book is normalised by its net investment (weights sum to 1, no cash). A book whose longs and shorts nearly cancel is normalised by gross exposure and the remainder is a cash row with return 0 (financing and borrow cost are not modelled). Portfolio return \( R^p = \sum_i w_i r_i^{\$} \).
Sector weight and return
\[ w_s^p = \sum_{i \in s} w_i,\qquad C_s = \sum_{i\in s} w_i r_i^{\$},\qquad R_s^p = C_s / w_s^p \]
With short positions the sector return is the net contribution divided by the net weight. When the sector's longs and shorts almost cancel (\( |w_s^p| < 5\% \) of the sector's gross weight) \( R_s^p \) is undefined: selection is set to 0 and the whole \( C_s - w_s^p R_s^b \) is reported as interaction (flag L/S-neutral). Sectors are the platform's canonical GICS-style names (FMP profile → Stocks.xlsx, consumer names split into staples / discretionary per ticker), the same map as in the optimizers and stress tests.

Benchmark Construction (SPY, QQQ)

Start-of-period sector weights
\[ w_s^b \;\propto\; \frac{w_s^{b,\text{now}}}{1 + R_s^b},\qquad \sum_s w_s^b = 1,\qquad R^b = \sum_s w_s^b R_s^b \]
\( w^{b,\text{now}} \) is the ETF's current sector breakdown (Yahoo topHoldings.sectorWeightings, 24-hour cache); dividing by each sector's growth over the window rolls a cap-weighted index back to its weights at the start. \( R_s^b \) is the total return of the SPDR sector ETF (XLK, XLV, XLF, XLY, XLI, XLC, XLP, XLE, XLB, XLU, XLRE). If the live breakdown is unavailable, fixed approximate weights are used and the result says so. If any sector ETF has no price, the run stops with an error rather than using 0.
Rows outside the benchmark's sectors
\[ A_{\text{other}} = C_{\text{other}} - w_{\text{other}}^p R^b,\qquad A_{\text{cash}} = -\,w_{\text{cash}} R^b,\qquad S = I = 0 \]
Positions with no equity sector (bond, commodity and broad-market ETFs, unclassified names) stay in the portfolio return as the row "Other (off-benchmark)". The benchmark weight is 0, so their whole effect relative to the benchmark return is allocation.
Exact identity and replication gap
\[ \sum_{s} (A_s + S_s + I_s) + A_{\text{other}} + A_{\text{cash}} = R^p - R^b,\qquad R^p - R^{\text{ETF}} = (R^p - R^b) + \underbrace{(R^b - R^{\text{ETF}})}_{\text{replication gap}} \]
The identity holds exactly because \( \sum_s w_s^b = 1 \) and the portfolio rows' weights sum to 1. The sector ETFs do not reproduce the index exactly (XLK caps its largest constituents; QQQ's sectors are approximated by S&P 500 sector ETFs), so the ETF's own return is reported beside the blend and the difference is shown as the replication gap.

EFA and AGG

No sector split. There is no liquid sector return series for MSCI EAFE (US sector ETFs measure US sectors), and AGG is a bond index without equity sectors. The result is the total active return \( R^p - R^{\text{ETF}} \) and the per-ticker table.

Sector Resolution

The same enriched map is used across the Optimizer, Constrained Optimizer, Stress Tests and Attribution: FMP profile first, the Stocks.xlsx sector next (exact name mapping, no substring matching), the ambiguous consumer class split per ticker into Consumer Staples / Consumer Discretionary. Sector ETFs map to their own sector (XLK → Technology); bond, commodity and broad-market ETFs map to "Other".

Portfolio Monitor

The Portfolio Monitor provides real-time P&L tracking, currency exposure breakdown, and option expiry management for user-defined portfolios. Unlike the Analyzer and Optimizer, the Monitor supports multi-asset portfolios (stocks, ETFs, bonds, options, futures, crypto) for all subscription tiers.

Position-Level P&L

Base currency is USD. For position i: q = quantity, m = multiplier (1; options 100; futures the contract multiplier), P0 = purchase price and P = live price, both in the listing currency C; X0 = USD per unit of C at the close of the purchase date, X = today's rate.

Long position
\[ \text{Cost} = q\,m\,P_0\,X_0, \qquad \text{Value} = q\,m\,P\,X \] \[ \text{P\&L} = \text{Value} - \text{Cost} = \underbrace{q\,m\,(P - P_0)\,X}_{\text{price effect}} \;+\; \underbrace{q\,m\,P_0\,(X - X_0)}_{\text{FX effect}} \]
The two effects add up to the P&L exactly. X0 is the Yahoo {C}USD=X daily close of the purchase date (the last session on or before it, dated in the quote's own timezone), resolved once and frozen with the position; editing the date re-reads it. Without a purchase date the cost uses today's rate (FX effect 0, noted on the row).
Short position (stock, ETF, written option)
\[ \text{P\&L} = q\,m\,(P_0 - P)\,X \;-\; \text{Borrow}, \qquad \text{Borrow} = q\,m\,P_0 \cdot b \cdot \frac{\text{days held}}{365} \cdot X \]
A short is self-financed in its own currency: the sale proceeds stay in C and fund the buy-back, so only the gain or loss is converted (FX effect on the principal = 0). b = annual borrow rate; days held from the purchase date (no date → no borrow accrued, noted). Cost (q·m·P0·X0) is the capital the position ties up and is the base of P&L %.
Futures (ticker ending in =F)
\[ \text{P\&L} = \pm\, q\,M\,(F - F_0)\,X, \qquad \text{Cost} = 0, \qquad \text{Notional} = q\,M\,F\,X \]
M = exchange contract multiplier in the quote's units (ES 50, NQ 20, CL 1000, GC 100, ZN 1000, grains 50 on a quote in cents …). A futures position is marked to market and needs no capital: it contributes its P&L to NAV and its notional only to gross exposure. P&L % is on the entry notional q·M·F0·X0. A position typed "futures" without =F (an ETF such as GLD or USO) is valued as a fund.
Book totals
\[ \text{NAV} = \sum_i (\text{Cost}_i + \text{P\&L}_i), \qquad \text{NAV} - \sum_i \text{Cost}_i = \sum_i \text{P\&L}_i, \qquad \text{P\&L\%} = \frac{\sum \text{P\&L}_i}{\sum \text{Cost}_i} \] \[ \text{Gross} = \sum_i |\text{Value}_i| \quad (\text{futures notional included}) \]
A position without a price is carried at cost (P&L not counted) — never at zero. Currency shares are shares of gross exposure.

Prices and FX rates

Live prices: FMP when it answers, otherwise the Yahoo live quote (v7), otherwise the last Yahoo daily close (the row names its source); crypto as the XXX-USD pair (never FMP's "BTC", a different token). FX: Yahoo {C}USD=X live quote for every currency; FMP for any main currency still missing; then the last live rate saved on disk; the April-2026 constants only as a last resort. Every response lists each rate with its source, and the screen flags any rate that is not live.

Option Valuation

Live option
\[ V = q \cdot 100 \cdot P^{\text{opt}} \cdot X \]
Popt = Yahoo bid/ask mid of the OCC contract (the last two-sided mid seen within 24 h when the book is empty, else the last trade). If that exact contract is not listed the nearest listed expiry within ±14 days is used and named on the row. Without any quote: Black-Scholes on the underlying with the stored implied volatility (25% if none) and the user's risk-free rate. No quote and no underlying price → unpriced (carried at cost).
Expired option — cash settlement at intrinsic value
\[ P^{\text{opt}} = \max(0, S_T - K)\ \text{(call)}, \qquad \max(0, K - S_T)\ \text{(put)} \]
ST = the underlying's close on the expiry date (last session on or before it), resolved once and frozen with the position — never the live price, which drifts after expiry.

Currency Exposure

Currency is the currency of each listing, read from the exchange quote (ASML.AS → EUR, NESN.SW → CHF, IUSA.SW → USD; a London line quoted in pence (GBp) is divided by 100 to pounds). A ticker without an exchange suffix is the US listing (USD) — see Tickers & Listings. The breakdown shows each currency's share of gross exposure.

Long/Short Optimizer

The Long/Short Optimizer extends the standard MVO framework to allow negative portfolio weights (short positions). The mathematical structure is identical to the long-only case — the same Sharpe objective, the same RMT-cleaned covariance matrix — with two key adaptations: a borrow cost term subtracted from the expected return of shorted positions, and relaxed weight bounds that permit negative values.

Portfolio Modes

Two net-exposure configurations are available:

  • Long/Short (net = 1): Σwᵢ = 1. Standard fully-invested portfolio allowing some short positions. Long gross > net; short gross < long gross.
  • Market Neutral (net = 0): Σwᵢ = 0. Dollar-neutral — long exposure equals short exposure. A minimum gross constraint (Σ|wᵢ| ≥ 0.5) prevents the degenerate all-zero solution.

Borrow Cost Adjustment

Effective Expected Return
\[ \mu_i^{\text{eff}} = \mu_i - b \cdot \mathbf{1}[w_i < 0] \] \[ \mu_p^{\text{eff}} = \sum_i w_i \mu_i^{\text{eff}} = \sum_i w_i \mu_i - b \sum_{w_i < 0} |w_i| \]
b = annual borrow rate (default 0.5%). The borrow cost is subtracted from the expected return contribution of each short position. Long positions are unaffected. This makes high-borrow-rate environments naturally discourage shorting when the alpha is insufficient to cover the cost.

Objective Modes

ModeObjectiveL/S Adaptation
Standardmax (μ_eff − η·r_f) / σSharpe of the excess return (see below); bounds [−max_short, max_long]
Conservativemin wᵀΣwMinimise portfolio variance; negative weights allowed; tends toward fewer shorts
Balancedmax Sharpe s.t. σ ≤ vol_capSLSQP vol constraint; falls back to min-variance if vol_cap is infeasible
Aggressivemax μ_effPure return maximisation; bounds widened to [−1.5×max_short, 1.5×max_long]
Dividendmax Σ wᵢ×ROIᵢ − 0.3σNet dividend income: a short position pays the dividend to the lender, so shorting a high-yielder costs income; vol penalty prevents pure high-yield concentration

Weight Constraints

Feasible Region
\[ -m_s \le w_i \le m_l \quad \forall i, \qquad \sum_i w_i = \eta, \qquad \text{(MN only:)} \quad \sum_i |w_i| \ge 0.5 \]
mₛ = max_short (default 0.30), mₗ = max_long (default 0.35), η = 1 (long/short) or 0 (market neutral). Aggressive mode uses 1.5× widened bounds. The market-neutral gross constraint prevents the trivial zero-weight solution.

Portfolio Statistics

Gross and Net Exposure
\[ \text{Gross} = \sum_i |w_i|, \qquad \text{Net} = \sum_i w_i, \qquad \text{L/S Ratio} = \frac{\sum_{w_i > 0} w_i}{\sum_{w_i < 0} |w_i|} \]
Gross exposure > 1 indicates leverage. L/S ratio = 1 for market-neutral. Borrow cost = borrow_rate × short_gross.

Volatility and Sharpe (identical to long-only)

Portfolio Variance — unchanged with negative weights
\[ \sigma_p^2 = \mathbf{w}^\top \Sigma \mathbf{w} \] \[ \text{Sharpe} = \frac{\mu_p^{\text{eff}} - \eta\, r_f}{\sigma_p}, \qquad \eta = \sum_i w_i \]
The capital not invested net (1 − η) earns rf, so the excess return of the book is Σ wᵢ(μᵢ − rf) − borrow = μpeff − η·rf. For a fully invested book (η = 1) this is the usual μ − rf; a dollar-neutral book (η = 0) is already an excess return and no rf is subtracted. The risk-free rate is the user's setting. Among the optimizer restarts the result with the best value of the mode's own objective is kept; the dollar-neutral problem (gross ≥ 0.5) is not convex and is solved from ten times more starting points.

10-Year Monte Carlo

CAPM Drift, Exact Lognormal Read-outs
\[ \mu_{MC} = r_f + \beta_p \cdot 5\% - b\sum_{w_i<0}|w_i|, \qquad \beta_p = \sum_i w_i \beta_i \]
Same convention as the long-only engines: the simulation does not grow at the historical 5-year growth rate (shown separately as μ HIST 5Y). Median, 5th/95th percentiles, the probability of a loss and the fan bands are the exact quantiles of the terminal lognormal value exp((μ − σ²/2)T + σ√T·Z).

Upper Barrier Probability for Short Stop-Losses

When L/S portfolio weights are passed to the Stop Loss Calculator, short positions (w < 0) use the upper barrier formula (stop triggered when price rises above entry):

Upper Barrier — Short Position Stop-Out
\[ P\!\left(\max_{0 \le t \le T} S_t \ge S_0(1+\text{stop\%})\right) = \mathcal{N}(-d_2) + e^{+2\nu\lambda/\sigma^2}\,\mathcal{N}(-d_1) \] \[ \lambda = \ln(1 + \text{stop\%}), \quad d_1 = \frac{\lambda + \nu T}{\sigma\sqrt{T}}, \quad d_2 = \frac{\lambda - \nu T}{\sigma\sqrt{T}} \]
Positive drift ν > 0 increases upper-barrier probability (stock trends toward short stop). Note: d₁ and d₂ are swapped vs the long (lower-barrier) formula, and the exponent sign is positive. Stop price for short = entry × (1 + stop_pct).

Long/Short Analyzer

The Long/Short Analyzer evaluates an existing L/S portfolio given the user's actual positions — ticker, quantity, direction, and purchase price. Live prices are fetched at run-time to compute current mark-to-market values, realised P&L, and forward-looking risk metrics using the same RMT covariance infrastructure as the optimizer.

Position Valuation and P&L

Mark-to-Market P&L per Position
\[ \text{PnL}_i = \text{sign}_i \times (\text{qty}_i \times P_i^{\text{live}} - \text{qty}_i \times P_i^{\text{purchase}}) \] \[ \text{sign}_i = \begin{cases} +1 & \text{LONG} \\ -1 & \text{SHORT} \end{cases} \]
Long positions profit when price rises; short positions profit when price falls. Total portfolio P&L = Σ PnL_i.

Portfolio Exposure

Gross, Net, and L/S Ratio
\[ V_i^{\text{live}} = \text{qty}_i \times P_i^{\text{live}}, \qquad V_{\text{gross}} = \sum_i V_i^{\text{live}} \] \[ V_{\text{net}} = V_{\text{long}} - V_{\text{short}}, \qquad w_i = \frac{\text{sign}_i \times V_i^{\text{live}}}{V_{\text{gross}}} \] \[ \text{L/S Ratio} = \frac{V_{\text{long}}}{V_{\text{short}}}, \qquad \text{Net Exposure} = \frac{V_{\text{net}}}{V_{\text{gross}}} \]
Weights are normalised by gross value. Long weights are positive; short weights are negative. Net exposure = 1 for a long-only book; = 0 for market-neutral.

Portfolio Risk (RMT Covariance)

Volatility, Sharpe, and VaR
\[ \sigma_p = \sqrt{\mathbf{w}^\top \Sigma_{\text{RMT}} \,\mathbf{w}}, \qquad \mu_p^{\text{eff}} = \sum_i w_i \mu_i - b \sum_{w_i < 0} |w_i| \] \[ \text{Sharpe} = \frac{\mu_p^{\text{eff}} - \eta\, r_f}{\sigma_p}, \qquad \eta = \frac{V_{\text{net}}}{V_{\text{gross}}} \] \[ \text{VaR}_{95\%} = \sigma_p \times z_{0.95} = \sigma_p \times 1.645 \] \[ \text{CVaR}_{95\%} = \sigma_p \times \frac{\phi(z_{0.95})}{1 - 0.95} \approx \sigma_p \times 2.063 \]
Parametric VaR and CVaR under normality. σ_p uses RMT-cleaned covariance (identical to optimizer pipeline). Borrow cost b is deducted from expected return of short positions only. Expected return, volatility, VaR and CVaR are expressed as a percentage of GROSS portfolio value (long + short), annualised; the Sharpe ratio is the same on any base. The 10-year Monte Carlo uses the CAPM drift of the L/S Optimizer. A position without a live quote is valued at its purchase price and flagged.

Risk Contribution

Share of Portfolio Variance
\[ RC_i = \frac{w_i\,(\Sigma \mathbf{w})_i}{\mathbf{w}^\top\Sigma\mathbf{w}}, \qquad \sum_i RC_i = 100\% \]
Signed: a negative share means the position reduces portfolio risk (typically a hedge short). A ticker held in several lots splits its share in proportion to each lot's value. The concentration thresholds of the action signals (20% / 25% / 30%) refer to |RCi|.

Stress Scenarios (Beta-Adjusted)

Scenario Impact
\[ \text{Impact} = \sum_i \text{sign}_i \times \beta_i \times r_{\text{mkt}} \times V_i^{\text{live}} \]
For each historical scenario (GFC 2008, COVID 2020, Rate Shock 2022, Dot-com 2000, Black Monday 1987), the position-level impact is computed using the stock's beta (from Stocks.xlsx; default β = 1) and the scenario's market return. Long positions lose when the market falls; short positions gain (hedge effect). The sum shows how well shorts offset long-side losses under each scenario.

Hedging Optimizer

Builds on Yu & Sun (2017), "Optimal Hedging with Options and Futures against Price Risk and Background Risk", Math. Comput. Appl. 22(1):5: puts and futures are optimised jointly to minimise the Expected Shortfall of the hedged position. The formulas below are the ones the engine runs (revised November 2026; changes from the earlier version are listed at the end of this section).

Hedge P&L per Unit Held

L(FT) = h·[ (Kp − FT)+ − (FT − Kc)+ − (Φp − Φc)·erτ ]  +  H·(F0 − FT)
SymbolMeaning
F0, FTFutures (forward) price today and at the horizon. The short-futures leg pays F0 − FT: F0 is already the forward price, so no further carry is applied.
Kp, KcPut and call strikes (Kc = ∞ when there is no call leg)
Φp, ΦcBlack-76 premia on F0, financed at r until expiry (factor erτ)
hOption units per unit held
HShort futures units per unit held, H ∈ [0, 2]
r, τRisk-free rate (3.80%), horizon in years (days / 365)

Option Pricing — Black-76

Φp = e−rτ[K·N(−d2) − F0·N(−d1)],   Φc = e−rτ[F0·N(d1) − K·N(d2)],   d1 = [ln(F0/K) + σf2τ/2] / (σf√τ),   d2 = d1 − σf√τ

For an index ETF with F0 = S0·erτ (no dividend yield) this is identical to Black-Scholes on the spot S0. The hedge-instrument volatility σf is used.

Budget — a Ceiling, Not a Target

0 ≤ h ≤ hmax = min( hcap,   d·P0 / (Φp − Φc) ),    hcap = max(1, βp) (portfolio)  |  1 (single asset)

Premium spent is at most d of the position value. h is searched on 9 equally spaced points of [0, hmax]; when the structure costs nothing or earns a credit (collar) only the cap applies. Forcing the full budget to be spent made the optimizer buy options on up to 2× the notional or deep in-the-money puts (a costly synthetic short future); the cap and the ceiling remove both.

Simulation

N = 10,000 paths from three independent N(0,1) variates W1, W2, W3:

log(PT/P0) = (μs − σs2/2)τ + σs√τ·W1
log(FT/Fstart) = (μf − σf2/2)τ + σf√τ·(ρ1W1 + √(1−ρ12)·W2)
ZT = σz√τ·(ρ2W1 + √(1−ρ22)·W3)   (single-asset mode only)

Fstart = F0 in single-asset mode; in portfolio mode Fstart = S0, because a futures contract expiring at the horizon converges to the spot (FT = ST).

Moment matching. Before use the 10,000×3 draws are centred and whitened, W ← (W − W̄)·L−T with LLT = cov(W), so their sample mean is exactly 0 and their sample covariance exactly I. The raw seed-42 draws had column means of +1.7 standard errors, which put the simulated E[ST] 2.4 SE above S0eμτ and biased every mean-based figure (expected hedge cost, mean loss, the tie-break). After matching, the simulated E[ST] is within 0.001 SE of the closed form and the sample correlation equals ρ1 exactly.

Terminal Wealth and Risk Measure

Portfolio mode:   ΠT = PT·Q + Q·L(FT)
Single-asset mode:   ΠT = (1 + β·ZT)·[PT·Q + Q·L(FT)] + (1 − β)·ZT·W0
Loss = −(ΠT − W0) / W0,   W0 = P0·Q,    ESα = E[Loss | Loss ≥ q1−α(Loss)]

α is the tail probability (defaults to 1 − the user's CVaR confidence level). In the single-asset model Z is a relative shock: β = 0 adds Z·W0, β = 1 scales the whole hedged position by (1 + Z). The portfolio model has no background term: PT already carries the portfolio's full volatility, and its imperfect correlation ρ1 with the hedge instrument is exactly the risk an index hedge cannot remove.

Portfolio Mapping

Model parameterPortfolio quantityNotes
S0 = P0Last hedge-instrument price in price_historyPortfolio expressed in hedge units
QW0 / S0
σsσportfolioAnnualised from all aligned monthly log-returns
σfσhedgeAnnualised from the hedge instrument's monthly log-returns
ρ1corr(portfolio, hedge)Monthly returns
βpρ1·σportfolio/σhedge
μsrf + βp·5%CAPM with the hedge instrument as market proxy
μfrf + 5%Real-world drift of the index: a short hedge gives up the equity risk premium
F0S0·erτForward / futures price

Portfolio returns use the saved weights, shorts included (normalised by net exposure, or by gross exposure when the book is close to market-neutral). Months in which any holding lacks a price are dropped, never forward-filled — forward-filling a stale tail would insert flat 0% months and understate volatility. Tickers with fewer than 24 monthly prices are excluded from the statistics.

Strategies and Search Grids

StrategyStructureGrid
Protective PutLong put, H = 0Kp ∈ [0.80, 1.00]·F0 (15) × h (9)
CollarLong put + short call, H = 0Kp ∈ [1−s, 1]·F0, Kc ∈ [1, 1+s]·F0 (12 each) × h (9), s = max(0.18, 2σf√τ)
Futures OnlyShort futures, h = 0H ∈ [0, 2] (21)
Put + FuturesLong put + short futuresKp ∈ [0.75, 1.05]·F0 (13) × H (21) × h (9)

A protective put is insurance, so its strike stops at the money; above it the position is a synthetic short future, which Put + Futures and Futures Only already cover. The result is flagged at_grid_edge when the optimum lands on an artificial bound (deepest OTM put, highest call, H = 2).

Choosing the Best Strategy

best = argmins ∈ A E[Losss],    A = { s : ESs ≤ minj ESj + 0.001 }

Strategies within 0.1pp of the lowest ES are statistically indistinguishable at 10,000 paths; among them the one with the best expected outcome is recommended. No strategy is recommended if none beats the unhedged ES.

Reported Costs

FieldDefinition
Option contracts⌈h·Q / 100⌉
cost_usdcontracts × 100 × (Φp − Φc) — negative = net credit
Futures notionalH·Q·F0; for SPY also shown as E-mini (≈ notional / (500·S0)) and Micro E-mini (×10)
exp_hedge_pnl_pctE[Lossunhedged] − E[Losss] — the expected cost of the protection over the horizon
es_reduction_ppESunhedged − ESs

Execution Ticket (HEDGE-ORDER // EXECUTE)

Every strategy gets a ticket; the recommended one is shown first and a click on any row of the strategy table shows the others. All figures are computed in the engine and validated (Module 28).

BlockFigureDefinition
OrderMoneynessvs the forward: ATM-fwd if |ln(K/F0)| < 0.5%; distance ln(K/F0)/(σf√τ) in σ
Roundingcontracts ⌈hQ/100⌉; MES = round(HQ/50) (1 MES ≈ 50 × SPY forward); ES recomputed with the traded sizes
ModelBasis riskσp√(1−ρ12)√τ — the part no index hedge removes
Exposure$ deltaportfolio b·V with b = ρ1σp/σf; puts N(d1)−1, calls N(d1) per option × traded units × S0; futures −traded notional
Effective hedge−(hedge $ delta) / (b·V)
Γ, vega, θΓ·S02·1% (change of $ delta per 1% move), vega per vol point, θ per calendar day; Black-Scholes on S0 ≡ Black-76 on F0
CostExpected hedge P&Lclosed form: H·Q·(F0 − S0eμfτ) + h·Q·(EP[put] − EP[call] − net·erτ), EP = Black formula on the real-world forward S0eμfτ; shown next to the simulated mean ± 2 SE
Breakevenhedge-instrument price at expiry where the hedge P&L = 0 (payoff is non-increasing in FT; unique root by bisection)
Variation margin−H·Q·F0·10% for an immediate +10% move
RiskES ± SEpaired bootstrap, 200 resamples of the 10,000 losses (same resample for unhedged and hedged)
P(loss > 10%)share of simulated paths, before and after
ScenariosUnhedgedE[PT | ST] = P0exp(mp + b(x − mh) + ½σp2τ(1−ρ12)), x = ln(ST/S0), m = (μ − σ2/2)τ (bivariate lognormal)
Hedgeexact payoff Q·L(ST)
AlternativesES gap ± 2 SEpaired bootstrap of ESother − ESthis; a gap below 2 SE is reported as a statistical tie
Size 50% / 75%ES with h and H scaled; expected P&L scales linearly
NotesStalenessflag when the hedge price is older than 30 days

Sensitivity Analysis

SeriesWhat it shows
ES vs budget dBest strategy's strikes and H fixed, h re-optimised under each ceiling (1%–30%). A flat line means the budget does not bind.
ES vs horizon30–360 days, paths re-simulated, strikes at the same moneyness K/F0, h re-optimised.
Single-asset only: β, d, α, σspotWith / without futures. The σspot sweep re-simulates the spot only; options stay priced on σf.

Changes in the November 2026 Revision

BeforeNowEffect on a 90-day, σ = 16.8% test portfolio
Portfolio mode added background Z with σz = σp√(1−ρ12), not scaled by √τNo background term in portfolio mode; √τ scaling in single-asset modeUnhedged ES 18.8% → 14.1% (closed-form lognormal: 14.3%)
Additive background term in dollars ((1−β)·Z)(1−β)·Z·W0Single-asset additive background was ≈ $0.05 on $100k
Budget always fully spent, h = d·P0/ΦCeiling with h ≤ max(1, βp)Protective put 1.97× → 1.00× notional; best-strategy premium $57k → $4.5k
Hedge instrument drift rf; futures leg F0erτ − FTDrift rf + 5%; futures leg F0 − FTExpected cost of a 0.8× futures hedge now 1.15% of AUM per quarter (was ≈ 0)
Black-Scholes with F0 as spotBlack-76 on F0Removes a double carry of F0(erτ−1)
Collar: credit reported as $0, cost = put premiumSigned net premiumCredit collars now show their credit
Best = lowest ES, any marginLowest expected loss within 0.1pp of the lowest ESNo recommendation on a 0.002pp edge
Stale prices forward-filled; shorts droppedMissing months dropped; shorts keptσp no longer biased low by fake 0% months
Raw seed-42 normal draws (column means +1.7 SE)Moment-matched draws (mean 0, covariance I)Simulated E[ST] 2.4 SE high → within 0.001 SE; unhedged mean return 2.25% → 2.10% (closed form 2.098%)

Base Currency (USD)

Every return, volatility, correlation and expected return on the platform is that of a US-dollar investor. A listing that trades in another currency is converted before any statistic is computed, so its currency risk is part of its risk.

Monthly history
\[ P^{\$}_{i,m} = P^{\text{local}}_{i,m}\cdot X_{c(i),m}, \qquad r^{\$}_{i,m} = \ln\frac{P^{\$}_{i,m}}{P^{\$}_{i,m-1}} = r^{\text{local}}_{i,m} + \ln\frac{X_{c,m}}{X_{c,m-1}} \]
Plocal = month-end (dividend-adjusted) close in the listing's currency c (pence lines in pounds), Xc,m = USD per unit of c at the close of the same month (Yahoo {c}USD=X; the month is read in the quote's own timezone). The price database keeps the local closes and derives the USD series from them; 12 years are kept.
Daily data and expected return
\[ P^{\$}_{i,t} = P^{\text{local}}_{i,t}\cdot X_{c,t}\ \ (\text{daily close; the last FX close on FX holidays}), \qquad g^{\$} = (1+g^{\text{local}})\left(\frac{X_{c,\text{now}}}{X_{c,\text{now}-5y}}\right)^{1/5} - 1 \]
The daily closes behind the correlation matrix are converted the same way. The 5-year CAGR used as expected return is converted with the 5-year change of the exchange rate (the local value is kept alongside). A listing whose currency has no FX history is left out rather than treated as if it were in dollars.

Tickers & Listings

Every request passes through one resolver before any engine runs, so all tools, saved portfolios, Monitor books and alerts use the same listing.

InputListing used
No suffix (SAP)US listing (SAP SE ADR, NYSE, USD)
Exchange suffix (SAP.DE)That exchange (Xetra, EUR) — Yahoo Finance suffixes
Not traded where askedMost traded listing of the same symbol on another exchange — announced with company, exchange and currency
US class share with a dot (BRK.B)BRK-B
Option, future (=F), index (^), FX (=X), crypto, bondUnchanged
Automatic Pick
\[ \ell^{*} = \arg\max_{\ell} \; P_\ell \cdot \overline{V}^{\,3M}_\ell \,/\, FX_{\ell \to EUR} \]
Candidates ℓ = the same symbol on every other exchange suffix; a listing counts only if it is an equity / ETF / fund with a price > 0 and a trade in the last 14 days (dead and suspended lines are excluded). P = last price in the currency unit (pence ÷ 100), V̄ = 3-month average daily volume. When a suffix was given, non-US listings are preferred; the US line is the last resort. Source: Yahoo Finance quote; results are cached 30 days (not found: 1 day). If the quote service cannot be reached the ticker is used as typed.

Currency of a position = currency of its listing as quoted by the exchange (an ETF can trade in another currency than its exchange: IUSA.SW is quoted in USD). London lines quoted in GBp are converted to pounds.

Platform Constants

ConstantValueDescription
RISK_FREE3.80%Risk-free rate (annualised)
WEIGHT_MAX35%Max weight per linear asset
CRYPTO_MAX15%Max total crypto allocation
FUTURES_MAX20%Max total futures allocation
BOND_MAX60%Max total bond allocation
OPTION_MAX30%Max total options allocation
QUALITY_THRESH0.45 (MVO) · 0.30 (multi-asset)Portfolio / per-asset quality below this is penalised
Quality penalty0.15 (MVO) · 0.05 (constrained, multi-asset)Weight of the quality term in the objective
Entropy penalty0.30MVO Standard / Balanced diversification term
MC_PATHS10,000Monte Carlo simulation paths
MC_HORIZON10 yearsMonte Carlo time horizon
CVAR_SCENARIOS5,000CVaR scenario count
CVAR_ALPHA0.95CVaR confidence level
DATA_HISTORY10 yearsPrice history for analysis
STALENESS30 daysMax data age before refresh

Data sources: FMP Professional (primary — fundamentals, prices, dividends), Polygon (secondary — US equities), yfinance (EU tickers, fallback). All data fetched over HTTPS with API key authentication.

PRIIPs KID Generator

Implements EU Regulation 1286/2014 (PRIIPs) and Commission Delegated Regulation 2017/653 as amended by Delegated Regulation 2021/2268 (applicable from 1 January 2023). A portfolio of listed equities and ETFs is a Category 2 PRIIP (linear exposure, observable prices). The calculation uses the monthly closes of the holdings as a composite benchmark of the portfolio (Annex IV point 14). It requires at least 5 years of monthly prices (Annex II point 10) and, for the scenarios, 10 years of history when the recommended holding period (RHP) is up to 5 years, RHP + 5 years otherwise (Annex IV point 6); a KID draft is not produced for a holding period the price history cannot support.

Market risk — VEV and MRM (Annex II, points 9-15)

Cornish-Fisher VaR in return space (Annex II point 12)
\[\text{VaR}_{RS} = \sigma\sqrt{N}\,\Bigl(-1.96 + 0.474\,\frac{\mu_1}{\sqrt{N}} - 0.0687\,\frac{\mu_2}{N} + 0.146\,\frac{\mu_1^2}{N}\Bigr) - 0.5\,\sigma^2 N\]
Monthly log returns of the last 5 years. Population moments: Mk = Σ(ri − M1)k/M0, σ = √M2, skew μ1 = M3/σ³, excess kurtosis μ2 = M4/σ⁴ − 3. N = number of monthly periods in the RHP.
VaR-equivalent volatility (Annex II point 13)
\[\text{VEV} = \frac{\sqrt{3.842 - 2\,\text{VaR}_{RS}} - 1.96}{\sqrt{T}}\]
T = RHP in years. For normally distributed returns VEV equals the annualised volatility; skew and fat tails move it.
MRM1234567
VEV< 0.5%0.5–5%5–12%12–20%20–30%30–80%≥ 80%

Each band includes its lower bound. Because only monthly prices are available, the MRM class is raised by one additional class (Annex II point 15).

Summary Risk Indicator (Annex II, Part 3, point 52)

CRM \ MRM1234567
11234567
21234567
33334567
45555567
55555567
66666667

CRM = 1 for directly held equities and ETFs; higher classes apply to products carrying issuer credit risk.

Performance scenarios (Annex IV points 6-11, 32-36)

Unfavourable, moderate, favourable — historical sub-intervals
\[R_k = \sum_{j=k}^{k+12T-1} r_j \;\;(\text{every window of the RHP length in the lookback}),\qquad V = I\cdot e^{R_k}\;\text{less all costs}\]
Lookback: the last 10 years (RHP ≤ 5 years) or RHP + 5 years. Moderate = median and favourable = best of all overlapping RHP-length windows; unfavourable = worst of those windows together with the windows of 1 year up to the RHP that end at the end of the lookback, the shorter ones scaled linearly to the RHP length (log return × RHP / length, i.e. the same annual growth rate). Values are shown after all costs. The intermediate 1-year column uses the 1-year windows of the same lookback.
Stress scenario (Annex IV points 18-20)
\[\sigma_S = \text{P}_{95}\bigl\{\sigma_{w}(t)\bigr\}\;(\text{P}_{99}\text{ for 1 year}),\quad V_{\text{stress}} = I\,\exp\!\Bigl[\sigma_S\sqrt{N}\Bigl(z_\alpha + \tfrac{z_\alpha^2-1}{6}\tfrac{\mu_1}{\sqrt{N}} + \tfrac{z_\alpha^3-3z_\alpha}{24}\tfrac{\mu_2}{N} - \tfrac{2z_\alpha^3-5z_\alpha}{36}\tfrac{\mu_1^2}{N}\Bigr) - 0.5\,\sigma_S^2 N\Bigr]\]
σw(t) = volatility of each rolling sub-interval of w = 12 months (6 months for the 1-year column), measured around the sub-interval mean; zα = Φ⁻¹(5 %) (1 % for 1 year); μ1, μ2 as in Annex II point 12. The stress value is shown after costs and never above the unfavourable scenario.

Columns shown: 1 year and the RHP; a mid-point column only for an RHP of 10 years or more.

Costs (Annex VI points 61-71)

Cost model and annual cost impact
\[V^{\text{net}} = I\,G\,(1-f_{\text{entry}})(1-f_{\text{ong}})^T - f_{\text{perf}}\max(\cdot - I(1-f_{\text{entry}}),0),\;\text{then}\times(1-f_{\text{exit}})\] \[\text{RIY}(T) = \Bigl(\tfrac{V^{\text{gross}}}{I}\Bigr)^{1/T} - \Bigl(\tfrac{V^{\text{net}}}{I}\Bigr)^{1/T}\]
The annual cost impact is the reduction in yield: the annual internal rate of return without costs minus the one with costs (for a single investment, the difference of the annualised returns). At the RHP it is evaluated on the moderate scenario; the 1-year column assumes a standardised net performance of 0 % (Annex VI point 71).

Multi-Asset Optimizer

Extends the core MVO engine to portfolios containing equities, ETFs, futures, crypto, bonds, and options simultaneously. Each asset class is handled by a dedicated sub-optimizer; results are stitched into a single set of weights subject to class-level allocation caps.

Asset Class Constraints

ClassCapTreatment
Equities / ETFs / Crypto35% per ticker · 15% total cryptoStandard MVO with RMT cleaning
Bonds60% totalReturns from real Treasury yield changes → MVO
Futures20% totalLinear payoff → included in MVO
Options30% totalScenario-based CVaR-LP

Data and Expected Returns

Common Calendar Months
Every asset is converted to month-end prices (daily histories are resampled) and the returns are aligned on the calendar months all assets share (at most the last 120). Volatilities are annualised ×√12 and the correlation is cleaned with the platform's Marchenko-Pastur / Ledoit-Wolf step, which leaves every volatility unchanged. Expected returns: the 5-year CAGR from the fundamentals file for stocks and ETFs (as in the other optimizers), the 5-year CAGR of the price history for crypto, futures and assets without fundamentals, and the current yield for individual bonds.

Individual Bonds — Real Treasury Yields

Monthly Bond Return
\[ r_t = -D_{\text{mod}}\,\Delta y_t + \tfrac{1}{2}\,\mathcal{C}\,(\Delta y_t)^2 + \frac{y_{t-1}}{12}, \qquad y_t = y^{\text{UST}}_t(\text{nearest maturity}) + s(\text{rating}) \]
yUST = month-end US Treasury constant-maturity yield of the tenor nearest to the bond's remaining maturity (1 month … 30 years; source FMP treasury rates, fallback Yahoo ^IRX/^FVX/^TNX/^TYX), s = credit spread by rating (0 for government bonds, held constant — spread changes are not modelled). Because Δy is the real history, bond returns carry their real correlation with equities. Dmod and C on the exact cash-flow schedule (Bond Analytics).

Modes and the Whole-Book Figures

Objectives and Option Exposure
\[ \text{Conservative: } \min \mathbf{w}^\top\Sigma\mathbf{w} \qquad \text{Standard: } \max \frac{\mathbf{w}^\top\boldsymbol\mu - r_f}{\sigma} - 0.05\,\text{quality gap} \qquad \Omega = \frac{\delta\,S}{V} \]
Balanced = Standard s.t. σ ≤ cap (annual); Aggressive = maximum return; caps per asset (35%) and per class (crypto 15%, bonds 60%, |futures| 20% in total). The quality score is the platform's sector-specific score. Book return, volatility and Sharpe include the option sleeve through its elasticity Ω: a premium weight wo adds wo·Ω of underlying exposure and earns (1 − Ω)·rf on the rest. The 10-year Monte Carlo grows at rf + β·5% with β of the whole book against SPY, read out from the exact lognormal distribution. The user's risk-free rate is used throughout.

Options Sub-Optimizer — CVaR Linear Programme

CVaR-LP (Rockafellar & Uryasev, 2000)
\[\min_{w,z,\zeta}\; \zeta + \frac{1}{(1-\alpha)S}\sum_{s=1}^{S} z_s \quad \text{s.t. } z_s \geq -r_s^\top w - \zeta,\; z_s \geq 0,\; \sum w_i = \text{opt\_alloc}\]
S = 5,000 scenarios, α = 0.95 (user-configurable). Each scenario r_s is computed from the Black-Scholes option P&L over the horizon. The LP minimises the expected shortfall of the option sub-portfolio while keeping total option weight at opt_alloc.

Combined Portfolio Metrics

Sharpe — linear + bond weights only
\[\text{Sharpe} = \frac{\mu_p - r_f}{\sigma_p}, \quad \text{where } \mu_p, \sigma_p \text{ use RMT-cleaned covariance of linear + bond assets}\]
Options are excluded from the Sharpe denominator (non-linear payoffs invalidate Gaussian variance). Portfolio Greeks (Δ, Γ, Θ, V) are aggregated across all option legs and displayed separately.

Portfolio Analyzer

Holdings-based workflow: enter current positions as (ticker, shares) pairs, and the engine computes current portfolio metrics, runs a full MVO re-optimization, and produces a rebalancing plan with trade-level cost estimates.

Holdings → Weights

Current weight computation
\[w_i^{\text{cur}} = \frac{n_i \cdot S_i}{\sum_j n_j \cdot S_j}\]
nᵢ = shares held, Sᵢ = current price. Weights are recomputed at analysis time using live prices from FMP (primary) → Polygon → Yahoo fallback chain. The denominator is the total portfolio market value.

Rebalancing Plan

Trade quantity and cost
\[\Delta n_i = \frac{(w_i^* - w_i^{\text{cur}}) \cdot V_{\text{total}}}{S_i}, \quad C_{\text{tx}} = |{\Delta n_i}| \cdot S_i \cdot c\]
w*ᵢ = MVO-optimal weight, V_total = total portfolio value, c = transaction cost (default 0.10%). ΔnΔn > 0 → BUY, ΔnΔn < 0 → SELL. Fractional shares are rounded to the nearest integer; residual cash is tracked.

Comparison Metrics

MetricFormula
Sharpe(μ − r_f) / σ
Sortino(μ − r_f) / σ_down, σ_down = √(E[min(r,0)²] × P), P = bars per year of the return series: 12 for the 24 monthly returns used on the platform (252 only for daily data)
BetaCov(r_p, r_SPY) / Var(r_SPY)
Alpha (Jensen)μ_p − r_f − β(μ_SPY − r_f)
Max Drawdownmax(V_peak − V_trough) / V_peak over the last 24 monthly closes (intra-month troughs are not seen, so it understates a daily max drawdown)

Advanced Stress Test — Custom Scenarios

Extends the historical scenario library with a fully configurable shock constructor. The user specifies a base crisis (optional), market-wide shock, per-sector shocks, and per-ticker overrides. A GBM path is generated to visualise how portfolio value evolves through the scenario.

Shock Priority Chain

Per-asset shock resolution
\[r_i = \begin{cases} \text{ticker\_shocks}[i] & \text{if ticker override set} \\ \text{sector\_shocks}[\text{sector}(i)] & \text{elif sector shock set} \\ \text{base\_impact}[\text{sector}(i)] & \text{elif base crisis loaded} \\ \text{market\_shock} & \text{otherwise} \end{cases}\]
Four-level priority ensures fine-grained control. Sector shocks override the base crisis for specific sectors; ticker shocks are the highest priority and override everything else for individual positions.
Spillover between sectors
\[r_i' = r_i + \phi \sum_{s \neq \text{sector}(i)} \text{sector\_shocks}[s]\]
φ = spillover coefficient (0–1). When φ > 0, stress from other sectors bleeds into all positions, modelling contagion. φ = 0 (default) produces fully independent sector shocks.
Portfolio scenario return
\[R_p = \sum_i w_i \cdot r_i'\]
Weighted sum of per-asset shocked returns. Compared against the same portfolio under the current weights and under the MVO-optimal weights to highlight divergence.

GBM Path Generation

Constrained GBM
\[\text{innovations}_t \sim \mathcal{N}(0,\,\sigma\sqrt{\Delta t}), \quad \text{innovations rescaled s.t. } \sum_t \text{innov}_t = \ln(1 + R_p)\]
50-point path over T years. Random normal increments are generated then linearly rescaled to hit the target log-return exactly. This preserves the specified volatility while matching the scenario endpoint — giving a realistic visual trajectory rather than a straight line.

Options Strategy Builder

Assembles multi-leg options strategies from a ticker, spot price, implied volatility, and expiration date. Each strategy is defined as a set of legs with direction (+1 long / −1 short), option type, and a delta target used to select the appropriate strike.

Supported Strategies

StrategyLegsView
Covered CallLong stock + short OTM call (Δ≈0.30)Neutral-bullish, income
Protective PutLong stock + long OTM put (Δ≈−0.25)Bullish with downside insurance
CollarLong stock + short OTM call + long OTM putBounded risk and reward
Long StraddleLong ATM call + long ATM putVolatility long, direction neutral
Long StrangleLong OTM call (Δ≈0.25) + long OTM put (Δ≈−0.25)Vol long, cheaper than straddle
Bull Call SpreadLong ATM call + short OTM call (Δ≈0.30)Bullish, defined risk/reward
Bear Put SpreadLong ATM put + short OTM put (Δ≈−0.30)Bearish, defined risk/reward
Short StraddleShort ATM call + short ATM putSell volatility, range-bound
Iron CondorShort OTM call spread + short OTM put spreadLow-vol income, 4 legs

Strike Selection via Delta Targeting

Delta-implied strike
\[K = S \cdot \exp\!\left(\sigma\sqrt{\tau} \cdot d_1^{-1}(\Delta_{\text{target}})\right)\]
ATM legs target |Δ| = 0.50, OTM legs target |Δ| = 0.25–0.30. The strike is solved by inverting the Black-Scholes delta formula. BAW adjustment is applied for American-style options. The resulting legs are priced using the full BS/BAW engine.

Portfolio Greeks Aggregation

Aggregate greeks
\[\Delta_p = \sum_i q_i \cdot \text{dir}_i \cdot \Delta_i, \quad \Gamma_p = \sum_i q_i \cdot |\text{dir}_i| \cdot \Gamma_i\]
qᵢ = position size (contracts × 100 shares/contract), dirᵢ = ±1. Theta and Vega sum linearly. Portfolio delta-dollar = Δ_p × S (exposure to 1% move in spot). Greeks are recomputed live on price or IV change.

Tax Loss Harvesting

For each lot i: q = shares, P0 = purchase price and P = live price in the listing currency, X0 = USD per unit of that currency at the purchase date (Yahoo daily close), X = today's rate. All amounts are in USD.

Cost, value, unrealised P&L
\[ C_i = q\,P_0\,X_0, \qquad V_i = q\,P\,X, \qquad \text{P\&L}_i = V_i - C_i \ \ (\text{long}), \qquad \text{P\&L}_i = q\,(P_0 - P)\,X \ \ (\text{short}) \]

Which lots a sale realises

Lot method by country
\[ \text{US: each lot}; \qquad \text{UK, FR: } \text{P\&L}_{\text{pool}} = \sum_{i \in \text{line}} V_i - \sum_{i \in \text{line}} C_i \] \[ \text{DE, BE (FIFO): } k^* = \arg\min_k \sum_{j=1}^{k} \big(V_{(j)} - C_{(j)}\big), \quad \text{lots ordered by purchase date} \]
US: specific identification. UK: Section 104 pool at average cost; FR: weighted average cost (PMP) — selling the whole line realises the pool P&L. DE / BE: a sale takes the oldest lots first; the candidate is the FIFO prefix with the largest loss. Belgium: a lot bought before 2026 has the basis max(Ci, q·P31-12-2025·X31-12-2025). A candidate loses at least the threshold % of its cost.

Taxable loss and this year's saving

Rates and offset rules
\[ L^{\text{tax}} = L\,(1 - \text{TF}), \qquad \text{TF} = 30\%\ (\text{equity fund}),\ 15\%\ (\text{mixed}),\ 0\ \text{otherwise (DE only)} \] \[ \text{Saved} = T(G) - T(G \ominus L), \qquad \text{Carry} = \text{loss not used this year} \]
G = realised gains entered for this year. US: τST = 37%, τLT = 20% (long-term = held more than one year); short-term and long-term losses net against their own term first, then the other term, then ≤ $3,000 of ordinary income at 37%; the rest carries forward. DE: 26.375%; share losses offset only share gains, other losses offset any gain; allowance €1,000. UK: 24%; T = τ·max(0, G − L − £3,000) — current-year losses are set against gains in full. FR: 31.4%; carry 10 years. BE: 10%; T = τ·max(0, G − L − €10,000); unused losses are lost. NL (Box 3) and CH: not applicable. "Potential" = Σ Ltax·τ at each lot's own rate; in the US the saving this year can exceed it, because a long-term loss that crosses over offsets short-term gains taxed at 37%. Wash-sale (US) and 30-day (UK) rules are flagged; a US substitute that tracks the same index is marked as possibly substantially identical.

Signal Analysis

Evaluates each factor from the Factor Library as a standalone trading signal over forward periods of 1, 3, 6, and 12 months. Produces Information Coefficient, hit rate, long/short spread, and t-statistics. Supports ensemble composite construction via OLS signal combination.

Information Coefficient (IC)

Spearman rank IC
\[\text{IC} = \rho_S(\text{factor scores},\; r_{\text{fwd}})\]
ρ_S = Spearman rank correlation between cross-sectional factor scores and subsequent forward returns. IC ∈ [−1, 1]; IC > 0 means the factor predicts future returns positively. Significance assessed by p-value from exact Spearman distribution.

Hit Rate & Long/Short Spread

Long/Short classification and spread
\[\text{Long} = \{i : s_i \ge 0.67\}, \quad \text{Short} = \{i : s_i \le 0.33\}\] \[\text{Spread} = \bar{r}_{\text{long}} - \bar{r}_{\text{short}}, \quad \text{AnnSpread} = (1 + \text{Spread})^{12/T} - 1\]
Top/bottom tercile split. Hit rate = fraction of long positions with positive forward return. Spread = mean forward return difference between top and bottom tercile. T-statistic from Welch's two-sample t-test (unequal variance).

Ensemble Composite

OLS signal combination
\[\hat{r} = \sum_k \omega_k \cdot s_k^{(i)}, \quad \hat{\omega} = \arg\min \|r_{\text{fwd}} - X\omega\|^2\]
X = matrix of standardised factor scores (z-scores), r_fwd = forward returns. OLS weights ω̂ are estimated from the cross-section. The composite score ŝᵢ = Xᵢω̂ is used to rank stocks for the combined signal. Weights are clipped to [0, 1] and re-normalised to avoid factor cancellation.

Efficient Frontier

Generates the mean-variance efficient frontier by Monte Carlo sampling of random portfolios, then renders an interactive scatter chart. Clicking any point populates weight sliders; dragging a slider instantly recomputes portfolio metrics for the custom allocation.

Random Portfolio Generation

Dirichlet sampling (long-only)
\[\mathbf{w} \sim \text{Dirichlet}(\mathbf{1}_n), \quad \sum_i w_i = 1,\; w_i \ge 0\]
1,500 random portfolios are drawn from a symmetric Dirichlet distribution (concentration = 1, uniform over the simplex). Each portfolio's expected return (μ_p = w⊤μ) and volatility (σ_p = √(w⊤Σw)) are computed using the same RMT-cleaned covariance matrix as the main optimizer.
Sharpe colour axis
\[\text{Sharpe}_p = \frac{\mu_p - r_f}{\sigma_p}\]
Each point on the scatter chart is coloured by its Sharpe ratio. The maximum-Sharpe portfolio (tangency portfolio) appears at the rightmost tip of the upper envelope. The minimum-variance portfolio sits at the leftmost point of the frontier.

Interactive Metrics

MetricFormulaNotes
Sharpe(μ − r_f) / σUses RMT covariance
Sortino(μ − r_f) / σ_downσ_down = downside deviation × √12 (monthly returns)
BetaΣ wᵢ βᵢWeighted sum of individual betas vs SPY
QualityΣ wᵢ qᵢWeighted quality score (0–1)