Markets look like pure chaos, but the maths of finance says otherwise: prices wander randomly, yet that randomness has a shape — and that shape is exactly what gets priced, diversified and hedged. Three tabs let you drag the shape around and watch the numbers move: Black–Scholes turns volatility and time into an option's fair price and its Greeks; portfolio theory traces the efficient frontier as you blend two risky assets; Value-at-Risk runs a live Monte-Carlo of tomorrow's P&L and asks how bad a bad day gets. Every curve is computed from the real formulas in your browser — a shared market seed keeps the random scenarios consistent across tabs.
S·N(d₁) − K·e^(−rT)·N(d₂) for a call, with the Greeks its analytic derivatives.The Black–Scholes model assumes the stock price follows geometric Brownian motion — a random walk whose percentage moves are normally distributed with volatility σ. The genius of the 1973 argument is that you can replicate an option by continuously holding delta shares of the stock and some cash, rebalancing as the price moves. Because the option can be perfectly copied by a self-financing portfolio, its price is pinned down by no-arbitrage: if it traded for anything else, you could manufacture free money.
That argument makes the stock's real-world drift disappear. Under the "risk-neutral" measure every asset grows at the risk-free rate r, and the option's value is just the discounted expected payoff. Carrying out that expectation for a European call gives the famous formula C = S·N(d₁) − K·e^(−rT)·N(d₂), where N is the normal CDF and d₁, d₂ package up moneyness, volatility and time.
The Greeks are the formula's partial derivatives, and each is a risk you can hedge. Delta (∂V/∂S) is your exposure to the stock and the number of shares to short to stay neutral. Gamma (∂Δ/∂S) is how fast that hedge goes stale. Vega is sensitivity to volatility, theta the daily time-decay, and rho the interest-rate sensitivity. A trading desk lives and dies by keeping these numbers where it wants them.
The model is famously wrong in its details — real returns have fat tails and volatility isn't constant, which shows up as the volatility smile in quoted prices. Yet it remains the lingua franca of derivatives because it gives a single, arbitrage-free translation between price and volatility, and its Greeks are still how risk is measured and neutralised on every options desk in the world. Merton and Scholes won the 1997 Nobel for it; Black had died two years earlier.
Harry Markowitz's 1952 insight was to describe an investment by just two numbers: its expected return and the variance of that return. A portfolio's expected return is simply the weighted average of its holdings — but its variance is not. Because assets co-move, the portfolio variance includes covariance terms, and when two assets are less than perfectly correlated those cross-terms subtract risk. That is the whole mechanism of diversification, written in one equation.
Plot every possible mix on a risk–return chart and the reachable region has a smooth left edge: the efficient frontier. For any level of risk it names the highest-return portfolio; for any target return it names the lowest-risk one. The far-left tip is the minimum-variance portfolio. Everything strictly inside the frontier is dominated — you could get more return for the same risk, so no rational investor would hold it.
Add a risk-free asset and the picture simplifies beautifully. Mixing cash with any risky portfolio traces a straight line from the risk-free point through that portfolio. The best such line is the one with the steepest slope — the highest Sharpe ratio — and it touches the frontier at a single spot: the tangency portfolio. This is the Capital Market Line, and its slope is the market price of risk.
The startling conclusion (Tobin's two-fund separation) is that everyone should hold the same risky portfolio — the tangency one — and then dial their total risk purely by splitting between it and cash. A cautious investor lends (holds cash); an aggressive one borrows to lever it up. This logic, extended to the whole market, becomes the Capital Asset Pricing Model and earned Markowitz, Sharpe and Miller the 1990 Nobel. Its limitation is that it needs estimates of returns and covariances, and those are noisy — which is exactly what the scenario cloud is hinting at.
Value-at-Risk answers a deceptively simple question: over some horizon, what loss will I not exceed with a given confidence? At 95% one-day VaR of $32,000, you're saying that on 95 days out of 100 the loss stays below $32k — and on the other 5, it doesn't. Mathematically VaR is just a quantile of the loss distribution: draw the histogram of outcomes and slice off the worst (1−c) fraction; the cut point is the VaR.
There are three ways to get it. The parametric method assumes returns are Normal and reads the quantile straight off the formula VaR = −(μ + z·σ). The historical method just re-orders past returns and reads off the percentile. The Monte-Carlo method — the one running here — simulates thousands of scenarios from a chosen model and takes the empirical quantile. More flexible, but only as trustworthy as the model you sample from.
VaR has a famous flaw: it tells you the threshold of the tail but nothing about how deep it goes. Two portfolios can share a VaR while one occasionally loses ten times more. Expected Shortfall (also called CVaR or conditional VaR) fixes this by averaging all losses beyond the VaR line. It is a coherent risk measure — crucially, it rewards diversification instead of occasionally punishing it — which is why Basel bank regulation shifted from VaR to Expected Shortfall.
The deepest lesson is about tails. Real market returns are leptokurtic — fat-tailed — so extreme days happen far more often than a Normal bell predicts. A 5-sigma daily move should be a once-in-millennia event under the Normal; markets deliver them every few years. Switching this sim to a Student-t makes the point visible: the same middle, but a tail that reaches out past the Normal line. Much of quantitative risk management is the humble admission that you don't really know the shape of the worst day — so you stress-test, backtest, and hold capital against being wrong.