vansergen / nbrb

A TypeScript library for the NBRB API

Home Page:https://b2broker.github.io/nbrb/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nbrb CI Status version Known Vulnerabilities Coverage Status code style: prettier semantic-release Conventional Commits GitHub top language node version npm downloads License

A simple Node.js library for the NBRB API.

Installation

npm install nbrb

Usage

NBRBClient

import { NBRBClient } from "nbrb";
const client = new NBRBClient();
  • .getCurrencies()
const currencies = await client.getCurrencies();
  • .getCurrency()
const Cur_ID = 431;
const currency = await client.getCurrency({ Cur_ID });
  • .getRates()
const ondate = new Date("2020-8-1");
const rates = await client.getRates({ ondate });
  • .getRate()
const ondate = new Date("2020-8-1");
// by `Cur_ID`
const Cur_ID = 431;
const rate = await client.getRate({ ondate, Cur_ID });
// by `Cur_Code`
const Cur_Code = "840";
const rate = await client.getRate({ ondate, Cur_Code });
// by `Cur_Abbreviation`
const Cur_Abbreviation = "USD";
const rate = await client.getRate({ ondate, Cur_Abbreviation });
  • .getDynamics()
const startdate = new Date("2021-8-1");
const enddate = new Date();
const Cur_ID = 431;
const rates = await client.getDynamics({ startdate, enddate, Cur_ID });

Test

npm run test:ci

About

A TypeScript library for the NBRB API

https://b2broker.github.io/nbrb/

License:GNU Affero General Public License v3.0


Languages

Language:TypeScript 94.2%Language:Shell 5.8%