Parfournir.
Skills/CoinGecko/CoinGecko API

CoinGecko API

Crypto market data API — token prices, charts, market cap, volume, exchange data, and trending tokens across all chains.

MITsdk
by @CoinGecko
Install
pip
pip install pycoingecko
SKILL.md

CoinGecko API wrapper

![PyPi Version](https://pypi.python.org/pypi/pycoingecko/)
!GitHub

Python3 wrapper around the CoinGecko API (V3) 🦎<br> Supports both Public and Pro API:
* Public API v3.0.1
* Pro API v3.1.1

Installation


PyPI
pip install -U pycoingecko
or from source
git clone https://github.com/man-c/pycoingecko.git
cd pycoingecko
python3 setup.py install

Usage

For free Public API:

* without any demo api key (x-cg-demo-api-key):

    from pycoingecko import CoinGeckoAPI
cg = CoinGeckoAPI()
* 🔑 with a <ins>demo api key</ins>:
    from pycoingecko import CoinGeckoAPI
cg = CoinGeckoAPI(demo_api_key='YOUR_DEMO_API_KEY')

For Pro API:
* 🔑 with a <ins>pro api key</ins>:

    from pycoingecko import CoinGeckoAPI
cg = CoinGeckoAPI(api_key='YOUR_PRO_API_KEY')

Examples


The required parameters for each endpoint are defined as required (mandatory) parameters for the corresponding functions.\ Any optional parameters can be passed using same names, as defined in CoinGecko API doc (https://www.coingecko.com/en/api/documentation).

For any parameter:

  • *Lists are supported as input for multiple-valued comma-separated parameters\

  • (e.g. see /simple/price usage examples).*
  • *Booleans are supported as input for boolean type parameters; they can be str ('true', 'false'') or bool (True, False)\

  • (e.g. see /simple/price usage examples).*

    Usage examples:
    ```python

    /simple/price endpoint with the required parameters


    >>> cg.get_price(ids='bitcoin', vs_currencies='usd')
    {'bitcoin': {'usd': 3462.04}}

    >>> cg.get_price(ids='bitcoin,litecoin,ethereum', vs_currencies='usd')

    OR (lists can be used for multiple-valued arguments)


    >>> cg.get_price(ids=['bitcoin', 'litecoin', 'ethereum'], vs_currencies='usd')
    {'bitcoin': {'usd': 3461.27}, 'ethereum': {'usd': 106.92}, 'litecoin': {'usd': 32.72}}

    >>> cg.get_price(ids='bitcoin,litecoin,ethereum', vs_currencies='usd,eur')

    OR (lists can be used for multiple-valued arguments)


    >>> cg.get_price(ids=['bitcoin', 'litecoin', 'ethereum'], vs_currencies=['usd', 'eur'])
    {'bitcoin': {'usd': 3459.39, 'eur': 3019.33}, 'ethereum': {'usd': 106.91, 'eur': 93.31}, 'litecoin': {'usd': 32.72, 'eur': 28.56}}

    optional parameters can be passed as defined in the API doc (https://www.coingecko.com/api/docs/v3)


    >>> cg.get_price(ids='bitcoin', vs_currencies='usd', include_market_cap='true', include_24hr_vol='true', include_24hr_change='true', include_last_updated_at='true')
    {'bitcoin': {'usd': 3458.74, 'usd_market_cap': 60574330199.29028, 'usd_24h_vol': 4182664683.6247883, 'usd_24h_change': 1.2295378479069035, 'last_updated_at': 1549071

    ... [truncated — view full README on GitHub]

    Details

    Categoryblockchain
    Typesdk
    Sourcegithub
    LicenseMIT

    Runtime Requirements

    Environment variablesYOUR_DEMO_API_KEYYOUR_PRO_API_KEY

    Use this skill

    Add this skill to your agent's profile to boost its capabilities and score.

    Add to My Agent