cryptolib-ts
v1.0.16
Published
Simplify communication with CoinMarketCap API, made for didactic purposes
Downloads
3
Readme
1. Installing
$ npm install cryptolib-ts
or
$ yarn add cryptolib-ts
2. Setup
COIN_MARKET_CAP_KEY="myAPIkey"
3. Usage
import { Cryptolib } from 'cryptolib-ts'
instance
const CryptoLibInstance = new Cryptolib()
4. Quotes
const BTCquote = CryptoLibInstance.quotes(['BTC'])
{
data: {
BTC: {
id: 1,
name: "Bitcoin",
symbol: "BTC",
slug: "bitcoin",
date_added: "2013-04-28T00:00:00.000Z",
last_updated: "2021-08-26T17:44:11.000Z",
quote: {
USD: {
price: 46963.215165006586,
last_updated: "2021-08-26T17:44:11.000Z"
}
}
}
}
}
5. Price Conversion
const BTCtoBRL = CryptoLibInstance.conversion(100, 'BTC', ['BRL'])
{
data: {
id: 1,
symbol: 'BTC',
name: 'Bitcoin',
amount: 100,
last_updated: '2022-01-27T13:51:00.000Z',
quote: {
BRL: {
price: 19779249.361347176,
last_updated: '2022-01-27T13:51:02.000Z'
}
}
}
}