FX Conversion Guide
How CryptaChain handles foreign exchange rate conversions, and how to use them correctly in your application.
The "1 foreign = X USD" convention
All FX rates are stored as: 1 unit of foreign currency = X USD.
This means:
- EUR rate of 1.0870 → 1 EUR = 1.0870 USD
- JPY rate of 0.006667 → 1 JPY = 0.006667 USD
- GBP rate of 1.2750 → 1 GBP = 1.2750 USD
Why we invert Frankfurter rates
The ECB/Frankfurter API returns rates as "1 EUR = X foreign". For example:
- Frankfurter says: 1 EUR = 149.95 JPY
We store: 1 JPY = (1 / 149.95) × EUR_USD_rate = 0.006667 USD
This ensures a consistent convention across all 36 currencies, making conversion simple:
value_usd = value_in_foreign × fx_rateWeekend and holiday gap-fill
ECB publishes rates on business days only (~250 per year). For days without a rate:
| Situation | Behavior |
|---|---|
| Saturday | Friday's rate carried forward |
| Sunday | Friday's rate carried forward |
| EU public holiday | Previous business day's rate |
| ECB closure | Previous business day's rate |
The date field in the API response always reflects the actual publication date of the rate, even when gap-filled.
Hardcoded pegs
Five currencies maintain a fixed peg to USD:
| Currency | Rate | Peg since |
|---|---|---|
| AED (UAE Dirham) | 1 AED = 0.2723 USD | 1997 |
| SAR (Saudi Riyal) | 1 SAR = 0.2667 USD | 1986 |
| QAR (Qatari Riyal) | 1 QAR = 0.2747 USD | 2001 |
| OMR (Omani Rial) | 1 OMR = 2.5974 USD | 1986 |
| BHD (Bahraini Dinar) | 1 BHD = 2.6596 USD | 2001 |
BGN (Bulgarian Lev) is pegged to EUR at 1.95583, then converted to USD via the EUR/USD rate.
IAS 21 monthly averages
For income statement translation under IAS 21, use GET /v1/fx/monthly-average:
curl "https://api.cryptachain.com/v1/fx/monthly-average?from=EUR&to=USD&year=2026&month=3" \
-H "X-API-Key: $CRYPTACHAIN_API_KEY"The monthly average is the arithmetic mean of all business-day rates in the month (weekends and holidays excluded, not gap-filled).
For balance sheet translation, use the closing rate on the reporting date via GET /v1/fx/rate.
Converting crypto prices to local currency
To get a crypto price in a non-USD currency:
price_local = price_usd × (1 / fx_rate_local_to_usd)Or simply use the currency parameter on price endpoints:
curl "https://api.cryptachain.com/v1/prices/by-symbol?symbol=ETH¤cy=EUR" \
-H "X-API-Key: $CRYPTACHAIN_API_KEY"The API handles the conversion internally using the same-day FX rate.