FrankfurterCurrencyProvider
katanakit-js / FrankfurterCurrencyProvider
Class: FrankfurterCurrencyProvider
Section titled “Class: FrankfurterCurrencyProvider”Defined in: infrastructure/currency/frankfurter.service.ts:69
FrankfurterCurrencyProvider — rate source over Frankfurter, the open source (MIT) API for European Central Bank reference rates. No API key, no quota.
Implements the ICurrencyRateProvider port and performs the network
I/O through the kit’s own API system (FetchApiManager), so it inherits the
request interceptors, the SSRF scheme allow-list and the Safe Result shape.
Rates are the ECB daily reference rates, published each working day at
around 14:15 CET and not updated on weekends or ECB holidays — date on the
snapshot is the day they belong to. They are the reference used for
accounting and invoicing, but they are not an intraday forex quote and carry
no bid/ask spread. Swap the provider through the port when you need live
market quotes.
Remarks
Section titled “Remarks”Each configured host registers its own entry in the API registry
(keyed by base URI), so a self-hosted instance and the shared one never
overwrite each other. Frankfurter covers ~30 currencies and does not
include ARS, COP or CLP — conversions involving them fail with an
explicit 404 error instead of a silent wrong number.
Example
Section titled “Example”import { FrankfurterCurrencyProvider, CurrencyConverterService,} from "katanakit-js";
const currency = CurrencyConverterService.create({ provider: FrankfurterCurrencyProvider.getInstance(),});Implements
Section titled “Implements”Methods
Section titled “Methods”useFetchRates()
Section titled “useFetchRates()”useFetchRates(base, quotes?): Promise<SafeResult<{ base: | "USD" | "EUR" | "GBP" | "JPY" | "CHF" | "CAD" | "AUD" | "NZD" | "MXN" | "BRL" | "ARS" | "COP" | "CLP" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "RON" | "TRY" | "ISK" | "CNY" | "HKD" | "SGD" | "INR" | "KRW" | "THB" | "IDR" | "MYR" | "PHP" | "ILS" | "ZAR"; date: string; rates: Record<string, number>;}>>;Defined in: infrastructure/currency/frankfurter.service.ts:116
Fetches ECB reference rates quoted against base.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
base |
| "USD" | "EUR" | "GBP" | "JPY" | "CHF" | "CAD" | "AUD" | "NZD" | "MXN" | "BRL" | "ARS" | "COP" | "CLP" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "RON" | "TRY" | "ISK" | "CNY" | "HKD" | "SGD" | "INR" | "KRW" | "THB" | "IDR" | "MYR" | "PHP" | "ILS" | "ZAR" |
Currency the rates are quoted against. |
quotes? |
( | "USD" | "EUR" | "GBP" | "JPY" | "CHF" | "CAD" | "AUD" | "NZD" | "MXN" | "BRL" | "ARS" | "COP" | "CLP" | "SEK" | "NOK" | "DKK" | "PLN" | "CZK" | "HUF" | "RON" | "TRY" | "ISK" | "CNY" | "HKD" | "SGD" | "INR" | "KRW" | "THB" | "IDR" | "MYR" | "PHP" | "ILS" | "ZAR")[] |
Optional subset of quote currencies. Omit for every rate the source knows. |
Returns
Section titled “Returns”Promise<SafeResult<{
base: | "USD"
| "EUR"
| "GBP"
| "JPY"
| "CHF"
| "CAD"
| "AUD"
| "NZD"
| "MXN"
| "BRL"
| "ARS"
| "COP"
| "CLP"
| "SEK"
| "NOK"
| "DKK"
| "PLN"
| "CZK"
| "HUF"
| "RON"
| "TRY"
| "ISK"
| "CNY"
| "HKD"
| "SGD"
| "INR"
| "KRW"
| "THB"
| "IDR"
| "MYR"
| "PHP"
| "ILS"
| "ZAR";
date: string;
rates: Record<string, number>;
}>>
{ data, error, ok } with the dated snapshot, or the source
failure. Never throws.
Implementation of
Section titled “Implementation of”ICurrencyRateProvider.useFetchRates
create()
Section titled “create()”static create(options?): FrankfurterCurrencyProvider;Defined in: infrastructure/currency/frankfurter.service.ts:104
Creates a NO-singleton instance with a custom base URI (DI).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options? |
FrankfurterCurrencyProviderOptions |
Wiring options. |
Returns
Section titled “Returns”FrankfurterCurrencyProvider
A new FrankfurterCurrencyProvider.
getInstance()
Section titled “getInstance()”static getInstance(): FrankfurterCurrencyProvider;Defined in: infrastructure/currency/frankfurter.service.ts:91
Returns the shared instance (Singleton).
Returns
Section titled “Returns”FrankfurterCurrencyProvider