Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michael-siek/coingecko-api
An open-source TypeScript wrapper for the the CoinGecko API
https://github.com/michael-siek/coingecko-api
bitcoin cryptocurrency ethereum nodejs
Last synced: about 1 month ago
JSON representation
An open-source TypeScript wrapper for the the CoinGecko API
- Host: GitHub
- URL: https://github.com/michael-siek/coingecko-api
- Owner: michael-siek
- License: mpl-2.0
- Created: 2021-07-17T20:13:32.000Z (over 3 years ago)
- Default Branch: develop
- Last Pushed: 2023-06-30T00:48:40.000Z (over 1 year ago)
- Last Synced: 2024-10-07T16:46:06.740Z (about 1 month ago)
- Topics: bitcoin, cryptocurrency, ethereum, nodejs
- Language: TypeScript
- Homepage:
- Size: 151 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# CoinGecko API TypeScript Wrapper
[![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/package/@crypto-coffee/coingecko-api)> An open-source TypeScript wrapper for the the CoinGecko API
[Coingecko API Documentation](https://www.coingecko.com/en/api/documentation)
## Installation
```console
npm install @crypto-coffee/coingecko-api
```## Usage Example
```js
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`
```js
const result = await coinGeckoApi.ping()
```### `/simple/price`
```js
// 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}`
```js
// 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`
```js
const results = await coinGeckoApi.supportedCurrencies()
```### `/coins/list`
```js
const results = await coinGeckoApi.coinList()
```### `/coins/markets`
```js
const results = await coinGeckoApi.coinMarkets({ vs_currency: 'usd' })
```### `/coins/{id}`
```js
const results = await coinGeckoApi.coinMarkets({ id: 'bitcoin' })
```### `/coins/{id}/tickers`
```js
const results = await coinGeckoApi.coinTickers('bitcoin', {
exchange_ids: 'binance'
})const { data, request } = await coinGeckoApi.coinTickers('bitcoin', {
exchange_ids: 'binance'
})
```### `/coins/{id}/history`
```js
const results = await coinGeckoApi.coinHistory('bitcoin', '30-12-2017', {
localization: false
})
const results = await coinGeckoApi.coinHistory('bitcoin', '30-12-2017')
```### `/coins/{id}/market_chart`
```js
const results = await coinGeckoApi.coinMarketChart('bitcoin', {
vs_currency: 'usd',
days: '1'
})
```### `/coins/{id}/market_chart/range`
```js
const results = await coinGeckoApi.coinMarketChartRange('bitcoin', {
vs_currency: 'usd',
from: '1392577232',
to: '1422577232'
})
```### `/coins/{id}/ohlc`
```js
const results = await coinGeckoApi.coinOHLC('bitcoin', {
vs_currency: 'usd',
days: 7
})
```
### `/coins/{id}/contract/{contract_address}`
```js
const results = await coinGeckoApi.contractInformation(
'binance-smart-chain',
'0x00'
)
```### `/coins/{id}/contract/{contract_address}/market_chart/`
```js
const results = await coinGeckoApi.contractMarketChart(
'binance-smart-chain',
'0x00',
{
vs_currency: 'usd',
days: '1'
}
)
```### `/coins/{id}/contract/{contract_address}/market_chart/range`
```js
const results = await coinGeckoApi.contractMarketChartRange(
'binance-smart-chain',
'0x00',
{
vs_currency: 'usd',
from: '1619881896',
to: '1619968296'
}
)
```### `/asset_platforms`
```js
const results = await coinGeckoApi.assetPlatforms()
```### `/coins/categories/list`
```js
const results = await coinGeckoApi.categoriesList()
```### `/coins/categories`
```js
const results = await coinGeckoApi.categoriesListMarketData()
```### `/exchanges`
```js
const results = await coinGeckoApi.exchangesList()
```### `/exchanges/list`
```js
const results = await coinGeckoApi.exchangesList()
```### `/exchanges/{id}`
```js
const results = await coinGeckoApi.exchangesById('binance')
```### `/exchanges/{id}/tickers`
```js
const results = await coinGeckoApi.exchangeTickers('binance')
```### `/exchanges/{id}/volume_chart`
```js
const results = await coinGeckoApi.exchangesVolumeChart('binance', 1)
```### Contributions
This package is maintained by [Zidious](https://github.com/Zidious)(Gabe) and [Michael](https://github.com/michael-siek). 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: