npm install axios
npm install extends-classes
npm install query-string
//1. Import
let Geko = require("./lib/geko");
//2. Initiate the CoinGecko API Client
const CoinGeckoClient = new Geko();
//3. Make calls
var func = async() => {
let data = await CoinGeckoClient.ping();
};This module provides helper constants for use in calls. • To do
All calls using the CoinGeckoClient are asynchronous.
Each function receives an object as an argument.
Check API server status.
Usage Example:
let data = await CoinGeckoClient.ping();Simple Category /simple
| Argument | Type | Optional |
|---|---|---|
| ids | array | false |
| vs_currencies | array | true |
let params = {
ids:["btc"],
vs_currencies:["eur"],
}
let data = await CoinGeckoClient.simple.price(params);| Argument | Type | Optional |
|---|---|---|
| id | path | false |
| vs_currencies | array | true |
| contract_addresses | array | false |
let params = {
id:"ethereum",
vs_currencies:["eur"],
contract_addresses:["0xe41d2489571d322189246dafa5ebde1f4699f498"]
}
let data = await CoinGeckoClient.simple.price(params); let data = await CoinGeckoClient.simple.supportedVsCurrencies();Coins cateogry /coins
let data = await CoinGeckoClient.coins.all(); let data = await CoinGeckoClient.coins.list();| Argument | Type | Optional |
|---|---|---|
| ids | array | false |
| vs_currency | string | true |
let params = {
ids:["btc"],
vs_currencies:"eur"
}
let data = await CoinGeckoClient.coins.markets(params);| Argument | Type | Optional |
|---|---|---|
| id | string | false |
let params = {
id:"btc",
}
let data = await CoinGeckoClient.coins.markets(params);| Argument | Type | Optional |
|---|---|---|
| id | string | false |
let params = {
id:"btc",
}
let data = await CoinGeckoClient.coins.tickers(params);| Argument | Type | Optional |
|---|---|---|
| id | string | false |
| date | string dd-mm-yyyy | false |
let params = {
id:"btc",
date:"19-12-2022"
}
let data = await CoinGeckoClient.coins.date(params);| Argument | Type | Optional |
|---|---|---|
| id | string | false |
| vs_currencies | string | true |
| days | string | false |
let params = {
id:["btc"],
vs_currencies:"eur",
days:"1"
}
let data = await CoinGeckoClient.simple.marketChart(params);| Argument | Type | Optional |
|---|---|---|
| id | string | false |
| vs_currencies | string | true |
| from | string unix | false |
| to | string unix | false |
let params = {
id:["btc"],
vs_currencies:"eur",
from:"1392577232",
to:"1422577232"
}
let data = await CoinGeckoClient.simple.marketChartRange(params);| Argument | Type | Optional |
|---|---|---|
| id | string | false |
| vs_currencies | string | true |
| days | string | false |
let params = {
id:["btc"],
vs_currencies:"eur",
days:"1"
}
let data = await CoinGeckoClient.simple.ohlc(params);