Skip to content

Rates and FX Desk Analytics ​

Personal build with AI coding agents · Python, QuantLib, Excel VBA · November 2026

A trading desk's support team answers the same questions every morning: what is the risk, did yesterday's risk explain today's P&L, and did the fixings come through correctly. This project runs those checks on a synthetic 26-trade book of SONIA and SOFR swaps, swaptions, cross-currency swaps and GBP/USD forwards and options, valued on real Bank of England, New York Fed and ECB data. Over 38 business days, the prior close's risk predicted all but 2.8% of the daily P&L, and each of the 68 trade-days that missed by more than 1,000 USD was traced to one of four measured causes.

The trades, trade dates and volatilities are synthetic; the curves, fixings, compounded indices and FX spot are public data. The USD curve is the US Treasury par curve, used as a proxy for SOFR swap rates. Code, tests and reports: github.com/clearsmog/rates-fx-desk-analytics.

Snapshot ​

38
Business days replayed
20 Aug – 15 Oct 2026 · real rate and FX moves
2.8%
Daily P&L left unexplained by risk
69,224 of 2,493,124 USD, absolute sums
68
Trade-days over the threshold
each traced to a measured cause · at most 205 USD left
14/14
Accrual periods matching the published index
compounded SONIA and SOFR within 0.001bp

The risk, read in hedge instruments ​

The delta ladder raises each par swap quote on the curve by 1bp in turn, bootstraps the curve again and revalues the book. The result reads in the instruments a desk would hedge with. As a check, the buckets add up to all quotes moved together within 3 USD per bp.

GBP · 15 Oct 2026

GBP delta by par quote

USD thousands per +1bp on each SONIA swap quote. Little changed on the day: the book's GBP risk sits at 2 to 5 years and 10 years.

15 Oct 2026 vs prior close · Source: Bank of England OIS curve; own calculation
USD · 15 Oct 2026

USD delta by par quote

Two swaps booked on the day moved the 2-year bucket by −6.4k and the 7-year bucket by +11.9k. Almost all of the day's change in the ladder is those two trades.

15 Oct 2026 vs prior close · Source: US Treasury par curve (SOFR proxy); own calculation

Vega is reported per trade for a parallel move in the volatility input and grouped by expiry and underlying tenor: nine live options on 15 October. The volatilities themselves are synthetic.

One day's P&L, explained from the prior close ​

On 15 October GBP swap quotes fell by up to 5bp, USD by up to 9bp, and GBP/USD fell 0.15%. The predicted column multiplies the prior close's ladder by the move in each quote, and the FX delta by the move in spot. The revalued column reprices every trade.

Line (USD)Predicted from riskRevaluedUnexplained
Carry (revalued)-3,319-3,3190
GBP rates-70,008-69,816192
USD rates82,96084,5831,623
FX spot-31,573-31,379194
Vols (synthetic, static)000
New trades, day-one value-107,204-107,2040
Total-129,143-127,1352,009

Every swap, forward and cross-currency swap was explained to within 1,000 USD. Two USD swaptions were not (+4,768 and −3,653). Applying all the quote moves together, instead of one at a time, shows that rate convexity is 98% and 99.8% of those two amounts: a first-order ladder cannot see an option's delta changing as rates move.

The same check over 38 business days ​

Replay · 38 days

Predicted against revalued daily P&L

One point per day, USD thousands, existing book. Points on the diagonal are days the prior close's risk explained in full; shading is the size of the miss.

20 Aug – 15 Oct 2026 · Source: Bank of England, US Treasury, ECB; own calculation
Replay · 38 days

Daily unexplained P&L

USD thousands, whole book. The largest miss, 6.5k on 23 September, came on the largest move of the window: GBP 5-year +15bp, USD 5-year +16bp, GBP/USD −0.7%.

20 Aug – 15 Oct 2026 · Source: Own calculation

The window was chosen because no coupon, delivery or expiry falls in it, so no cash leaves the book. A new trade's day-one value is left out of both columns: it is mostly premium, and the model does not carry premium cash.

Where the misses came from ​

A trade-day is flagged when its unexplained P&L exceeds 1,000 USD. Each flagged amount is then split into four causes that can be measured by repricing, and whatever is left is reported.

68 flagged trade-days

What the flagged amounts were made of

Sum of absolute amounts, USD thousands. After the four measured causes, 0.3k is left in total, and no single trade-day keeps more than 205 USD.

20 Aug – 15 Oct 2026 · Source: Own calculation
ProductMain causeTrade-daysLargest unexplained (USD)
SwaptionsRate convexity368,477
FX optionsFX gamma253,388
OIS swapsRate convexity32,939
OIS swapsRates-FX cross32,911
FX forwardCurve basis11,071

Options missing a first-order explain is expected. Two findings were not:

  • Two plain GBP swaps breached the threshold on three days. On the days GBP rates moved 12 to 17bp, the swap's own convexity was about half of the miss. The other half is a cross term: the swap's P&L is in GBP and reported in USD, and the day's GBP P&L translated at the new spot sits in neither the rates ladder nor the FX delta.
  • One FX forward breached it on a Monday. Yesterday's curve rolled over a weekend is not exactly the curve that its own par quotes rebuild at the standard tenors. The 1,071 USD on a four-month forward is that difference and nothing else: a model artefact, not a market effect.

Fixings against the published indices ​

A compounded overnight coupon is only as good as the daily fixings behind it. For each accrual period that last settled, is accruing, or pays within five business days, the compounded rate from the daily fixings is set beside the rate implied by the Bank of England's SONIA Compounded Index and the New York Fed's SOFR Index.

TradeIndexPeriodStatusCompounded (%)From index (%)Difference (bp)
IRS-001SONIA2025-03-17 → 2026-03-17last settled4.1228584.1228580.000000
IRS-001SONIA2026-03-17 → 2027-03-17accruing3.7706373.7706370.000001
IRS-002SONIA2026-01-15 → 2027-01-15accruing3.7817493.7817490.000001
IRS-007SOFR2025-06-02 → 2026-06-02last settled4.0361004.0360980.000250
IRS-007SOFR2026-06-02 → 2027-06-02accruing3.7061743.7061730.000133
IRS-010SOFR2026-02-17 → 2027-02-17accruing3.7042143.7042080.000563
XCY-001SONIA2026-05-19 → 2026-08-19last settled3.7476913.747691-0.000001
XCY-001SONIA2026-08-19 → 2026-11-19accruing3.7415523.7415520.000002
XCY-001SOFR2026-05-19 → 2026-08-19last settled3.6348863.634886-0.000009
XCY-001SOFR2026-08-19 → 2026-11-19accruing3.7683383.7683350.000292
XCY-002SONIA2026-04-20 → 2026-07-20last settled3.7470433.7470430.000002
XCY-002SONIA2026-07-20 → 2026-10-20pays within horizon3.7473723.7473720.000000
XCY-002SOFR2026-04-20 → 2026-07-20last settled3.6278093.627811-0.000124
XCY-002SOFR2026-07-20 → 2026-10-20pays within horizon3.7318673.7318650.000241

All 14 periods agree within 0.001bp. Two of the SOFR periods span Good Friday, when no rate is published and the previous day's rate is carried.

Valuation and price challenge ​

The same curves and pricers drive a second run, modelled on a third-party valuation service: every trade is valued twice (own pricers and an independent QuantLib rebuild, which agree to under 1 USD on swaps and swaptions), then compared with synthetic dealer marks. Of 26 marks, 15 carry a planted break and 11 are clean; the attribution finds all 15 and clears the 11. An Excel VBA macro builds the exception log, ranked by size against tolerance. The answer key is self-generated, so this tests the logic, not real-world accuracy.

Method ​

  • Curves: par OIS quotes, sequential bootstrap, log-linear discount factors; one curve per currency for projection and discounting.
  • Pricers: OIS with realised compounding for the current period; Bachelier swaptions; cross-currency swaps with notional exchanges; FX forwards by covered interest parity; Garman-Kohlhagen FX options off a vanna-volga smile.
  • Delta ladder: each par quote +1bp, curve bootstrapped again, book revalued.
  • Daily explain: the risk is measured on the prior close's curves rolled one day, so roll-down sits in carry and the quote moves are the market's own.
  • Measured causes: rate convexity (all quote moves together, less the linear sum); FX gamma (the spot move alone, less the delta term); rates-FX cross (the rest of the revalued spot step); curve basis (rolled curve against its re-bootstrap).

Honest boundaries ​

  • A personal build on a synthetic book: no desk used it, and the P&L figures show the method, not a trading record.
  • The volatilities are synthetic and static, so the vega line of the explain is zero by construction. Vega is a parallel move of the vol input, not per grid node.
  • The USD curve is a Treasury proxy, so USD values are illustrative. There is no cross-currency basis curve.
  • Fixings use a zero-day lookback; SONIA swaps commonly use five days. Cash leaving the book is flagged, not modelled.
  • "Fixings check" means the overnight fixings that set each coupon. Repos, collateral bonds and reset-risk compression runs are not modelled.

Stack ​

Python · pandas · NumPy · SciPy · QuantLib (reference valuation only) · openpyxl · Excel VBA · pytest (35 tests) · uv

Competencies ​

Interest-rate and FX derivatives valuation · delta and vega risk reporting · daily P&L explain and investigation of unexplained amounts · overnight-index compounding and fixings · price challenge against counterparty marks · process automation in Python and VBA


← All projects