Skip to main content

ECB Exchange Rate Worker

Automatically fetches and updates EUR-based currency exchange rates from the European Central Bank.

Installation

import '@unchainedshop/plugins/worker/update-ecb-rates';

Peer Dependency

This worker requires the xml-js package:

npm install xml-js

Purpose

The ECB publishes daily reference exchange rates for major currencies against EUR. This worker:

  • Fetches the latest rates from the ECB XML feed
  • Updates product price rates in the database
  • Automatically schedules itself daily at 15:00 UTC (4 PM CET)

Auto-Scheduling

When imported, this worker automatically schedules itself to run daily at 15:00 UTC, which is after the ECB publishes new rates (around 16:00 CET).

Manual Trigger

You can also trigger an update manually:

mutation UpdateRates {
createWork(type: "UPDATE_ECB_RATES") {
_id
status
}
}

Supported Currencies

The ECB provides rates for approximately 30 currencies including:

  • USD, GBP, JPY, CHF, CAD, AUD
  • SEK, NOK, DKK, PLN, CZK, HUF
  • And many more

Only currencies that are enabled in your Unchained configuration will be updated.

Requirements

  • EUR must be an enabled currency in your system
  • Target currencies must also be enabled
  • The xml-js npm package must be installed

Result

{
"ratesUpdated": 25,
"info": "EUR not enabled" // Only if EUR is not configured
}

Adapter Details

PropertyValue
Keyshop.unchained.worker.update-ecb-rates
TypeUPDATE_ECB_RATES
Auto-ScheduleDaily at 15:00 UTC
Retries5
Sourceworker/update-ecb-rates.ts