{"id":"dabaf52a-dd1b-400f-87e1-44564322b839","slug":"financial-engineering-skill","kind":"skill","name":"financial-engineering-skill","summary":"Claude skill: price structured derivatives from a declarative YAML spec","owner":"kuanHungWang","repoUrl":"https://github.com/kuanHungWang/financial_engineering_skill","license":"Apache-2.0","licenseTier":"permissive","trust":"community","stars":1,"match":null,"fewStars":true,"format":"skill","createdAt":"2026-09-30T13:20:35.000Z","addedAt":"2026-10-30T00:57:22.648Z","logoUrl":"https://avatars.githubusercontent.com/u/24733727?v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["data-analytics"],"tags":["derivatives-pricing","derivatives-pricing-models","model-validation","monte-carlo-simulation","quantitative-finance","quantlib","structured-products"],"runtime":"binary","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-30T00:57:30.039Z","sample":false,"url":"https://conduits.dev/tools/financial-engineering-skill","language":"Python","transports":["stdio"],"install":{},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"[English](./README.md) | [繁體中文](./README.zh-TW.md)\n\n# Structured Derivative Pricer — a Claude skill\n\nA derivatives [Claude skill](https://docs.claude.com/en/docs/claude-code/skills) designed for professional\ninstitutional investors. It builds pricing models for vanilla and exotic derivatives and structured products. Once\nthe skill is installed, you only describe the product terms. The AI picks the matching model components (model,\ncurve, calibration, payoff, early termination and so on) and prices the trade by Monte Carlo simulation when there\nis no closed form.\n\nThe skill does not build a pricing model by generating code. It uses a factory design pattern: most of the common\ncomponents (curve, model, calibration, schedule, market convention, Monte Carlo, Longstaff-Schwartz and more) are\nbuilt in advance, and a full pricing workflow is assembled from them. Every pricing model is expressed in the end\nas one YAML file. This avoids the \"generate code → run → debug\" loop entirely, so results come out consistently.\n\n---\n\n## Installation\n\n### Requirements\n\n- [Claude Code](https://docs.claude.com/en/docs/claude-code) (or another Claude client that supports skills)\n- Python 3 (3.11 recommended), or [uv](https://github.com/astral-sh/uv), which fetches Python 3.11 itself\n- Network access on first use, to install QuantLib, pydantic, PyYAML, NumPy and pandas\n\n### Option 1: plugin marketplace (recommended)\n\nIn Claude Code, add this repository as a marketplace and install the plugin:\n\n```text\n/plugin marketplace add kuanHungWang/financial_engineering_skill\n/plugin install financial-engineering@financial-engineering-skill\n```\n\nOr the same from your shell:\n\n```bash\nclaude plugin marketplace add kuanHungWang/financial_engineering_skill\n```\n\n```bash\nclaude plugin install financial-engineering@financial-engineering-skill\n```\n\nRestart Claude Code (or run `/reload-plugins`). The skill appears as\n`financial-engineering:structured-derivative-pricer`, and Claude uses it on its own when you ask to price a product.\nTo get a newer version later:\n\n```bash\nclaude plugin marketplace update financial-engineering-skill\n```\n\n```bash\nclaude plugin update financial-engineering@financial-engineering-skill\n```\n\n### Option 2: copy the skill folder\n\nClone the repository and put the `structured-derivative-pricer/` folder where Claude Code looks for skills.\n\n```bash\ngit clone https://github.com/kuanHungWang/financial_engineering_skill.git\n```\n\nFor every project (personal skills):\n\n```bash\nmkdir -p ~/.claude/skills && cp -R financial_engineering_skill/structured-derivative-pricer ~/.claude/skills/\n```\n\nOr for one project only, copy it into that project's `.claude/skills/` folder instead. A symlink\n(`ln -s`) works too, if you want `git pull` to update the skill.\n\n### Option 3: other agents\n\nThe skill follows the [Agent Skills](https://agentskills.io) standard, so installers such as\n[skills.sh](https://skills.sh) can add it to other coding agents too:\n\n```bash\nnpx skills add kuanHungWang/financial_engineering_skill\n```\n\n### Set up the Python environment (optional)\n\nThe skill runs `scripts/setup.sh` itself the first time it is used. It creates a `.venv` inside the skill folder\nwith QuantLib and the other requirements, and prints the path of its Python. It is idempotent: running it again is\na no-op. To do it ahead of time with a copied folder (option 2), and check the install:\n\n```bash\nPY=$(~/.claude/skills/structured-derivative-pricer/scripts/setup.sh)\n$PY -m pytest ~/.claude/skills/structured-derivative-pricer/tests -q\n```\n\n---\n\n## What it can do\n\n### 1. Build and validate pricing models\n\nGive Claude a term sheet or a product description and ask for a fair value, NPV, MTM or a pricing model. It works\nin English and Chinese (e.g. \"結構型商品評價\", \"公平價值\"). Claude reads the terms, asks about anything ambiguous\n(barrier observation frequency, who holds a call right, fixing conventions), converts your market data, and writes\nthe trade spec. The engine checks the whole spec before running, returning every error at once, then shows the\nplan (closed form or Monte Carlo, and why) before pricing.\n\n#### 1.1 Supported asset classes, models, payoffs and early termination\n\n| | Supported |\n|---|---|\n| **Asset classes** | equity (single or several correlated underlyings) · interest rates (term rates, swap rates / CMS, overnight rates such as SOFR) |\n| **Models** | `black_scholes` (constant, term or Dupire local vol) · `heston` (single asset, given or calibrated to the vol surface) · `hull_white` 1F rates (given, or calibrated to ATM swaptions: coterminal, full matrix or listed points) |\n| **Observables** | equity level or performance · term rate · CMS · overnight rate · `linear` combinations (spreads, baskets, inverse-floater formulas) · `min_of` / `max_of` (worst-of, best-of) |\n| **Payoffs (legs)** | fixed · floating (in advance, in arrears, compounded in arrears with lockout; gearing, spread, cap, floor) · range accrual (any number of ranges on any observables) · option payoff · fixed amount · `path_dependent` (a state carried between periods: snowball, memory / phoenix coupon, ratchet, cliquet, lookback, cumulative cap) · kick-in and knock-out conditions on any leg |\n| **Early termination** | knock-out (autocall) · target redemption (TARN) · Bermudan exercise (issuer call, holder put, cancellation, Bermudan option) by Longstaff-Schwartz |\n| **Closed forms** | European vanilla (BSM, Heston) · single continuous barrier (BSM) |\n\nWorked examples in [`structured-derivative-pricer/examples/`](./structured-derivative-pricer/examples/):\nvanilla call, up-and-out call, EKIAKO put (BSM and Heston), phoenix memory autocall, callable snowball,\nBermudan put, callable fixed-rate bond (given and calibrated Hull-White), cancellable swap, CMS spread range\naccrual, CMS inverse floater in arrears, dual-equity range accrual, fixed-then-range-accrual hybrid, inverse\nfloater TARN, SOFR FRN with lockout, seasoned range accrual note.\n\n#### 1.2 What a model outputs\n\nEvery price comes with what you need to trust it:\n\n- method and why (analytic or MC), price, standard error and confidence interval,\n- PV per leg, knock-in / knock-out / autocall / exercise probabilities, expected cashflows per date,\n- a cross-check against a closed form when MC ran and one applies,\n- a martingale check of the simulated forward against the curve,\n- the Bermudan in-sample vs out-of-sample gap,\n- Hull-White calibration fit and Heston calibration RMSE,\n- warnings such as vol-surface extrapolation.\n\nOn request (UAT, model review), `price.py inspect` re-prices the trade exactly (same seed, same price) and writes\nthe output of every step to disk: paths, fixings, cashflows, discount factors, exercise state and regression\ncoefficients, as CSV and JSON.\n\n### 2. Write validation reports and explain price changes\n\n`report.py evidence` runs the tests a reviewer expects (convergence, seed stability, sensitivities, stress,\nbenchmarks, limiting cases, reference prices) and collects the material. Claude then writes the report from that\nmaterial, in your template or the SR 11-7 outline in\n[`templates/sr11-7.md`](./structured-derivative-pricer/templates/sr11-7.md). Every number is copied from the\nevidence, never computed by the AI.\n\nTo explain why a price moved, the intermediate results of two runs with the same seed (for example two market\ndates) can be compared step by step, and the sensitivities and stress tests show which inputs drive the price.\n\n### 3. Price inventory trades and reuse validated models\n\nA trade can be priced at any date of its life, mid-period included. Past fixings come from a shared fixings\nfile; future ones from the simulation. A spec is written once and re-priced by changing only the valuation date\nand the market data.\n\nWhen a new trade has the same structure as one already validated, Claude starts from the validated trade file and\nchanges only its term-sheet fields (dates, notional, strike, coupon, barriers, call schedule), keeping the model,\ncalibration and pricing settings. It shows you the diff before pricing.\n\n### 4. Export the model to run without AI\n\nAfter the first price, Claude offers to export the engine into your project (`export_engine.py`). The copy\nre-prices with no AI and no skill installed: pinned package versions (`requirements.lock.txt`), recorded baseline\nprices, and `baseline.sh verify` to detect when a re-price no longer matches and why (changed inputs, edited\nfiles, library drift). Engine upgrades re-verify every baseline and archive the old version.\n\n---\n\n## Limitations\n\nNot supported yet. The skill says so instead of approximating:\n\n- more than one Bermudan exercise right in a trade (e.g. both an issuer call and a holder put),\n- American (continuous) exercise (a daily Bermudan schedule is used only if you agree),\n- equity plus stochastic-rate hybrids,\n- FX, quanto and multi-currency products,\n- past monitoring of a `continuous` barrier (closed forms only look forward from today; a daily-close barrier\n  priced by MC handles history fine),\n- custom payoff code (planned as an extension point).\n\nOther things to know:\n\n- **Market data is yours to provide.** The skill converts what you give it (CSV, pasted tables) but never invents\n  data. Mock data exists for demos and is always labelled as such in the answer.\n- **Rate optionality needs Hull-White.** Caps, floors, rate ranges and rate barriers are rejected under the equity\n  models, whose rates are deterministic.\n- **Monte Carlo prices carry error.** Check `std_error`, and raise `num_paths` when it is too large.\n- **Governance is out of scope in reports.** Approval, rating, ownership and inventory sections get only what you\n  supply.\n- **It is a model, not advice.** The output is a model value under the stated assumptions. Validate it against\n  your own controls before relying on it.\n\n---\n\n## Pricing engine: QuantLib\n\nThe skill uses [QuantLib](https://www.quantlib.org/) as its pricing engine. On top of the curves, calendars, day\ncounts, market conventions, rate indices (`Sofr`, `Euribor`, `EuriborSwapIsdaFixA`, ...), stochastic processes and\nmodel calibration, and closed-form engines that QuantLib provides, it builds a pricing wrapper layer. Through the\nfactory design pattern and a building-block workflow, a single command defines the components and chains them\ntogether.\n\n---\n\n## Disclaimer\n\nThis project is for research and educational purposes only. It is not investment, financial, legal or tax\nadvice, and nothing it produces is a recommendation to buy or sell any security or derivative. Prices, Greeks\nand validation reports it generates depend on the model, market data and assumptions supplied, and may be wrong.\nValidate them independently before relying on them for trading, risk management, accounting or regulatory\npurposes. The software is provided \"AS IS\", without warranty of any kind, as set out in the\n[Apache License, Version 2.0](./LICENSE).\n\n---\n\n## License\n\nLicensed under the [Apache License, Version 2.0](./LICENSE). See [NOTICE](./NOTICE) for attribution. QuantLib\nis a separate dependency under its own modified BSD license.\n"}