Problem statement
Design the service that quotes and executes foreign-exchange conversions for a multi-currency wallet. It ingests rates from several market data providers, serves a firm quote for a requested currency pair and amount, and — if the user accepts — executes the conversion by posting the debit and credit legs to the ledger at the quoted rate. The delicate part is honoring a quote: the rate a user saw must be the rate they get, even as the market moves underneath.
Operating context. Rates update sub-second and differ across providers; the service applies a spread/margin and serves quotes that are firm for a short hold window. Execution must be atomic across two currencies and must never apply a stale or manipulated rate. Assume 200 currency pairs, 15000 quote requests/sec at peak, execution volume far lower, and a duty to prove exactly which rate and timestamp priced any historical conversion.
Out of scope. Hedging and treasury/position management, the market-data providers' internals, the ledger's internal correctness, and the wallet UI. Assume separate teams own treasury, the rate providers, the ledger, and the app.
What to produce. A high-level architecture covering: ingesting and blending multiple rate feeds into a canonical priced rate, the low-latency quote path with spread applied, making a quote firm for its hold window and honoring it at execution, atomic two-currency execution against the ledger, rejecting stale/out-of-band rates, an auditable record of the rate that priced each conversion, and scaling quotes to tens of thousands per second. Sketch the components and request flow; we will probe specifics in checkpoints.
Functional requirements
- Ingest rate feeds from multiple providers and derive a canonical mid rate per currency pair with staleness and outlier filtering.
- Serve a firm quote for a requested pair and amount with the applicable spread applied, valid for a bounded hold window.
- Execute an accepted quote atomically, posting the source-currency debit and target-currency credit to the ledger at the quoted rate.
- Honor the quoted rate for the full hold window and reject execution of an expired or tampered quote.
- Record, for every conversion, the exact rate, provider, spread, and timestamp used to price it.
Non-functional requirements
- Serve 15000 quote requests/sec at peak across 200 currency pairs.
- Quote path p99 < 30 ms; rate freshness such that served rates are no more than 1 second stale.
- 99.99% availability for quotes; execution fails safe and never applies an unpriced or stale rate.
- Executions are exact-decimal and atomic across two currencies — no single-sided or double-applied conversion.
- Retain every quote and execution with its pricing inputs for 7 years, fully reproducible for audit.
- A provider feed outage or an outlier tick must not produce a mispriced quote.
Topics
- System Design HLD
- Fintech Fx
- Data Streaming
- Scaling Low-Latency
- Data Consistency