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-jsnpm package must be installed
Result
{
"ratesUpdated": 25,
"info": "EUR not enabled" // Only if EUR is not configured
}
Adapter Details
| Property | Value |
|---|---|
| Key | shop.unchained.worker.update-ecb-rates |
| Type | UPDATE_ECB_RATES |
| Auto-Schedule | Daily at 15:00 UTC |
| Retries | 5 |
| Source | worker/update-ecb-rates.ts |