Exchange Rates
Fetches and records daily foreign exchange rates per currency pair, enabling consistent monetary conversion across assets and time.
Purpose
This worker populates the Exchange Rates fact table with exchange rates for each defined currency pair. The data is used to consistently convert monetary amounts across assets and dates.
Inputs
The worker consumes a dataframe of currency pairs and dates sourced from the following Omora Labs components:
Each row represents a single currency pair to be resolved for a specific date.
Required columns:
| Column | Description |
|---|---|
| date | Date represented as YYYY-MM-DD. Links to Dates semantic contract |
| currency_pair_id | Currency Pair identifier. Links to Currency Pairs semantic contract |
| base_currency | Base Currency as per ISO 4217, e.g. "EUR", "USD" |
| quote_currency | Quote Currency as per ISO 4217, e.g. "EUR", "USD" |
External Data Source
Exchange rates are fetched from the public open-source currency API provided by @fawazahmed0/currency-api.
The API exposes historical daily snapshots and returns exchange rates indexed by base currency.
Work
For each date, currency_pair combination:
- Extract the base and quote currencies.
- Request the historical exchange rates for the base currency on the given date.
- Select the quote currency rate from the response.
- Normalize the result into the internal fact structure.
Each exchange rate is materialized as a single factual observation per date and currency pair.
Orchestrator
A simple orchestrator suffices for handling the inputs and the worker:
Output
The worker produces a dataframe compatible with the Exchange Rates fact table.
Each record represents the exchange rate for a given currency pair on a specific date, uniquely identified by date, currency_pair_id.