Skip to content

๐Ÿ’ฑ FX Rates & Routes

Currency exchange rates and routing configuration. The FX subsystem stores daily rates and manages multi-provider data supply chains.

๐Ÿ“ ER Diagram

erDiagram
    FX_RATE
    FX_CURRENCY_PAIR_SOURCE

    FX_RATE {
        date date
        string base
        string quote
        decimal rate
    }

    FX_CURRENCY_PAIR_SOURCE {
        string base
        string quote
        string provider_code
        int priority
        json provider_params
    }

๐Ÿ“‹ Tables

๐Ÿ’ฑ FX_RATE

Stores daily exchange rates. Each row represents the rate for a currency pair on a specific date.

  • ๐Ÿ”ค Alphabetical ordering: Enforces base < quote (alphabetical) to prevent duplicate storage. For example, EUR/USD is always stored as base=EUR, quote=USD regardless of the query direction. The system automatically inverts the rate when needed.
  • ๐Ÿ”’ Uniqueness: The composite key (date, base, quote) ensures no duplicate rates.

๐Ÿ”Œ FX_CURRENCY_PAIR_SOURCE

Configures which data provider to use for each currency pair. Supports multi-provider fallback via priority ordering.

  • ๐Ÿ›๏ธ provider_code: References a registered FX provider (ECB, FED, BOE, SNB, etc.)
  • ๐Ÿ”ข priority: Lower number = higher priority. If priority-1 provider fails, the system tries priority-2.
  • โš™๏ธ provider_params (JSON): Provider-specific configuration if needed.

The provider system uses the Registry Pattern for extensibility.

๐Ÿ”€ Data Supply Chains

For exotic currency pairs (e.g., RON/JPY), the system can construct multi-step conversion chains through intermediate currencies. For example:

RON โ†’ EUR (via ECB) โ†’ JPY (via ECB)

This is configured via FX Configuration & Routing and executed by the FX Chain Algorithm.