crypto099
v1.0.12
Published
## Description
Readme
Crypto09
Description
A library that uses CoinMarketCap API, there are two endpoints, quote which returns the latest market quote for 1 or more cryptocurrencies and price_conversion which converts an amount of one cryptocurrency or fiat currency into one or more different currencies utilizing the latest market rate for each currency.
Instalation
$ npm i crypto099
Using the library
You need to pass your APIKey in the headers, you get your APIKEY on https://coinmarketcap.com/api/. Then you import it in your code:
import { Crypto09 } from "crypto099";
Now you need to instantiate it, pass your API_KEY as an argument, remember to use .env to put your api key there and get it from there using dotenv so you don't leave your key for everyone to see:
const coin = new Crypto09(API_KEY);
Methods
Latest Quotes
You are going to pass pass one or more comma-separated cryptocurrency symbols
const quotes_data = coin.quote(["BTC", "ALL"])
Price conversion
Pass the currency symbol of the base cryptocurrency or fiat to convert from, example: "BTC" first, then an amount of currency to convert, example: 10.43. Lastly pass up to 120 comma-separated fiat or cryptocurrency symbols to convert the source amount to.
const quotes_data = crypto.price_conversion('BTC', 0.005, ['ETH'])
