Skip to main content

Coinbase Exchange Rate Worker

Automatically fetches and updates currency exchange rates from Coinbase, supporting both fiat and cryptocurrency pairs.

Included in Crypto Preset

Registered automatically by registerCryptoPlugins() / registerAllPlugins().

Registration​

import { pluginRegistry } from '@unchainedshop/core';
import { UpdateCoinbaseRatesPlugin } from '@unchainedshop/plugins/worker/update-coinbase-rates';

pluginRegistry.register(UpdateCoinbaseRatesPlugin);

Purpose​

Coinbase provides real-time exchange rates for a wide variety of currencies including cryptocurrencies. This worker:

  • Fetches the latest rates from the Coinbase API
  • Uses your default currency as the base (UNCHAINED_CURRENCY, falling back to the first configured currency)
  • Updates product price rates with a 5-minute expiration

Auto-Scheduling​

On registration, this worker schedules itself to run every minute to keep cryptocurrency rates up-to-date.

Manual Trigger​

You can also trigger an update manually:

mutation UpdateRates {
addWork(type: UPDATE_COINBASE_RATES) {
_id
status
}
}

Supported Currencies​

Coinbase provides rates for:

  • Fiat currencies: USD, EUR, GBP, CHF, and many more
  • Cryptocurrencies: BTC, ETH, USDC, and hundreds of others

Only currencies that exist in your Unchained system (active or inactive) are updated.

Rate Expiration​

Rates expire after 5 minutes. Expired rates are excluded from conversion lookups; if updates stop and no valid rate remains, the rate-conversion pricing adapter cannot supply a converted price.

Result​

{
"ratesUpdated": 15
}

Adapter Details​

PropertyValue
Keyshop.unchained.worker.update-coinbase-rates
TypeUPDATE_COINBASE_RATES
Auto-ScheduleEvery minute
Sourceworker/update-coinbase-rates