Socket
Book a DemoInstallSign in
Socket

@crypto-coffee/coingecko-api

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@crypto-coffee/coingecko-api

[![GitHub contributors](https://img.shields.io/github/contributors/michael-siek/coingecko-api)](https://github.com/michael-siek/coingecko-api/graphs/contributors) [![npm](https://img.shields.io/npm/dt/@crypto-coffee/coingecko-api)](https://www.npmjs.com/p

1.2.0
latest
Source
npmnpm
Version published
Weekly downloads
8
-33.33%
Maintainers
2
Weekly downloads
 
Created
Source

CoinGecko API TypeScript Wrapper

GitHub contributors npm

An open-source TypeScript wrapper for the the CoinGecko API

Coingecko API Documentation

Installation

npm install @crypto-coffee/coingecko-api

Usage Example

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
  }
})()

Endpoints

We have supplied the majority of CoinGecko's API. The available endpoints are supplied below:

Ping

const result = await coinGeckoApi.ping()

/simple/price

// 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']
})

/simple/token_price/{id}

// 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'
    }
})

/simple/supported_vs_currencies

const results = await coinGeckoApi.supportedCurrencies()

​/coins​/list

const results = await coinGeckoApi.coinList()

​/coins​/markets

const results = await coinGeckoApi.coinMarkets({ vs_currency: 'usd' })

​/coins​/{id}

const results = await coinGeckoApi.coinMarkets({ id: 'bitcoin' })

​/coins​/{id}​/tickers

const results = await coinGeckoApi.coinTickers('bitcoin', {
  exchange_ids: 'binance'
})

const { data, request } = await coinGeckoApi.coinTickers('bitcoin', {
  exchange_ids: 'binance'
})

​/coins​/{id}​/history

const results = await coinGeckoApi.coinHistory('bitcoin', '30-12-2017', {
  localization: false
})
const results = await coinGeckoApi.coinHistory('bitcoin', '30-12-2017')

​/coins​/{id}​/market_chart

const results = await coinGeckoApi.coinMarketChart('bitcoin', {
  vs_currency: 'usd',
  days: '1'
})

​/coins​/{id}​/market_chart​/range

const results = await coinGeckoApi.coinMarketChartRange('bitcoin', {
  vs_currency: 'usd',
  from: '1392577232',
  to: '1422577232'
})

​/coins​/{id}​/ohlc

const results = await coinGeckoApi.coinOHLC('bitcoin', {
  vs_currency: 'usd',
  days: 7
})

/coins​/{id}​/contract​/{contract_address}

const results = await coinGeckoApi.contractInformation(
  'binance-smart-chain',
  '0x00'
)

/coins​/{id}​/contract​/{contract_address}​/market_chart​/

const results = await coinGeckoApi.contractMarketChart(
  'binance-smart-chain',
  '0x00',
  {
    vs_currency: 'usd',
    days: '1'
  }
)

/coins​/{id}​/contract​/{contract_address}​/market_chart​/range

const results = await coinGeckoApi.contractMarketChartRange(
  'binance-smart-chain',
  '0x00',
  {
    vs_currency: 'usd',
    from: '1619881896',
    to: '1619968296'
  }
)

/asset_platforms

const results = await coinGeckoApi.assetPlatforms()

/coins​/categories​/list

const results = await coinGeckoApi.categoriesList()

/coins​/categories

const results = await coinGeckoApi.categoriesListMarketData()

/exchanges

const results = await coinGeckoApi.exchangesList()

/exchanges​/list

const results = await coinGeckoApi.exchangesList()

/exchanges​/{id}

const results = await coinGeckoApi.exchangesById('binance')

/exchanges​/{id}​/tickers

const results = await coinGeckoApi.exchangeTickers('binance')

/exchanges​/{id}​/volume_chart

const results = await coinGeckoApi.exchangesVolumeChart('binance', 1)

Contributions

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.

:coffee: :coffee:

Keywords

bitcoin

FAQs

Package last updated on 10 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.