1.0.1 • Published 4 months ago

bonbast-api v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

BonBast Api For Nodejs

A node library to get exchange rates from the bonbast site

Taken from the bonbast library

Installation

npm:

npm install bonbast-api

yarn:

yarn add bonbast-api

Usage

import es5 or javascript:

const {BonbastApi} = require("bonbast-api")

import es6 or typescript:

import {BonbastApi} from 'bonbast-api';

Get Response:

const getResponse = await BonbastApi.getResponse();

options:

nametypedefaultdescription
sellAddCommasbooleantruefor add / remove commas numbers
buyAddCommasbooleantruefor add / remove commas numbers

simple response:

 {
  aed1: '14120',
  aed2: '14070',
  afn1: '730',
  afn2: '725',
  amd1: '1270',
  amd2: '1265',
  aud1: '34400',
  aud2: '34300'

  // and more ...
}

Get Currency:

const getCurrency = await BonbastApi.getCurrency();

options:

nametypedefaultdescription
sellAddCommasbooleantruefor add / remove commas numbers
buyAddCommasbooleantruefor add / remove commas numbers

simple response:

[
  {
    code: 'bhd',
    name: 'Bahraini Dinar',
    sell: '136,100',
    buy: '135,600'
  },
  {
    code: 'cad',
    name: 'Canadian Dollar',
    sell: '38,400',
    buy: '38,300'
  },
  {
    code: 'eur',
    name: 'Euro',
    sell: '56,150',
    buy: '56,050'
  }

  // and more ...
]

Get Coin:

const getCoin = await BonbastApi.getCoin();

options:

nametypedefaultdescription
sellAddCommasbooleantruefor add / remove commas numbers
buyAddCommasbooleantruefor add / remove commas numbers

simple response:

[
  {
    code: 'emami',
    name: 'Emami',
    sell: '30,750,000',
    buy: '30,450,000'
  },
  {
    code: 'azadi',
    name: 'Gerami',
    sell: '5,950,000',
    buy: '5,800,000'
  }

  // and more ...
]

Get Gold:

const getCoin = await BonbastApi.getGold({priceAddCommas: false});

options:

nametypedefaultdescription
priceAddCommasbooleantruefor add / remove commas numbers

simple response:

[
  {
    code: 'mithqal',
    name: 'Gold Mithqal',
    price: 11219000
  },
  {
    code: 'gol18',
    name: 'Gold Gram',
    price: 2589916
  },
  {
    code: 'ounce',
    name: 'Ounce',
    price: 2029.24
  },
  {
    code: 'bitcoin',
    name: 'Bitcoin',
    price: 46873.93
  }
]

description:

List of supported currencies:

FlagCurrencyCode
🇺🇸US DollarUSD
🇪🇺EuroEUR
🇬🇧British PoundGBP
🇨🇭Swiss FrancCHF
🇨🇦Canadian DollarCAD
🇦🇺Australian DollarAUD
🇸🇪Swedish KronaSEK
🇳🇴Norwegian KroneNOK
🇷🇺Russian RubleRUB
🇹🇭Thai BahtTHB
🇸🇬Singapore DollarSGD
🇭🇰Hong Kong DollarHKD
🇦🇿Azerbaijani ManatAZN
🇦🇲10 Armenian DramAMD
🇩🇰Danish KroneDKK
🇦🇪UAE DirhamAED
🇯🇵10 Japanese YenJPY
🇹🇷Turkish LiraTRY
🇨🇳Chinese YuanCNY
🇸🇦Saudi RiyalSAR
🇮🇳Indian RupeeINR
🇲🇾Malaysian RinggitMYR
🇦🇫Afghan AfghaniAFN
🇰🇼Kuwaiti DinarKWD
🇮🇶100 Iraqi DinarIQD
🇧🇭Bahraini DinarBHD
🇴🇲Omani RialOMR
🇶🇦Qatari RialQAR