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:
To install the client you can run the following command:
pip install coinmetrics-api-client
Note that the client is updated regularly to reflect the changes made in API v4. Ensure that your latest version matches with what’s in pyPI
To update your version, run the following command:
pip install coinmetrics-api-client -U
To initialize the client you should use your API key, and the CoinMetricsClient class like the following.
from coinmetrics.api_client import CoinMetricsClient
import os
# we recommend storing your Coin Metrics API key in an environment variable
api_key = os.environ.get("CM_API_KEY")
client = CoinMetricsClient(api_key)
# or to use community API:
client = CoinMetricsClient()