Every amount the library computes is money in a currency. This chapter defines how a currency is identified and rounded for display, how amounts are signed and combined, how FX rates convert amounts between currencies, how a valuation finds the curves, FX rates and fixings it needs, how an FX quote such as a spot rate is brought to today, and how the currency exposure of a value is reported as FX positions. Curves are defined in Chapter 7 and OIS pricing in Chapter 6.
8.1 Notation
| Symbol | Meaning |
|---|---|
| \(c\), \(c'\) | Currencies, identified by ISO 4217 codes (USD, SAR, KWD) |
| \(m_c\) | The number of decimals (ISO 4217 minor units) of currency \(c\) |
| \((a, c)\) | An amount \(a\) in currency \(c\) |
| \(X_{b/q}\) | The FX rate of the pair \(b/q\): units of \(q\) per unit of \(b\) |
| \(u\) | The pivot currency for crosses, USD by default |
| \(N\) | A signed notional |
| \(v\) | The valuation date |
| \(s\) | The spot date of a pair, or more generally the date an FX quote settles |
| \(S\) | An FX quote that settles on \(s\), usually the spot rate |
| \(X_0\) | Today's rate: the rate for exchange on \(v\) |
| \(P_c(d)\) | The discount factor to date \(d\) of currency \(c\), under the collateral currency of the pair (USD by default) |
| \(V_c\) | The value of a trade or portfolio in currency \(c\) |
| \(Q_c\) | The FX position in currency \(c\) |
8.2 Currencies and decimals
A currency is identified by its three-letter ISO 4217 code. Each currency has a number of decimals \(m_c\) (ISO 4217 minor units), which in the Gulf are not all equal:
| Currencies | Decimals |
|---|---|
| SAR, AED, QAR, USD, EUR, GBP | 2 |
| KWD, BHD, OMR | 3 |
| JPY, KRW | 0 |
The decimals are used only to display amounts and to round settlement amounts. They are never used inside a valuation: every computation keeps full precision. The library knows the decimals of the common currencies; any other code must be given its decimals explicitly, and a known code cannot be given other decimals.
8.3 Amounts and signs
An amount \((a, c)\) is a number \(a\) in currency \(c\), signed from the point of view of the holder:
- cash received or receivable is positive;
- cash paid or payable is negative.
Amounts in the same currency add, subtract, negate and scale: \((a, c) + (a', c) = (a + a', c)\) and \(k\,(a, c) = (k a, c)\). Adding amounts in different currencies is an error: they must first be converted (Section 8.6) or kept side by side (Section 8.4). An amount is generic over the number type (Section 5.2), so it keeps its currency through an AAD recording.
Signed notionals. A trade's direction is the sign of its notional: for a fixed-for-floating swap, a negative notional pays fixed and receives floating, a positive notional receives fixed and pays floating. The value of the fixed leg is then \(N K \mathcal{A}\) and that of the floating leg \(-N F\), with no pay/receive flag (Equation (6.6)).
8.4 Amounts in several currencies
A multi-currency amount holds at most one amount per currency, for example the value of a cross-currency trade before conversion. Adding an amount adds it to the amount in the same currency, or adds a new currency; nothing is converted implicitly. Amounts are kept in currency code order, and a currency with no amount reads as zero.
8.5 FX rates
An FX rate \(X_{b/q}\) is the number of units of the counter currency \(q\) that one unit of the base currency \(b\) buys: USD/SAR 3.75 means one US dollar buys 3.75 riyals. Rates are quoted in market order (EUR/USD, USD/SAR, USD/KWD) and must be positive. The other direction is the inverse:
A set of rates gives each pair at most once, in either direction. Any rate between two currencies \(c\) and \(c'\) is found, in this order: 1 when \(c = c'\); a given rate or its inverse; otherwise the cross through the pivot \(u\) (USD by default):
where each factor is itself a given rate or an inverse. When none of these exists, the conversion is an error; a missing rate is never taken as 1.
Today's rate and spot rate. The rates that convert present values are today's rates: the exchange of value on the valuation date. The market quotes a spot rate, which settles on the spot date, usually two business days later; the two differ by the interest of both currencies until the spot date. A market context takes the quotes and brings each to today (Section 8.8).
8.6 Conversion
An amount is converted to currency \(c'\) by multiplying by the rate:
and a multi-currency amount is converted by converting each amount and adding:
Each leg of a trade is valued in its own currency; conversion to a reporting currency is a separate, explicit, final step.
FX delta. Rates are generic over the number type, so recording them on an AAD tape gives the sensitivity of a converted value to each FX rate in the same sweep as the curve sensitivities.
8.7 Market context
A market context holds everything a valuation reads from the market on one valuation date, found by its role:
- the discount curves of each currency: its default curve and its CSA curves, one per collateral currency (Section 11.2);
- the projection curve of each index, overnight or term-rate, found by its
IndexId(for single-curve USD SOFR, the same curve as the USD discount curve); - the FX quotes, usually spot rates, and today's rates derived from them (Section 8.8);
- the published fixings of each index.
Every curve in a context has the context's valuation date. A missing curve or missing FX rates are errors naming what is missing; an index with no fixings simply has none, which is an error only if a period that started before the valuation date needs one (Section 6.6). The context is built by the caller from a market snapshot and passed explicitly; it knows nothing of where the data came from. Discount curves are found by currency and, optionally, collateral currency: each currency has a default curve and may have a CSA curve per other collateral currency (Section 11.2).
8.8 FX pair conventions and today's rate
Every currency pair has one convention, which states:
- which currency is the base \(b\) and which the counter \(q\): a rate of the pair is units of \(q\) per unit of \(b\) (USD/SAR 3.75: one US dollar buys 3.75 riyals); a pair has one convention only, so its base is never ambiguous;
- the spot lag, 2 business days by default, the spot calendar, usually the joint calendar of both currencies (for USD/SAR, Riyadh and New York Fed), and the counting calendar on which the lag is counted: the spot calendar itself unless the convention names another one; every shipped pair against USD names the other currency's calendar (Riyadh for USD/SAR);
- the points scale \(\kappa\) of forward points (Equation (12.3)): 100 when either currency is JPY, 10,000 otherwise, unless the convention says otherwise;
- the collateral currency whose discount curves bring a spot rate to today, USD by default.
The spot date \(s\) of a trade date \(t\) is the spot lag \(L\) counted in business days of the counting calendar, moved to the next business day of the spot calendar:
with \(A_n\) the business-day addition of Equation (2.5) on the counting calendar and \(\mathrm{F}\) the Following convention (Equation (2.4)) on the spot calendar. In words, this is the market rule for pairs against USD: a U.S. holiday before spot does not count against the lag, but spot itself must be a business day in both centres. EUR/USD traded on Wednesday 25 November 2026 counts Thursday 26 November (Thanksgiving, a TARGET business day) and Friday 27 November, so spot is Friday 27 November; counted on the joint calendar it would be Monday 30 November. When the counting and spot calendars are the same, the rule is the plain lag on the joint calendar. The spot date of quotes is taken from the valuation date in the same way. A quote \(S\) that settles on \(s\) exchanges one unit of \(b\) for \(S\) units of \(q\) on \(s\); its value today is one unit of \(b\) worth \(P_b(s)\) against \(S\) units of \(q\) worth \(S P_q(s)\), so today's rate is
the same as Equation (12.2). In plain words: today's rate is the spot rate less the interest difference of the two currencies over the days to spot. The adjustment is made however small, since accuracy matters more than the few basis points it is worth. A quote that settles on the valuation date is today's rate itself; a quote that settles before it is an error, and so is a missing discount curve.
The market context keeps the quotes as given and converts with today's rates. Each today's rate is a function of its quote, so with the quotes recorded on an AAD tape, FX delta is the sensitivity to the spot quote, in the same sweep as the curve sensitivities.
Collateral of cross-currency trades. A cross-currency trade (an FX forward, or a swap with legs in two or more currencies) is discounted under USD collateral unless another collateral currency is agreed: each currency on its CSA curve under USD, and USD on its default curve (Section 11.2). A single-currency trade keeps the default curve of its currency.
8.9 FX positions
The value of a trade or portfolio is first known in each currency, \(V_c\). It is reported in a reporting currency \(r\), for example the user's base currency, as the total \(\sum_c V_c X_{c/r}\) at today's rates (Equation (8.4)), and, below it, as an FX position in each currency: the amount a spot trade would exchange to neutralise the exposure to that currency.
For a currency \(c \ne r\), with \(s_c\) the spot date of the pair of \(c\) and \(r\) and \(P_c\) under that pair's collateral, the position is the value moved to the spot date:
Selling \(Q_c\) units of \(c\) for spot, at the spot rate \(S\), receives \(Q_c\) times the rate in \(r\) on \(s_c\); its value today moves with \(S\) exactly as \(-V_c\) converted at \(X_0\) does, so the trade and the spot sale together have no sensitivity to \(S\). The position differs from \(V_c\) by the interest of \(c\) over the days to spot. The reporting currency's own position is moved the same way, to the latest of those spot dates \(s^\ast\), with \(P_r\) under the collateral currency of the pairs when they all agree on one, and under USD otherwise (the pairs then share no curve for \(r\), and USD is the default collateral):
and when the value is in the reporting currency only, \(s^\ast = v\) and \(Q_r = V_r\). A currency with no convention for its pair with \(r\) is an error.
8.10 Worked example
With USD/SAR 3.75 and EUR/USD 1.08:
- SAR/USD \(= 1/3.75 = 0.266667\) (Equation (8.1));
- EUR/SAR \(= 1.08 \times 3.75 = 4.05\) through USD (Equation (8.2)), so EUR 100 is SAR 405;
- SAR 375 received and USD 50 paid, \(\{(375, \text{SAR}), (-50, \text{USD})\}\), are worth \(375/3.75 - 50 =\) USD 50 (Equation (8.4));
- converting SAR 375 to USD at USD/SAR \(= x\) gives \(375/x\), whose FX delta is \(-375/x^2 = -26.6667\) per unit of the rate at \(x = 3.75\).
A KWD amount of 1.2345 is displayed as 1.235 (3 decimals); the valuation keeps 1.2345.
Spot quote and positions. Valuation date 14-Oct-2026, USD/SAR spot 3.75 settling on 19-Oct-2026 (\(t(s) = 5/365\)), USD discounted at a continuously compounded 4.2% and SAR under USD collateral at 4.9%. A value of USD 1,000,000 and SAR \(-3{,}750{,}000\), reported in USD:
- today's rate (Equation (8.5)): \(X_0 = 3.75\, e^{-0.007 \times 5/365} = 3.749640\);
- total: \(1{,}000{,}000 - 3{,}750{,}000 / 3.749640 = -95.90\) USD, not zero, because the two amounts are exchanged at spot, not today;
- positions (Equation (8.6), Equation (8.7)): SAR \(-3{,}750{,}000\, e^{0.049 \times 5/365} = -3{,}752{,}517.97\) and USD \(1{,}000{,}000\, e^{0.042 \times 5/365} = 1{,}000{,}575.51\);
- FX delta of the total: \(+266{,}692.24\) USD per unit of the USD/SAR spot quote; buying SAR 3,752,517.97 for spot at 3.75 brings it to zero.