Exchange

Exchange

Calculate Exchange rates for Cryptocurrencies




Constructor

new Exchange(coinsopt)

Create a new Exchange Rate checker

Example
import Exchange from 'oip-exchange-rate';

let exchange = new Exchange();
Parameters:
Name Type Attributes Description
coins CoinObject <optional>

Object containing CoinsObjects

Source:

Methods




(async) getExchangeRate(coin, fiat) → {Promise.<number>}

Parameters:
Name Type Description
coin string

The string coin name (ex. "bitcoin")

fiat string

The string fiat (ex. "usd")

Source:
Example

Get the Exchange rate for USD per Bitcoin

import Exchange from 'oip-exchange-rate';

let exchange = new Exchange();

exchange.getExchangeRate("bitcoin", "usd").then((rate) => {
  console.log(rate);
})
Returns:

Returns a Promise that will resolve to the number value of the exchange rate

Type:
Promise.<number>