An open-source TypeScript wrapper for the the CoinGecko API
npm install @crypto-coffee/coingecko-api
import CoinGeckoApi from '@crypto-coffee/coingecko-api'
;(async () => {
try {
const coinGeckoApi = new CoinGeckoApi()
const results = await coinGeckoApi.simple({
ids: 'Bitcoin',
vs_currencies: 'usd'
})
console.log(results)
} catch (err) {
// do something with the error
}
})()
We have supplied the majority of CoinGecko's API. The available endpoints are supplied below:
const result = await coinGeckoApi.ping()
// Single id
const results = await coinGeckoApi.simple({
vs_currencies: 'usd'
id: 'bitcoin'
})
// Multiple ids
const results = await coinGeckoApi.simple({
vs_currencies: 'usd'
id: ['bitcoin', 'Ethereum']
})
// single contract_address
const results = await coinGeckoApi.simpleTokenPrice({
'binance-smart-chain', {
contract_addresses: '0x00',
vs_currencies: 'usd'
}
})
// Multiple contract_addresses
const results = await coinGeckoApi.simpleTokenPrice({
'binance-smart-chain', {
contract_addresses: ['0x00', '0x001'],
vs_currencies: 'usd'
}
})
const results = await coinGeckoApi.supportedCurrencies()
const results = await coinGeckoApi.coinList()
const results = await coinGeckoApi.coinMarkets({ vs_currency: 'usd' })
const results = await coinGeckoApi.coinMarkets({ id: 'bitcoin' })
const results = await coinGeckoApi.coinTickers('bitcoin', {
exchange_ids: 'binance'
})
const { data, request } = await coinGeckoApi.coinTickers('bitcoin', {
exchange_ids: 'binance'
})
const results = await coinGeckoApi.coinHistory('bitcoin', '30-12-2017', {
localization: false
})
const results = await coinGeckoApi.coinHistory('bitcoin', '30-12-2017')
const results = await coinGeckoApi.coinMarketChart('bitcoin', {
vs_currency: 'usd',
days: '1'
})
const results = await coinGeckoApi.coinMarketChartRange('bitcoin', {
vs_currency: 'usd',
from: '1392577232',
to: '1422577232'
})
const results = await coinGeckoApi.coinOHLC('bitcoin', {
vs_currency: 'usd',
days: 7
})
const results = await coinGeckoApi.contractInformation(
'binance-smart-chain',
'0x00'
)
const results = await coinGeckoApi.contractMarketChart(
'binance-smart-chain',
'0x00',
{
vs_currency: 'usd',
days: '1'
}
)
const results = await coinGeckoApi.contractMarketChartRange(
'binance-smart-chain',
'0x00',
{
vs_currency: 'usd',
from: '1619881896',
to: '1619968296'
}
)
const results = await coinGeckoApi.assetPlatforms()
const results = await coinGeckoApi.categoriesList()
const results = await coinGeckoApi.categoriesListMarketData()
const results = await coinGeckoApi.exchangesList()
const results = await coinGeckoApi.exchangesList()
const results = await coinGeckoApi.exchangesById('binance')
const results = await coinGeckoApi.exchangeTickers('binance')
const results = await coinGeckoApi.exchangesVolumeChart('binance', 1)
This package is maintained by Zidious(Gabe) and Michael. If any of the endpoints that are supplied by CoinGecko and are not in this package please only an issue and we will get them added as soon as possible.
☕ ☕