Introduction
QuantSupport is a Rust library for building market data, pricing derivatives, measuring risk with automatic differentiation, simulating exposure, and computing XVA.
Everything is organised around one flow:
- Load observable quotes, fixings, and FX rates into
QuoteStore,FixingStore, andFxStore. - Describe curves, credit curves, volatility surfaces/cubes, and simulations with serialisable configuration structs (
CurveConfiguration,CreditCurveConfiguration,VolatilitySurfaceConfiguration,VolatilityCubeConfiguration,SimulationConfiguration). - Put them into a
PricingContextand callinitialize(), which bootstraps and builds every object in dependency order. - Build an instrument with a
Make*builder and wrap it in a trade (SwapTrade,FxForwardTrade, …) that carries notional and side. - Ask a pricer (
DiscountedCashflowPricer,ClosedFormBlackCapPricer,FxOptionPricer, …) forRequest::Value,FairRate,Cashflows, orSensitivities. - Reuse the same market for scenarios (
Scenario), scripted payoffs (ScriptEngine), simulation (LgmMarketModel,HullWhite), and XVA (XvaEngine).
To allow sensitivity computations via automatic differentiation (AAD), generic scalar parameter T: Scalar is available in curves, instruments and pricers. With T = f64 you get plain numbers; with T = DualFwd (reverse-mode tape over a second-order forward type) every price is differentiable with respect to the quotes that built the market.
Crate layout
| Module | Contents |
|---|---|
ad | Tape, Dual<T>, Fwd<T>, DualFwd and the Scalar trait |
core | PricingContext, ConstructedElementStore, Request, EvaluationResults, Trade, Side, Pricer, Evaluator, discount policies |
currencies, indices | Currency and MarketIndex enums |
quotes | Quote, QuoteDetails, QuoteInstrument, QuoteStore, Scenario, FixingStore, FxStore |
rates | DiscountTermStructure, FlatForwardTermStructure, RateDefinition, MultiCurveBootstrapper, CreditCurveBootstrapper, curve configurations |
volatility | Surfaces, cubes, VolatilityType, SmileType, Strike, volatility sources |
instruments | Instruments and Make* builders |
pricers | Concrete pricers |
models | HullWhite, LGM components and LgmMarketModel, Brownian motion, Monte Carlo engine |
simulations | SimulationConfiguration, SimulationBuilder, GeneratedMonteCarloSimulation |
scripting | Payoff language, ScriptEngine, ScriptedProduct |
xva | Contingent claims, netting sets, CSA, XvaEngine, aggregators |
time, math, utils | Date, Period, Calendar, schedules, interpolation, solvers, errors |
quantsupport::prelude::* re-exports the types used in this book.
What the book covers
- Getting Started installs the crate and prices a first swap in Rust and Python.
- Core Concepts explains the market-data model,
PricingContext::initialize, and how instruments, trades, pricers and results relate. - Curves and Market Data covers term structures, multi-curve bootstrapping with dependencies, FX-implied collateral curves, and volatility objects.
- Pricing documents each pricer: which
Requests it supports, the formulas it implements, and the builder fields it needs. - Risk describes the AD machinery, quote-pillar sensitivities, and scenario shocks.
- Scripting documents the payoff language, event streams,
ScriptEngine, and scripted products in XVA. - Models and Simulation covers Hull-White and LGM calibration and Monte Carlo generation.
- XVA covers contingent-claim decomposition, netting sets and CSA terms, CVA/DVA/FVA, and AAD sensitivities of XVA measures.
- Reference lists the JSON schemas, the runnable examples, and a glossary.
Rust snippets marked rust,ignore are extracted from the library and the examples/ packages but are not compiled as doctests; the full programs are listed in Examples.
Continue with Installation.