Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pricing & Library Quant Agents

Product-area-specific pricing quant specialists with automatic routing.

Architecture

pricing_quant_agents/
├── core/
│   ├── base_system_prompt.md          # Shared foundations (all agents inherit)
│   └── pricing_quant_agent.py         # Agent module with routing
├── product_area/
│   ├── rates_derivatives.md           # IR: HW, LMM, SABR, Bermudans, CMS, curve construction
│   ├── equity_derivatives.md          # EQ: Heston, LSV, barriers, autocallables, cliquets, rough vol
│   ├── fx_derivatives.md              # FX: vol surface, vanna-volga, TARFs, multi-factor FX-rates
│   ├── credit_derivatives.md          # CR: CDS, Gaussian copula, tranches, structural models
│   ├── commodity_derivatives.md       # COM: storage, swings, power spikes, Schwartz, seasonality
│   └── xva.md                         # XVA: CVA/FVA/MVA/KVA, exposure modelling, wrong-way risk
├── CLAUDE.md                          # Claude Code instructions
├── AGENTS.md                          # Cross-tool standard (Cursor, OpenCode, Copilot, Codex)
├── .github/copilot-instructions.md    # GitHub Copilot
└── README.md

Why Split by Product Area (not Asset Class)

Pricing quants are organised by product complexity and model type, not just the underlying asset. A rates flow quant (swaps, FRAs) and a rates exotics quant (Bermudans, TARFs, PRDCs) use fundamentally different models and numerical methods. The split reflects this:

Product Area Core Models Key Numerical Methods
Rates Hull-White, LMM/BGM, SABR, G2++ Trees, PDE (ADI), MC with drift approximation
Equity Heston, Local Vol, LSV, Bates, rBergomi MC (QE scheme), PDE, LSMC, Fourier (COS)
FX Garman-Kohlhagen, SABR, Vanna-Volga, 3-factor MC, PDE, Brownian bridge for barriers
Credit Hazard rate, Gaussian copula, Merton, CIR++ Recursion/FFT for loss distributions, MC
Commodities Schwartz 2-factor, HJM commodity, jump-MR Dynamic programming, LSMC for real options
XVA Hybrid multi-factor, AMC, regression surrogates Nested MC, AAD for Greeks, GPU acceleration

Quick Start

pip install anthropic
export ANTHROPIC_API_KEY=sk-ant-...

python core/pricing_quant_agent.py            # auto-routing
python core/pricing_quant_agent.py rates      # fixed
python core/pricing_quant_agent.py xva        # fixed

Usage in Code

from core.pricing_quant_agent import PricingQuantAgent, ProductArea

# Auto-route
agent = PricingQuantAgent()
agent.ask("How do I calibrate a local-stochastic vol model for autocallables?")
print(agent.active_product_area)  # ProductArea.EQUITY

# Fixed
agent = PricingQuantAgent(product_area=ProductArea.RATES)
agent.ask("Derive the CMS convexity adjustment using swaption smile replication")

# Router for multi-agent systems
from core.pricing_quant_agent import PricingQuantRouter
router = PricingQuantRouter()
router.ask("What's the right model for a gas storage option?")  # -> COMMODITIES
router.ask("Explain wrong-way risk modelling for CVA")          # -> XVA

AI Coding Tool Support

Tool Primary File Also Reads
Claude Code CLAUDE.md
Cursor AGENTS.md .cursor/rules/*.mdc
OpenCode AGENTS.md CLAUDE.md (fallback)
GitHub Copilot .github/copilot-instructions.md AGENTS.md
OpenAI Codex AGENTS.md

Clone and open — all tools pick up context automatically.

Integration

As an MCP Tool

from mcp.server.fastmcp import FastMCP
from core.pricing_quant_agent import PricingQuantRouter

mcp = FastMCP("pricing-quant")
router = PricingQuantRouter()

@mcp.tool()
def ask_pricing_quant(question: str, product_area: str = "auto") -> str:
    """Ask the pricing quant. product_area: rates|equity|fx|credit|commodities|xva|auto"""
    if product_area == "auto":
        return router.ask(question)
    from core.pricing_quant_agent import ProductArea
    return router.ask_specific(question, ProductArea(product_area))

Customisation

Edit the overlays to add:

  • Your bank's specific model choices ("we use Heston for vanilla, LSV for exotics")
  • Internal library names ("our MC engine is QuantLib-based, called PRISM")
  • Calibration conventions ("SABR β = 0.5 for rates, β = 1 for FX")
  • Production constraints ("Greeks must be computed via AAD, not bump-and-reprice")

About

Specialist agents pricing and library quants

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages