Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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:

  1. Load observable quotes, fixings, and FX rates into QuoteStore, FixingStore, and FxStore.
  2. Describe curves, credit curves, volatility surfaces/cubes, and simulations with serialisable configuration structs (CurveConfiguration, CreditCurveConfiguration, VolatilitySurfaceConfiguration, VolatilityCubeConfiguration, SimulationConfiguration).
  3. Put them into a PricingContext and call initialize(), which bootstraps and builds every object in dependency order.
  4. Build an instrument with a Make* builder and wrap it in a trade (SwapTrade, FxForwardTrade, …) that carries notional and side.
  5. Ask a pricer (DiscountedCashflowPricer, ClosedFormBlackCapPricer, FxOptionPricer, …) for Request::Value, FairRate, Cashflows, or Sensitivities.
  6. 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

ModuleContents
adTape, Dual<T>, Fwd<T>, DualFwd and the Scalar trait
corePricingContext, ConstructedElementStore, Request, EvaluationResults, Trade, Side, Pricer, Evaluator, discount policies
currencies, indicesCurrency and MarketIndex enums
quotesQuote, QuoteDetails, QuoteInstrument, QuoteStore, Scenario, FixingStore, FxStore
ratesDiscountTermStructure, FlatForwardTermStructure, RateDefinition, MultiCurveBootstrapper, CreditCurveBootstrapper, curve configurations
volatilitySurfaces, cubes, VolatilityType, SmileType, Strike, volatility sources
instrumentsInstruments and Make* builders
pricersConcrete pricers
modelsHullWhite, LGM components and LgmMarketModel, Brownian motion, Monte Carlo engine
simulationsSimulationConfiguration, SimulationBuilder, GeneratedMonteCarloSimulation
scriptingPayoff language, ScriptEngine, ScriptedProduct
xvaContingent claims, netting sets, CSA, XvaEngine, aggregators
time, math, utilsDate, 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.