Case study 03, 2026

Corridor FX

An operational intelligence command center for a US to Nepal remittance operator. It quantifies the FX exposure from a "Send Now, Convert Later" feature, sizes recoverable margin across the book, and forecasts a 15-day move band on USD/NPR. NPR is pegged to INR at 1.6, so the corridor risk factor is really USD/INR expressed through the peg.

Role
Solo. Engine, dashboard, and models.
Stack
Python, FastAPI, XGBoost, Vite, React, TypeScript, recharts
Corridor
USD/NPR proxy from public INR per USD daily observations
Demo
Run the forecast and hedge demo
Code
Private. Walkthrough on request.

01

The problem

A remittance operator that lets customers send now and convert later carries open FX exposure until each position settles. The treasury desk needs to know how large that book is, what a 95% VaR looks like at the position's horizon, and whether a hedge clears an editable risk tolerance after hedge cost.

Separately, margin leaks in three places: unhedged Convert Later risk net of hedge cost, idle Nostro balances sitting below the NRB deposit rate, and customer markup that could move by a basis point. The operator needs those buckets sized in one place, not spread across spreadsheets.

USD/NPR on a managed peg is not a directional bet. Risk is basis points per cycle. The product value is VaR, hedging, and idle-capital opportunity cost, not pretending to call the next move.

02

How it's built

FastAPI serves a Python engine split into four modules: data.py, exposure.py, margin.py, and forecast.py. A Vite + React + TypeScript dashboard reads the API and charts the series with recharts.

  1. Positions in. The engine ingests a Convert Later book and computes aggregate exposure, horizon-scaled 95% VaR, a maturity ladder, per-position risk, and a hedge recommendation (notional, cost, residual VaR) against an editable tolerance.
  2. Margin out. Three buckets: unhedged Convert Later risk net of hedge cost, idle Nostro opportunity cost at the NRB deposit rate, and customer-markup yield with per-basis-point sensitivity.
  3. Forecast band. An XGBoost quantile model outputs p05, p50, and p95 for the 15-day move percentage, with an out-of-sample coverage check against a 0.90 target.
  4. API surface. /api/overview, /api/series, /api/positions, /api/exposure, and /api/margin expose the same logic the UI uses.

Risk statistics are empirical from NRB USD/NPR daily rates. The sample position book is synthetic, seeded to simulate a Dashain-season surge so hedge logic is demonstrable without a live feed.

03

What I chose not to oversell

Honesty as a design constraint.

Direction model

Held-out quantile loss beats a random-walk baseline

I built a classifier for whether waiting beats converting today over a 15-day horizon. It was roughly a coin flip on a managed peg, so the demo does not use it as a hedge signal.

The quantile model is the one hedging actually needs. It forecasts the range, not the sign. On its held-out window, the 14-day p10-p90 interval covers 0.72 of outcomes. Its mean pinball loss is 0.32172 versus 0.54243 for a random-walk baseline.

Data engineering

Monthly remittance from press reports, not blocked PDFs

NRB publishes cumulative fiscal-year-to-date remittance totals in monthly macro reports. Nepali financial press repeats those totals and often states the single most recent month. NRB blocks server-side PDF downloads with 403, so I reconstructed monthly inflows by differencing consecutive cumulative figures from press coverage and cross-checking that monthly sums match the next cumulative total.

A separate Prophet forecaster on 58 monthly points treats 9 rows flagged as interpolated guesses as a sensitivity check: fit with them, refit without them, and compare. If the forecasts diverge, trust the headline less.

04, Numbers

Measured on NRB data.

13,263

public daily training observations before 2026-01-01

0.322

14-day mean pinball loss on the held-out window

0.72

14-day p10-p90 interval coverage on the held-out window

0.542

14-day random-walk baseline mean pinball loss

05

Limits, stated plainly

  • The position book is synthetic until a live Convert Later feed replaces it. Exposure and VaR numbers scale from that placeholder book today.
  • Annual volume ($100M), Convert Later share (15%), idle Nostro ($5M), and similar inputs are editable placeholders in the UI, not confirmed operator figures.
  • NRB rate refresh is a manual browser export today. A licensed feed or daily export workflow is needed to keep risk stats current.
  • Quantile coverage at 0.87 misses the 0.90 target. I would not size hedges off the band alone without monitoring drift.
Next case study Quint →