Skip to content
Finance
Skill

/option-pricing

Pricing completo de opciones europeas y americanas. 9 metodos: Black-Scholes, Binomial CRR, Trinomial, Monte Carlo (antithetic) + Longstaff-Schwartz, Bjerksund-Stensland 2002 / BAW (American closed-form), Heston 1993 (vol estocastica, sonrisa via Fourier), Bates 1996 (Heston +

From plugin
skills
25632 skills

Claude Code

$ npx -y skills add gauss314/skills --skill option-pricing --agent claude-code

SKILL.md

option-pricing.SKILL.md
name: option-pricing
description: "Pricing completo de opciones europeas y americanas. 9 metodos: Black-Scholes, Binomial CRR, Trinomial, Monte Carlo (antithetic) + Longstaff-Schwartz, Bjerksund-Stensland 2002 / BAW (American closed-form), Heston 1993 (vol estocastica, sonrisa via Fourier), Bates 1996 (Heston + Merton jumps, crash risk), greeks (BS), implied vol, P(ITM) y P(Profit). Disenado para backtesting: cada funcion es flat Python vectorizado con numpy (sin abstracciones), usa math.erfc (no scipy). BS 2.4 us/op, BS2 3.6 us, Heston 400 us, Binomial N=500 5.6 ms. CLI con 15 modos mas validate y bench. Time complexity O(1) para todos los closed-form."
license: MIT

Option Pricing — Skill de Tooling

Pricing de opciones para **backtesting** y analisis. 5 metodos implementados, todos en flat Python + numpy (sin dependencias externas pesadas, sin abstracciones, sin clases). Cada funcion es ~100 lineas o menos y acepta escalares.

**Performance objetivo** (medida en este skill):

  • Black-Scholes: **0.0012 ms/op** (~800.000 opciones/seg)
  • BAW (American closed-form): **0.0014 ms/op** (~730.000 opciones/seg)
  • Binomial N=500: 3 ms/op — 2000x mas lento que BS, pero preciso

Para la teoria detallada de cada metodo, ver `references/REFERENCE.md`.

---

Quick start

# 1. Black-Scholes (europea)
py scripts/option_pricing.py bs --S 100 --K 100 --T 0.25 --r 0.05 --sigma 0.20

# 2. Binomial CRR (europea o americana)
py scripts/option_pricing.py binomial --S 100 --K 100 --T 0.25 --r 0.05 --sigma 0.20 --style american

# 3. Trinomial (europea o americana)
py scripts/option_pricing.py trinomial --S 100 --K 100 --T 0.25 --r 0.05 --sigma 0.20

# 4. Monte Carlo (europea, antithetic variates)
py scripts/option_pricing.py mc --S 100 --K 100 --T 0.25 --r 0.05 --sigma 0.20 --paths 200000

# 5. Longstaff-Schwartz (americana via MC)
py scripts/option_pricing.py lsm --S 100 --K 100 --T 0.25 --r 0.05 --sigma 0.20 \
  --style american --paths 100000 --steps 50

# 6. Barone-Adesi-Whaley (americana closed-form)
py scripts/option_pricing.py bs2 --S 100 --K 100 --T 0.25 --r 0.05 --sigma 0.20 --q 0.04 \
  --style american

# 7. Greeks analiticos (BS)
py scripts/option_pricing.py greeks --S 100 --K 100 --T 0.25 --r 0.05 --sigma 0.20

# 8. Implied volatility
py scripts/option_pricing.py iv --S 100 --K 100 --T 0.25 --r 0.05 --price 4.62

# 9. P(ITM) y P(Profit) bajo medida risk-neutral Q
py scripts/option_pricing.py pitm --S 100 --K 100 --T 0.25 --r 0.05 --sigma 0.20
py scripts/option_pricing.py pitm --S 100 --K 100 --T 0.25 --r 0.05 --sigma 0.20 --premium 4.62

# 10. Superficie de precios across strikes
py scripts/option_pricing.py surface --S 100 --T 0.25 --r 0.05 --sigma 0.20 \
  --K-min 80 --K-max 120 --K-step 5

# 11. Heston 1993 (vol estocastica, sonrisa via Fourier)
py scripts/option_pricing.py heston --S 100 --K 100 --T 0.25 --r 0.05 --sigma 0.20 \
  --v0 0.04 --kappa 2.0 --theta 0.04 --sigma_v 0.3 --rho -0.5

# 12. Bates 1996 (Heston + Merton jumps, captura crash risk)
py scripts/option_pricing.py bates --S 100 --K 100 --T 0.25 --r 0.05 --sigma 0.20 \
  --v0 0.04 --kappa 2.0 --theta 0.04 --sigma_v 0.3 --rho -0.5 \
  --lam 1.0 --mu_J -0.05 --sigma_J 0.10

# 13. Comparar todos los metodos aplicables
py scripts/option_pricing.py all --S 100 --K 100 --T 0.25 --r 0.05 --sigma 0.20

# Validar contra casos de assets/validation_cases.json
py scripts/option_pricing.py validate

# Benchmark de todos los metodos
py scripts/option_pricing.py bench --S 100 --K 100 --T 0.25 --r 0.05 --sigma 0.20

---

Estructura del skill

skills/option-pricing/
├── SKILL.md                              # Este archivo (guia rapida)
├── references/
│   └── REFERENCE.md                      # Teoria completa de los 5 metodos
├── assets/
│   ├── defaults.json                     # Parametros default para el CLI
│   └── validation_cases.json             # Casos de test (Hull Examples + extra)
└── scripts/
    └── option_pricing.py                 # CLI con 15 modos + validate + bench

---

Parametros del CLI (comunes a todos los modos)

| Flag | Default | Descripcion | |-------------|---------|----------------------------------------------| | `--S` | 100.0 | Spot price del subyacente | | `--K` | 100.0 | Strike | | `--T` | 0.25 | Tiempo a maturity en anos (0.25 = 3 meses) | | `--r` | 0.05 | Tasa libre de riesgo (continua anual) | | `--q` | 0.0 | Dividend yield continuo anual | | `--sigma` | 0.20 | Volatilidad anualizada | | `--type` | call | call o put | | `--style` | european | european o american | | `--steps` | 500 | Pasos del tree / pasos temporales de LSM | | `--paths` | 100000 | Paths de Monte Carlo | | `--seed` | 42 | Seed para reproducibilidad | | `--antithetic` | True | Activar variates antitetic (MC) | | `--json` | False | Output en JSON en vez de tabla |

Defaults se cargan de `assets/defaults.json` (modificables).

---

Los 9 metodos + benchmarks (medidos en Python 3.14 + numpy 2.4.4)

**Inputs del benchmark** (ATM call, mismos valores para todos los metodos): `S=100, K=100, T=0.25, r=0.05, q=0, sigma=0.20`. Medido con 2000 reps (o menos para metodos lentos), Windows 11. **No asumido — medido con `time.perf_counter()`** sobre la funcion expuesta por el skill.

| Metodo | Time complexity | us/op (medido) | ops/sec | Estilo | Error tipico | |--------|-----------------|---------------:|--------:|--------|--------------| | **Black-Scholes** `bs` | O(1) | **2.4 us** | 419k/s | European | 0 (closed) | | **P(ITM)** `pitm` | O(1) | **1.1 us** | 908k/s | Ambos | 0 (closed N(d2)) | | **Greeks (BS)** `greeks` | O(1) | **3.9 us** | 257k/s | European | 0 (closed)

Read more
@gauss314
Ships withskills

Open-source collection of skills compatible with the SKILL.md standard. Developed for the AI courses at UCEMA.

Stars on GitHub

Momentum

stars in total
256
Star history of gauss314/skills on GitHub, a chart by star-history.com

Other skills on skills.

alpaca-data

alpaca-data

Market Data API de Alpaca: acciones, crypto, opciones. Historical y real-time data para 5000+ stocks.

@gauss314@gauss314Install Skill
alpaca-trading

alpaca-trading

Trading API de Alpaca: órdenes, posiciones, cuenta. Paper trading y live trading de acciones, crypto y opciones.

@gauss314@gauss314Install Skill
alpha-vantage

alpha-vantage

API de datos financieros de EE.UU.: acciones, forex, crypto, indicadores técnicos, fundamental data.

@gauss314@gauss314Install Skill
backtesting

backtesting

Academic backtesting framework for quantitative research. ~30 risk and performance ratios, 10 classes of indicators, event-driven…

@gauss314@gauss314Install Skill
barchart

barchart

Quotes, fundamentals, insider, analyst ratings, earnings estimates, financial summary, income/balance/cashflow detail y company…

@gauss314@gauss314Install Skill
bcra-macro

bcra-macro

API de Estadísticas Monetarias v4.0 del BCRA con 638 series macroeconómicas (reservas, tipo de cambio, tasas, M1/M2/M3,…

@gauss314@gauss314Install Skill

More skills from other plugins.

ccxt-cli

ccxt-cli

CCXT command-line interface (ccxt-cli) for interacting with 100+ cryptocurrency exchanges directly from the terminal — no code…

ccxt9d45k
@ccxt@ccxtInstall Skill

Questions about option-pricing.

Which coding agents can use option-pricing?
option-pricing installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.