npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

coingecko-api-client

v1.0.1

Published

A TypeScript client for the CoinGecko API

Downloads

83

Readme

CoinGecko API Client

A TypeScript client for the CoinGecko API.

Installation

npm install coingecko-api-client

Quick 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 status
  • getPriceById - Get current price of coins
  • getPriceByContractAddress - Get current price of tokens by contract address
  • getSupportedVsCurrencies - Get list of supported vs currencies
  • getCoinList - List all supported coins
  • getCoinMarkets - Get current market data for coins
  • getCoinById - Get current data for coin
  • getCoinTickers - Get coin tickers
  • getCoinHistory - Get historical data for coin
  • getCoinMarketChart - Get historical market data for coin
  • getCoinMarketChartRange - Get historical market data for coin within a date range
  • getCoinOhlc - Get OHLC data for coin
  • getContractInfo - Get coin info from contract address
  • getContractMarketChart - Get historical market data for contract address
  • getContractMarketChartRange - Get historical data for contract address within a date range
  • getAssetPlatforms - List asset platforms
  • getCoinCategoriesList - List coin categories
  • getCoinCategories - List coin categories with market data
  • getExchanges - List exchanges
  • getExchangesList - List exchange ids
  • getExchangesById - Get exchange volume and tickers
  • getExchangeTickers - Get exchange tickers
  • getExchangeVolumeChart - Get exchange volume chart
  • getDerivatives - List derivative tickers
  • getDerivativesExchanges - List derivative exchanges
  • getDerivativesExchangeById - Get derivative exchange data
  • getDerivativesExchangesList - List derivative exchange ids
  • getNftsList - List NFT collections
  • getNftById - Get NFT collection data
  • getNftByContractAddress - Get NFT collection data by contract address
  • getExchangeRates - Get BTC-to-currency exchange rates
  • search - Search for coins
  • getTrending - Get trending searches
  • getGlobal - Get cryptocurrency global data
  • getGlobalDeFi - Get top DeFi coins
  • getCompaniesPublicTreasury - Get public companies crypto holdings

See the API docs for more details on parameters and usage.

License

MIT