Where capital
meets consequence.
Quantitative risk frameworks built on institutional methodology — VaR, stress testing, scenario analysis, liquidation mapping. Python-powered. Currently sitting CFA exams — building the analytical rigour from the inside out.
Seeing where the
market is fragile.
Liquidation heatmaps reveal the price levels where leveraged positions are most concentrated — and therefore most vulnerable. By mapping open interest and estimated stop-loss clusters, it becomes possible to anticipate where price is likely to accelerate or reverse sharply as cascading liquidations trigger.
Reading the tape
before price moves.
Order book depth analysis reveals the real-time supply/demand structure. Large walls, thin zones and DOM imbalances are leading indicators of price direction — used in conjunction with liquidation mapping for high-conviction setups.
Institutional-grade tools.
Built from scratch.
Every model below is built in Python, validated with real market data and designed around the same methodologies applied at hedge funds, prime brokers and risk departments at major financial institutions — from Black-Scholes to Geometric Brownian Motion, CAPM to Efficient Frontier optimisation.
def gbm_paths(S0, mu, sigma, T, dt, n):
steps = int(T/dt)
Z = np.random.standard_normal((n, steps))
drift = (mu - 0.5*sigma**2)*dt
shock = sigma * np.sqrt(dt) * Z
increments = np.exp(drift + shock)
paths = S0 * np.cumprod(increments, axis=1)
return paths
# Run 10,000 paths · compute VaR
paths = gbm_paths(S0=97420, mu=0.25,
sigma=0.72, T=30, dt=1, n=10_000)
VaR_99 = np.percentile(paths[:,-1], 1)
CVaR_99 = paths[:,-1][paths[:,-1]<=VaR_99].mean()
import statsmodels.api as sm
def capm_beta(asset_returns, market_returns):
X = sm.add_constant(market_returns)
model = sm.OLS(asset_returns, X).fit()
alpha, beta = model.params
return {
"alpha": alpha, # Jensen's Alpha
"beta": beta,
"r2": model.rsquared,
"treynor": (asset_returns.mean()-Rf)/beta
}
# Expected return via SML
def expected_return(beta, Rf=0.05, Rm=0.12):
return Rf + beta * (Rm - Rf)
def bsm_greeks(S, K, T, r, σ, flag='call'):
d1=(np.log(S/K)+(r+σ**2/2)*T)/(σ*np.sqrt(T))
d2 = d1 - σ*np.sqrt(T)
Nd1,Nd2 = norm.cdf(d1),norm.cdf(d2)
nd1 = norm.pdf(d1)
return {
"price": S*Nd1 - K*np.exp(-r*T)*Nd2,
"delta": Nd1,
"gamma": nd1/(S*σ*np.sqrt(T)),
"vega": S*nd1*np.sqrt(T)/100,
"theta": -(S*nd1*σ)/(2*np.sqrt(T))/365,
"rho": K*T*np.exp(-r*T)*Nd2/100
}
from pmdarima import auto_arima
# Auto-select optimal (p,d,q) order
auto = auto_arima(returns, seasonal=False,
information_criterion='aic',
stepwise=True, suppress_warnings=True)
# Fit ARIMA(2,1,2) on log-returns
model = ARIMA(log_returns, order=(2,1,2)).fit()
forecast = model.forecast(steps=10)
conf_int = model.get_forecast(10).conf_int()
# AIC/BIC for model selection
print(f"AIC: {model.aic:.1f} | BIC: {model.bic:.1f}")
"GFC_2008":{"equity":-0.52,"credit":+0.45,"fx":-0.18},
"COVID_2020":{"equity":-0.34,"vix":+3.0,"oil":-0.67},
"FED_TAPER":{"rates":+2.0,"dur":-0.16},
"CRYPTO_CRASH":{"btc":-0.70,"eth":-0.75},
}
"market_vol": 0.30, "credit_risk": 0.25,
"liquidity": 0.20, "concentration": 0.15,
"macro_regime": 0.10
}
def grade(score):
return ("AAA" if score<2 else
"A" if score<4 else
"BB" if score<6 else
"B" if score<8 else "CCC")
USD · Gold · BTC · ETH
Summarised analytical views on four key assets that form the backbone of macro risk assessment. Updated regularly as part of my broader macro-to-micro risk framework.
Fed signals. Inflation data.
What it all means.
The Federal Reserve's preferred inflation gauges — PCE, Core PCE and CPI — are the primary inputs to monetary policy decisions that cascade through every asset class globally.