Exchange rates
All of these methods return Promise<Rate[]>. Each rate object includes date, base, quote, and rate.
quotes and providers accept either a string array or a single comma-separated string, matching the OpenAPI list serialization.
rates(query?, requestOptions?)
Section titled “rates(query?, requestOptions?)”Direct mapping to GET /v2/rates with the full query shape:
const rates = await client.rates({ date: "2025-01-10", base: "EUR", quotes: ["USD", "CHF"], providers: ["ECB"],});Supported query fields include date, from, to, base, quotes, providers, and group ("week" | "month" for ranges).
latest(options?, requestOptions?)
Section titled “latest(options?, requestOptions?)”Same as rates without a date (current rates):
const latest = await client.latest({ base: "USD", quotes: ["EUR", "GBP"],});historical(date, options?, requestOptions?)
Section titled “historical(date, options?, requestOptions?)”Rates for one calendar day:
const historical = await client.historical("2025-01-10", { base: "EUR", quotes: "USD",});range(from, to?, options?, requestOptions?)
Section titled “range(from, to?, options?, requestOptions?)”From-to range; optional to for open-ended ranges:
const ranged = await client.range("2025-01-01", "2025-01-31", { base: "EUR", quotes: ["USD", "CHF"], group: "month",});The optional fourth argument on each method is RequestOptions: { signal?, headers? } for per-call overrides (see Errors & requests).