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%).

Infeasibility Handling

If the set of constraints is infeasible (e.g. locked weights sum to more than 1, or sector caps conflict with locked positions), MAISNER raises an explicit error identifying which constraint is violated. It never silently relaxes user-defined constraints.

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{T}{N}}\right)^2 \]
T = observations, N = assets. Eigenvalues within [λ, λ+] are noise and replaced with their mean.

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 returns for the covariance matrix. A hybrid approach (10-year monthly + 2-year daily) was tested but produced spurious correlations between unrelated assets — pure 2-year daily provides cleaner signal.

Quality Tilt

Pure Sharpe maximization often overweights assets with recent momentum. MAISNER applies a quality penalty to the MVO objective, tilting the optimizer toward fundamentally strong companies.

Quality Score

Quality-Adjusted Objective
\[ \max_{\mathbf{w}} \; S(\mathbf{w}) - \lambda_Q \sum_i w_i \cdot \mathbb{1}[q_i < q_{thresh}] \]
λQ = quality penalty weight (0.05), qthresh = minimum quality threshold (0.30)

Quality scores are computed from FMP fundamental data: ROE, gross margin, operating margin, and debt coverage ratio. Each metric is normalized and combined into a composite score in [0, 1].

ParameterValue
LAMBDA_QUAL0.05
QUALITY_THRESH0.30
MetricsROE, Gross Margin, Op. Margin, Debt Coverage

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 are generated via Geometric Brownian Motion with correlated asset paths.

GBM Asset Path
\[ S_t = S_0 \exp\left[\left(\mu - \frac{\sigma^2}{2}\right)t + \sigma W_t\right] \]
μ = annualised return, σ = annualised volatility, Wt = Wiener process. Portfolio paths use correlated draws via Cholesky decomposition.
ParameterValue
Paths10,000
Horizon10 years
Output5th / 50th / 95th percentile
MetricsP(loss), P(2×), Median@10y, Range

Stress Testing

Historical scenario analysis replays actual crisis return distributions against the current and optimised portfolios. Custom stress mode allows arbitrary macro shock specification.

Historical Scenarios

ScenarioPeriodS&P 500 Drawdown
2008 GFCSep 2008 – Mar 2009−56.8%
2020 COVIDFeb 2020 – Mar 2020−33.9%
2022 Rate ShockJan 2022 – Oct 2022−25.4%
2000 Dot-comMar 2000 – Oct 2002−49.1%

Advanced Stress — Custom Shocks

Users can define simultaneous shocks across equity markets (by region/sector), interest rates, FX rates, and individual ticker overrides. Shocks are applied as multiplicative return adjustments to portfolio weights.

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.

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

Duration and Convexity

Modified Duration
\[ D_{mod} = \frac{1}{P} \sum_{t=1}^{T} \frac{t \cdot C_t}{(1+y)^{t+1}} \]
P = bond price, Ct = cash flow at time t, y = yield to 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 & Deflated Sharpe Ratio

Walk-Forward Validation

All strategy backtests use walk-forward analysis: the strategy is fitted on a training window and evaluated on an out-of-sample test window that rolls forward in time. This prevents look-ahead bias and provides a realistic estimate of live performance.

Deflated Sharpe Ratio

Multiple testing bias is a major source of overfitting in quantitative strategies. MAISNER computes the Deflated Sharpe Ratio (DSR), which adjusts the observed Sharpe Ratio for the number of trials tested and the non-normality of returns.

Deflated Sharpe Ratio
\[ DSR = \Phi\left(\frac{(\hat{SR} - SR^*)\sqrt{T-1}}{\sqrt{1 - \gamma_3 \hat{SR} + \frac{\gamma_4-1}{4}\hat{SR}^2}}\right) \]
SR* = expected maximum Sharpe Ratio under repeated testing. γ3 = skewness, γ4 = kurtosis. DSR > 0.95 indicates the strategy survives multiple-testing correction.
DSR < 0.5 typically indicates the strategy is overfitted to the training data. MAISNER flags strategies with low DSR and warns users before live deployment.

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
LAMBDA_QUAL0.05Quality tilt penalty weight
QUALITY_THRESH0.30Min quality score threshold
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.