An API wrapper around nbg.gov.ge
for fetching the National Bank of Georgia's currency rates. This package simplifies the process of retrieving currency exchange rates and provides an easy-to-use interface for developers.
- Fetch all currency rates for a given date.
- Fetch specific currency rates for a given date.
- Set the default language for API responses (
en
for English,ka
for Georgian).
Install via npm:
npm install nbg-currency-rates-api
or via yarn:
yarn add nbg-currency-rates-api
First, import the package in your project:
import { fetchAllRates, fetchRatesForCurrency, setDefaultLanguage } from 'nbg-currency-rates-api';
or in JavaScript:
const { fetchAllRates, fetchRatesForCurrency, setDefaultLanguage } = require('nbg-currency-rates-api');
// Set to Georgian
setDefaultLanguage('ka');
const allRates = await fetchAllRates(new Date('2021-10-01'));
console.log(allRates);
const currencyRates = await fetchRatesForCurrency('USD', new Date('2021-10-01'));
console.log(currencyRates);
setDefaultLanguage(language: Language): void
Sets the default language for API responses.
fetchAllRates(date?: Date): Promise<CurrencyData>
Fetches all currency rates for a given date.
fetchRatesForCurrency(currency: Currency, date?: Date): Promise<CurrencyData>
Fetches specific currency rates for a given date.
Contributions are welcome! Please feel free to submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.