Package com.quantfinlib.pricing
package com.quantfinlib.pricing
Fair value and derivatives pricing:
BlackScholes (Greeks with continuous
carry — equities and Garman-Kohlhagen FX — plus implied vol),
BinomialTree (CRR American/European),
VolSurface (pillar smiles, total-variance
term interpolation), SabrModel (Hagan 2002
+ calibration), FairValueEngine
(microprice and latency-adjusted true mid),
TriangularArbitrage (executable FX
round-trip edge), ForwardCurve
(FX forwards with covered-interest-parity checks), the exotics
(DigitalOption,
TouchOption,
BarrierOption,
VannaVolga) and
Autocallable (the flagship equity
structured product: memory coupons, autocall observations, European
knock-in — Monte Carlo with antithetic variates under documented GBM
simplifications; RFQ market structure for trading it lives in
rfq). Market-risk pricing models
(docs/MARKET_RISK.md step 4):
Black76 (options on forwards/futures
— the convention caps, swaptions and futures options are quoted in),
Heston (stochastic volatility,
semi-analytic little-trap form, MC cross-checked) and
HigherOrderGreeks (vanna, volga,
exchange-option cross-gamma — pinned as finite differences of the
first-order Greeks).-
ClassDescriptionASIAN (average-price) options — the corporate hedger's option: paying off on the AVERAGE of n fixings instead of one closing print kills both the expiry-day manipulation incentive and most of the vol (an average is smoother than its endpoints), which is why commodity and FX hedging programs default to them.Autocallable note pricer — the flagship equity structured product: a note that pays a fat coupon and redeems early ("autocalls") the first observation date the underlier closes at or above the autocall barrier.Single-barrier vanilla options — continuously monitored knock-in / knock-out — for the regular barrier configurations, priced in closed form by the reflection principle (Reiner–Rubinstein, as in Hull): Down barriers on calls with
H ≤ K(barrier in the OTM region): down-and-in from the reflection formula, down-and-out from in–out parityKO = vanilla − KI; Up barriers on puts withH ≥ K, the mirror case.Cox-Ross-Rubinstein binomial tree for European and American options with a continuous carry yield (dividends / foreign rate).Black-76 — the Black-Scholes sibling for options on FORWARDS and futures: rates caps/floors and swaptions, commodity futures options, bond futures options.Black-Scholes-Merton option pricing and Greeks with a continuous carry yieldq: setqto the dividend yield for equities or the foreign interest rate for FX (Garman-Kohlhagen).Full Greek set for one option.European digital (binary) options under Black-Scholes — the building blocks of the first-generation FX exotics book.Discrete (cash) dividends for equity derivatives — the forward-looking counterpart todata.CorporateActions' historical back-adjustment.TWO-ASSET closed forms: Margrabe's exchange option and Kirk's spread approximation — the workhorse formulas for relative-value option books (crack spreads, calendar spreads, stock-vs-index switches).Latency-adjusted fair value for rapidly updating order books.Implied FX forward curve construction from market outright forwards, with interpolation, implied rate differentials, and covered-interest-parity arbitrage checks against deposit rates.Heston (1993) stochastic-volatility pricing — the canonical answer to Black-Scholes' one visible lie, the flat smile.Model parameters.The second-order Greeks a vol book actually hedges with — analytic Black-Scholes forms, the risk-side complement toBlackScholes.greeks(com.quantfinlib.pricing.BlackScholes.OptionType, double, double, double, double, double, double): Vanna∂²V/∂S∂σ— how delta drifts when vol moves (equivalently, how vega drifts when spot moves).Tick-frequency Greek estimation without tick-frequency repricing: a full Black-Scholes evaluation anchors the position, and every tick updates price/delta by the delta-gamma Taylor expansion — a handful of multiplies, zero allocation — while the anchor is refreshed off the hot path.QUANTO adjustment — for payoffs on a foreign asset settled in domestic currency at a FIXED conversion rate (a Nikkei option paying in USD at 1:1).SABR stochastic volatility model: Hagan et al. (2002) lognormal implied volatility approximation and smile calibration.Calibrated SABR parameters and the fit's RMSE in vol points.STRUCTURED NOTES — the retail shelf, priced the only honest way: by DECOMPOSITION into the vanilla pieces this library already prices.One-touch and no-touch options (pay-at-expiry) under continuously monitored geometric Brownian motion — with the barrier-hitting probability itself exposed, since desks quote one-touches as (roughly) discounted hit probabilities.Triangular arbitrage checks over three related FX pairs, using dealable bid/ask quotes (not mids), so a positive result is executable edge before fees.Vanna-volga pricing: the FX desk's standard smile-consistent adjustment built from exactly three market pillars (in practice the 25Δ put, ATM and 25Δ call thatfx.FxVolSurfacesolves from broker RR/BF quotes).VARIANCE SWAP analytics — the cleanest pure-volatility trade there is: at expiry the swap paysnotional × (realized variance − strike), no delta, no path-dependent barriers, no vega decay games.Implied volatility surface built from (expiry, strike, vol) pillar quotes — or directly from market option prices via implied-vol inversion.