Skip to main content

Providers

ProviderDescription
PTAX_APIBrazilian Central Bank (PTAX) — primary for BRL rates
EXCHANGE_RATE_APIExchangeRateAPI — secondary/fallback
MANUALManually entered rates — final fallback

Rate Lookup

When an exchange rate is needed:
  1. Check for today’s rate for the source → target currency pair
  2. If not found, fetch from PTAX API
  3. If PTAX fails, fetch from ExchangeRateAPI
  4. If both fail, use the latest MANUAL rate

Storage

Rates are stored with a unique constraint on (date, source, target). This ensures one rate per currency pair per day.

Usage

Exchange rates are used in Cost Recording to convert token amounts from the token’s currency to the organization’s currency.