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 +

BOOST
From plugin
gauss314-skills
25032 skills
Install
$ npx -y skills add gauss314/skills --skill option-pricing --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/option-pricing

Context preview

The summary Claude sees to decide when to auto-load this skill.

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 +

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
Ships withgauss314-skills

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

Get the whole plugin

Other skills on gauss314-skills.