Finance lab

Models from corporate finance and investments, built to play with. Everything runs in plain JavaScript in your browser, with no libraries.

CAPM and the security market line

Required return = risk-free rate + beta × market risk premium.

Required return

Discounted cash flow valuation

Five years of growing free cash flow plus a Gordon growth terminal value, discounted at the WACC.

Enterprise value

Sensitivity: enterprise value (m)

Rows are terminal growth, columns are WACC. The outlined cell is your base case.

Portfolio optimizer

Markowitz mean-variance optimization for three assets. The curve is the efficient frontier, the dots are 1,400 random long-only portfolios colored by Sharpe ratio, from lavender (low) to pink (high).

Bonds
Equities
Emerging
Correlations and risk-free rate
Max Sharpe ratio
Tangency return
Tangency risk
Lowest possible risk

Monte Carlo simulation

Thousands of possible futures for a portfolio, simulated month by month with geometric Brownian motion. Shows the range of outcomes, the chance of losing money and the 95% Value at Risk.

Median outcome
Mean outcome
Chance of a loss
95% Value at Risk

Option pricing with Black–Scholes

The price of a European option and its Greeks: how the price reacts to the stock (delta, gamma), volatility (vega), time (theta, per day) and interest rates (rho).

Price
Delta
Gamma
Vega
Theta
Rho
Value todayPayoff at expiryCurrent stock price

Put–call parity check: .

Bond pricing, duration and convexity

Price a bond with face value 1,000, and see why duration alone underestimates the price when yields move: the price–yield curve is convex.

Price
Macaulay duration
Modified duration
Convexity

Actual priceDuration estimateDuration + convexity