Open-source Python models for quantitative finance, each with the theory, the code and the results.
Read the theory, explore the code, and copy what you need.

Alpaca and Interactive Brokers paper APIs, TradingAgents, Glassbench, a TradingView MCP server and QuantConnect Lean: what each one is free for, the interface, and the code that connects to it.

Sell an at the money call, hedge it daily with Black-Scholes delta across 150,000 simulated paths, and watch the hedging error explode at the strike as expiry closes in.

Net dealer gamma from the full SPX chain, the gamma flip, the call and put walls, and how a trading bot on the Interactive Brokers API uses them.

Trees, random forests and XGBoost on a survivorship free S&P 500 panel, then PCA on the Treasury curve and Lasso on a macro panel, with honest results.

A feed forward net fits the SPY vol surface, an LSTM and a transformer forecast volatility, a CNN reads charts, and an autoencoder compresses 45 large caps.
Moskowitz, Ooi and Pedersen reproduced on 45 free ETFs from 2005 to 2026, lookback against holding period, scored in sample and out of sample.

The US curve from FRED and the Brazilian curve from Tesouro Direto with a Nelson Siegel Svensson fit, plus how to read inversion, steepening and flattening.

arch, QuantLib, FinancePy, tf-quant-finance, gs-quant and the SVI paper: what each one is for, the data it needs, and a runnable script for every one.

Complete implementation of the Black-Scholes framework covering European option pricing, arbitrage bounds, implied volatility via Brent's method, and put-call parity.

Step-by-step Delta, Gamma, Theta and Vega in Python. Includes formulas, plots, and an interactive chart that shows how gamma sharpens as time to expiry approaches zero.

Stochastic volatility step by step: each Heston parameter as a 1D slice (rho, xi, kappa, v_0), then stacked into the full 3D implied vol surface with a low-vs-high regime comparison.

Monte Carlo simulation under Geometric Brownian Motion with Itô correction. Terminal distributions, path simulation, and comparison against Black-Scholes analytical prices.

Cox-Ross-Rubinstein binomial tree for American and European option pricing, early exercise detection, and convergence to Black-Scholes.

Mean-variance optimization using the Markowitz framework, covering efficient frontier, Sharpe ratio maximization, constrained allocation, and portfolio backtesting.

The second and third order Greeks a vol desk actually watches: vanna, volga, charm, speed, zomma, colour and ultima, each derived and plotted against the variable that moves it.

A long strangle against a short straddle, sized so vega is exactly zero. What is left is volga, and the page finds where that convexity peaks in every vol regime.

Gamma sliced one dimension at a time against spot, vol, time and strike, then stacked into the full 3D Black-Scholes gamma surface as expiry approaches.

Two numpy MLPs learn the implied volatility surface from real option chains, trained and scored on a strict out-of-time split.

Deep learning applied to the SPY implied volatility surface, with the data pipeline, the architecture choices, and an honest out-of-sample read.

A recurrent network learns a hedging policy directly from simulated paths instead of reading delta off a closed form, and is tested against the Black-Scholes hedge.

Lopez de Prado's HRP and HCAA built from scratch, clustering the correlation matrix before allocating, and benchmarked against Markowitz.

Five risk based allocation methods backtested side by side with GARCH volatility forecasts, including the turnover and cost drag each one carries.

Where to pull real option chains without paying for a data vendor, how to clean the quotes, and how to re-imply the vols so the surface is usable.
Specialised AI agents for quantitative finance, from equity valuation to fund analytics.

Three agents, the Architect, the Analyst and the Reporter, build a full equity valuation with scenarios, sensitivities, the Excel model and the written reports.
One brief made Claude the CIO of an 850 million dollar endowment: a six desk office of subagents, a point in time data wall and five years of decisions.
Every FIDC registered with the CVM in one screen, rebuilt from open data: size, capital structure, returns against the CDI and delinquency.