Python Code/Prompts

Open-source Python implementations and Claude prompts for quantitative finance.

Newsletter

Get exclusive models, prompts and code

One short email when there's something new. finance models, code walkthroughs, agentic prompts. No spam.

Built with
Anthropic Claude Python R ChatGPT GitHub Jupyter Excel PowerPoint VS Code SQL MATLAB

Read the theory, explore the code, and copy what you need.

Black-Scholes Option Pricing Model

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

Options Pricing Implied Volatility
ΔΓ

Option Greeks in Python

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.

Greeks Delta Gamma
Σ

Heston Vol Surface in Python

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.

Heston Stochastic Vol Skew

Monte Carlo Option Pricing with GBM

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

Monte Carlo Simulation GBM

CRR Binomial Tree for American Options

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

Binomial Tree American Options Early Exercise

MVO Portfolio Optimization

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

Portfolio Markowitz Backtesting

Dashboard Automation Prompt

Step-by-step Claude prompt that turns any Python financial model into a fully interactive, self-contained HTML dashboard.

Claude Prompt Dashboard

PowerPoint Automation Prompt

Claude Design system + Claude Code skill that builds institutional equity research decks straight from an Excel model and exports a finished PDF.

Claude Design Skills Decks

Advanced Option Greeks

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.

Greeks Volatility Second Order

Trading Volatility Convexity

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.

Volga Convexity Vega Neutral

Gamma Surface

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.

Gamma Surface 3D

Neural Network Vol Surface

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

Neural Network Volatility Machine Learning

SPY Vol Surface with Deep Learning

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

Deep Learning SPY Volatility

Deep Hedging

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.

Deep Hedging RNN Derivatives

Hierarchical Risk Parity

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

HRP Allocation Clustering

Risk Based Allocation

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

Allocation GARCH Backtest

Agentic Investment Committee

Claude Opus 5 running a full investment committee, with independent analyst agents, a chair, and a decision record for every position taken.

Agents Claude Research

Free Options Data

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.

Data Options Pipeline

Claude for Asset Management

Building a fictional investment fund end to end with Claude, from the mandate and the brand through to the reporting pack.

Claude Design Asset Management