Vai al contenuto

πŸ’± 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.