Prices

In this guide, we'll teach you how to check realtime currencies prices.

Straight to the code!

Possible tokens are: XLM, XRP, BTC, ETH, CELO, BNB, MDA, HTR, ADA, AVAX, SOL, MATIC, BRL, USD.

const sdk = new CryptumSdk({
  environment: 'testnet',
  apiKey: 'YOUR-API-KEY'
})
// list for XLM
const prices = await sdk.prices.getPrices('XLM')
// Prices {
//   "BRL": 1.811,
//   "USD": 0.3495,
//   "EUR": 0.2967,
//   "BTC": 7.35687406736623e-06,
//   "ETH": 0.00010271074069284932,
//   "XLM": 1,
//   "XRP": 0.29052369077306733,
//   "BNB": 0.0007402151812944764,
//   "MDA": 0.38824705620973116,
//   "CELO": 0.06321215409658167,
//   "HTR": 0.3900669642857143,
//   "ADA": 0.18340652,
//   "AVAX": 0.00475974,
//   "SOL":0.00144091,
// }

Step 1

The first prerequisite you will need is the creation of an account and a Project (API Key) on Cryptum Dashboard.

PS: Our dashboard is almost ready! To generate an API Key, contact hello@blockforce.in

Step 2

With a valid Cryptum API Key, you can then instantiate the SDK as follows:

const CryptumSdk = require('cryptum-sdk')

const sdk = new CryptumSdk({
  environment: 'testnet',  // 'testnet', 'mainnet'
  apiKey: "YOUR-API-KEY-HERE",
})

Step 3

Define which currency you want to query and pass it as a parameter. In the results, you can see all currencies available.

const prices = await sdk.prices.getPrices('BTC')
Prices {
  BRL: 288334.24345847557,
  USD: 50689.16,
  EUR: 44770.01,
  ETH: 12.358597889080416,
  XLM: 177731.9775596073,
  MDA: 93990.65455219729,
  BNB: 92.25940082268575,
  XRP: 50336.80238331678,
  CELO: 10304.76926204513,
  BTC: 1,
  HTR: 25093.643564356436,
  ADA: 34909.88980716254,
  AVAX: 406.391084743045
}

Last updated