aeat.adapters.outbound.fx._ecb_refresh module

Refresh the bundled ECB euro reference-rate snapshot.

Maintenance utility (not on the runtime path) that re-acquires the European Central Bank eurofxref-hist.xml full history and writes it to the bundled data file the runtime reads offline. Fetch and write are separated so the write/validate path is testable without a network round-trip.

See the ledger-fx-conversion ADR: the runtime stays offline against a versioned bundled snapshot; this utility updates that snapshot on release.

refresh_bundled_ecb_rates(*, source_xml=None, url='https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.xml', dest=None)[source]

Validate and write a fresh ECB eurofxref snapshot to the bundled file.

When source_xml is given it is used directly (testable path); otherwise the history is fetched from url (must be https). The XML is parsed to confirm it is a usable eurofxref document before it overwrites the bundle. Returns the number of dated rate sets written.

Return type:

int

Parameters:
  • source_xml (str | None)

  • url (str)

  • dest (Path | None)