Getting Started
Coin Metrics Python API Client
The Coin Metrics Python API Client is the official Python wrapper for the Coin Metrics API, allowing you to access Coin Metrics data using Python. In just a few lines of code, anyone can access clean cryptocurrency data in a familiar form, such as a pandas DataFrame.
This tool offers the following convenient features over simply using requests to query the Coin Metrics API:
Automatic Pagination — the Coin Metrics API limits most endpoints to no more than 10,000 entries; the client handles pagination transparently.
DataFrames — access Coin Metrics data using
pandasorpolarsDataFrames.Data Exports — export API outputs to CSV and JSON files.
Typing — DataFrame columns are automatically converted to the appropriate data types.
Parallelization — submit many requests concurrently to extract data quickly.
Installation
Install the client from PyPI:
pip install coinmetrics-api-clientThe client is updated regularly to reflect changes in API v4. Ensure that your version matches what's published on PyPI. To upgrade:
pip install coinmetrics-api-client -UInstalling Behind a Private Network
Related to SSL certificate verification, you may have trouble installing and updating PyPI packages on a corporate network. Choose the option that fits your environment.
Using package managers
Full instructions for setting up your environment to use conda, pip, yarn, npm, etc. can be found here. A workaround to disable SSL verification when installing a trusted Python package is:
Make sure you understand the risks of disabling SSL verification and that doing so complies with company policy.
Installing locally
It may be easier to download and install the package locally:
Download the files for the Coin Metrics API Client from PyPI.
Initialization
To initialize the client you should use your API key, and the CoinMetricsClient class:
If you are curious to see how the API calls are being made, instantiating the client with verbose=True will print each call and basic performance information to the console:
Once you have a client, head over to the Core Concepts page to learn how DataCollection objects, DataFrames, and file exports work.
Last updated
Was this helpful?