1.0.1 • Published 1 year ago
coingecko-api-client v1.0.1
CoinGecko API Client
A TypeScript client for the CoinGecko API.
Installation
npm install coingecko-api-clientQuick Start
import CoinGecko from 'coingecko-api-client';
const client = new CoinGecko();
const bitcoinPrice = await client.getPriceById({
ids: ['bitcoin'],
vs_currencies: ['usd']
});
console.log(bitcoinPrice);Options
The following optional parameters can be passed when creating an instance:
import axios from 'axios';
// apiKey (optional) - CoinGecko Pro API key
// timeout (optional) - request timeout in milliseconds
// client (optional) - existing Axios instance to use for requests
const client = new CoinGecko('aF8cd17B90A', 3000, axios.create());
const bitcoinPrice = await client.getPriceById({
ids: ['bitcoin'],
vs_currencies: ['usd']
});
console.log(bitcoinPrice);API
The following CoinGecko API endpoints are supported:
getApiStatus- Check API server statusgetPriceById- Get current price of coinsgetPriceByContractAddress- Get current price of tokens by contract addressgetSupportedVsCurrencies- Get list of supported vs currenciesgetCoinList- List all supported coinsgetCoinMarkets- Get current market data for coinsgetCoinById- Get current data for coingetCoinTickers- Get coin tickersgetCoinHistory- Get historical data for coingetCoinMarketChart- Get historical market data for coingetCoinMarketChartRange- Get historical market data for coin within a date rangegetCoinOhlc- Get OHLC data for coingetContractInfo- Get coin info from contract addressgetContractMarketChart- Get historical market data for contract addressgetContractMarketChartRange- Get historical data for contract address within a date rangegetAssetPlatforms- List asset platformsgetCoinCategoriesList- List coin categoriesgetCoinCategories- List coin categories with market datagetExchanges- List exchangesgetExchangesList- List exchange idsgetExchangesById- Get exchange volume and tickersgetExchangeTickers- Get exchange tickersgetExchangeVolumeChart- Get exchange volume chartgetDerivatives- List derivative tickersgetDerivativesExchanges- List derivative exchangesgetDerivativesExchangeById- Get derivative exchange datagetDerivativesExchangesList- List derivative exchange idsgetNftsList- List NFT collectionsgetNftById- Get NFT collection datagetNftByContractAddress- Get NFT collection data by contract addressgetExchangeRates- Get BTC-to-currency exchange ratessearch- Search for coinsgetTrending- Get trending searchesgetGlobal- Get cryptocurrency global datagetGlobalDeFi- Get top DeFi coinsgetCompaniesPublicTreasury- Get public companies crypto holdings
See the API docs for more details on parameters and usage.
License
MIT