Package com.quantfinlib.fx
package com.quantfinlib.fx
FX-specific market machinery — spot conventions through NDFs:
CurrencyPair (pip/precision tables, T+1/T+2
spot lags, dual-calendar tenor dates with modified-following and end-end),
SwapPointsCurve (quoted forward points →
outrights, broken dates linear in days, covered-interest-parity carry),
FxSwap (near/far legs, points MTM, roll cost),
Ndf (fixing vs settlement lags per restricted
currency, USD-settled difference amounts),
FxVolSurface (delta-quoted smiles — ATM DNS,
RR/BF wings, premium-adjusted delta↔strike solving),
FixingRisk (WM/R-window TWAP/VWAP tracking
error and participation), and the hot-path pieces:
AggregatedBook (zero-alloc multi-venue BBO
with venue attribution), CrossRateEngine
(streaming synthetic crosses chained on the bus consumer thread),
FxTierBook (per-LP size-tier ladders:
sweep cost and full-amount quotes), LpScorecard
(streaming last-look analytics: reject rate, hold, post-reject markout),
LpRouter (expected-all-in routing that prices
rejects into the decision) and SyntheticCross
(direct-vs-legs execution arithmetic with spread composition).-
ClassDescriptionMulti-venue aggregated top-of-book — the core e-FX data structure: each liquidity provider / ECN streams its own two-sided quote, and the aggregator maintains the composite best bid/offer with venue attribution.Streaming cross-rate derivation on the HFT tick path: maintains synthetic crosses (EURJPY from EURUSD × USDJPY, EURGBP from EURUSD ÷ GBPUSD) live from their leg ticks, with zero allocation per tick.How the two leg prices compose into the cross.Market conventions for an FX currency pair: quotation precision, pip size, spot lag, and settlement-date arithmetic against both currencies' holiday calendars.Analytics for benchmark-fixing exposure — the risk concentrated in the short calculation window of an official fix (WM/R 4pm London, the RBI reference rate an NDF settles on, an equity closing auction).An FX swap: two offsetting FX exchanges — buy (sell) base currency on the near date, sell (buy) it back on the far date — the instrument behind funding, position rolls, and most of the daily FX forward volume.Tiered multi-LP FX book: the depth structure e-FX actually has.FX-style volatility surface built from the market's delta-quoted smile: ATM (delta-neutral straddle), 25-delta risk reversal and butterfly, optionally 10-delta wings.Accumulates per-expiry delta quotes, then solves strikes once in
FxVolSurface.Builder.build().One expiry's solved smile: absolute strikes and vols, low to high strike.Last-look-aware LP router: chooses where to send an FX clip by expected all-in price, not displayed price.Streaming per-LP execution quality: the taker-side answer to last look.A non-deliverable forward: the FX forward for restricted currencies (INR, KRW, TWD, BRL, CNY, ...) where the local currency never moves.FX forward (swap-points) curve: the market's quoted forward points per tenor, turned into outright forwards for any settlement date.Accumulates tenor/points quotes, then freezes them into a curve.Direct-versus-synthetic cross execution arithmetic: an FX cross (EURJPY) can be dealt directly or replicated through its liquid legs (buy EURUSD, buy USDJPY), and the cheaper route changes with every quote — direct cross books are thin outside London hours while the USD legs stay tight.