Python API wrapper for CoinGecko API
This CoinGecko Python library provides convenient access to CoinGecko API.
Requirements
- Python 3.0+
- requests
Installations
The recommended way to install coingecko API wrapper is via pip
pip install --upgrade coingecko
Quickstart
Before you start, visit coingecko to obtain a demo/paid API key. After that, you can start using the API by:
import coingecko
# Demo API key
client = coingecko.CoinGeckoDemoClient(api_key=<insert_your_demo_api_key>)
# Paid API key
client = coingecko.CoinGeckoProClient(api_key=<insert_your_paid_api_key>)
# Test your API key with ping
response = client.ping.get()
Documentation
For the list of endpoints and information, visit CoinGecko API Documentation
Examples
The default values and parameter namings for each endpoints follows the official documentation.
Making your first API Call, PING!
response = client.ping.get()
# -> {'gecko_says': '(V3) To the Moon!'}
Just want to get price? Simple!
# /simple/price - one coin_id/currency
response = client.simple.get_price(ids='bitcoin', vs_currencies='usd')
# -> {'bitcoin': {'usd': 40067}}
Use List from Python instead of comma separated strings!
# /simple/price - multiple coin_ids (pass in a list of strings)
response = client.simple.get_price(ids=['bitcoin', 'ethereum'], vs_currencies=['usd', 'myr'])
# -> {'bitcoin': {'usd': 40067, 'myr': 189478}, 'ethereum': {'usd': 2223.37, 'myr': 10514.34}}
Use booleans instead of string for "true"/"false"
# /simple/price - pass in booleans instead of string
response = client.simple.get_price(ids='bitcoin', vs_currencies='usd', include_24hr_vol=True)
# -> {'bitcoin': {'usd': 40067, 'usd_24h_vol': 16742608673.077057}}
For precisions, use Integer/Strings
# simple/price - precision accepts integer/string
response = client.simple.get_price(ids='bitcoin', vs_currencies='usd', precision=2)
# -> {'bitcoin': {'usd': 40066.81}}
response = client.simple.get_price(ids='bitcoin', vs_currencies='usd', precision="2")
# {'bitcoin': {'usd': 40066.81}}
Need more examples?
Check out here!
License
The library is available as open source under the terms of the MIT License.
Metadata
Release files for coingecko 0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| coingecko-0.14.tar.gz | 12.0 kB | Without provenance | Details for coingecko-0.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| coingecko-0.14-py3-none-any.whl | Python 3 | none | any | Details for coingecko-0.14-py3-none-any.whl |
Total release size: 30.1 kB
Release files / coingecko-0.14.tar.gz
| Download URL | coingecko-0.14.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d58caed14c701ad16c7a5087d37cbef60b40ffb3338b50dafdd38b3960c68b6b
|
|
BLAKE2b-256 checksum How to use checksums |
cc299f5adbce72be62fafabfcfadaa3412b21baea458d18d890cdf4d4c0a7f62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.10
|
Release files / coingecko-0.14-py3-none-any.whl
| Download URL | coingecko-0.14-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d1115169fd34fdc843e3e4e28caacd37326fbdb461920357709c733ebf81634
|
|
BLAKE2b-256 checksum How to use checksums |
2ee9fa9ec85d53816ce53d2e60d10c2a4c7dfe547e12a9ec3c64a1ef759b0447
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.10
|
Security for coingecko 0.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.