Daily automatic import of official exchange rates from the National Bank of Ukraine (bank.gov.ua). Exchange differences calculated automatically per P(S)BO 21 — gain posted to account 714, loss to account 945.
CurrencyRateScheduler runs on every weekday at 10:15 Kyiv time via robfig/cron/v3. FetchIfNeeded() checks whether rates for today already exist — if they do, the API call is skipped entirely.
The exchange difference is calculated when a foreign-currency invoice is paid at a rate different from the invoice date rate. Three outcomes: gain, loss, or zero. Only gain and loss generate journal entries.
The NBU scheduler is started in main.go via NBUScheduler.Start(). It uses the same robfig/cron/v3 engine as all automation scripts — consistent, production-tested, cron expression based. Europe/Kyiv timezone is set explicitly for correct DST handling.
Exchange rates are not just stored — they are actively used by three other contexts in Axiom. Every foreign-currency operation pulls the exact transaction date rate from the rates table.
Foreign-currency invoice posting → GetRateForCurrency(currency, invoice_date) → UAH equivalent in journal entry.
Statement line in USD → NBU rate on value date → UAH booking amount + FX difference.
FX gain (Ct 714) and loss (Dt 945) flow into Form 2 financial income/expense lines automatically.