<h1 align="center"><b>Coin Metrics Python API Client</b></h1>
<p align="center">
<img src="assets/images/cm-dark-combination.png">
</p>
The **Coin Metrics Python API Client** is the official Python wrapper for the [Coin Metrics API](https://docs.coinmetrics.io/api/v4), allowing you to access [Coin Metrics data](https://docs.coinmetrics.io/) 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, requiring users to handle pagination. The Python API Client handles this automatically.
- **DataFrames**. Users may access Coin Metrics data using pandas DataFrames and potentially other data structures, such as polars.
- **Data Exports**. Users may export API outputs to CSV and JSON files.
- **Typing**. DataFrames are automatically converted to the appropriate data types.
- **Parallelization**. Users may submit many requests at once to extract data much more quickly than sending one request at a time.
# Getting Started
## Installation and Updates
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](https://docs.coinmetrics.io/api/v4). Ensure that your latest version matches with what's in [pyPI](https://pypi.org/project/coinmetrics-api-client/)
To update your version, run the following command:
```
pip install coinmetrics-api-client -U
```
## Initialization
To initialize the client you should use your API key, and the CoinMetricsClient class like the following.
```python
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()
```
Raw data
{
"_id": null,
"home_page": "https://coinmetrics.github.io/api-client-python/site/index.html",
"name": "coinmetrics-api-client",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.9.0",
"maintainer_email": null,
"keywords": "coin metrics, coin, metrics, crypto, bitcoin, network-data, market-data, api, handy",
"author": "Coin Metrics",
"author_email": "info@coinmetrics.io",
"download_url": "https://files.pythonhosted.org/packages/30/1b/411e8d050d98252258161988fb238c74576ce52f6dbe30c0044e906b1ed0/coinmetrics_api_client-2025.2.4.18.tar.gz",
"platform": null,
"description": "<h1 align=\"center\"><b>Coin Metrics Python API Client</b></h1>\n\n<p align=\"center\">\n <img src=\"assets/images/cm-dark-combination.png\">\n</p>\n\nThe **Coin Metrics Python API Client** is the official Python wrapper for the [Coin Metrics API](https://docs.coinmetrics.io/api/v4), allowing you to access [Coin Metrics data](https://docs.coinmetrics.io/) using Python. In just a few lines of code, anyone can access clean cryptocurrency data in a familiar form, such as a pandas dataframe.\n\nThis tool offers the following convenient features over simply using `requests` to query the Coin Metrics API:\n\n- **Automatic Pagination**. The Coin Metrics API limits most endpoints to no more than 10,000 entries, requiring users to handle pagination. The Python API Client handles this automatically.\n- **DataFrames**. Users may access Coin Metrics data using pandas DataFrames and potentially other data structures, such as polars.\n- **Data Exports**. Users may export API outputs to CSV and JSON files.\n- **Typing**. DataFrames are automatically converted to the appropriate data types.\n- **Parallelization**. Users may submit many requests at once to extract data much more quickly than sending one request at a time.\n\n\n# Getting Started\n\n## Installation and Updates\nTo install the client you can run the following command:\n```\npip install coinmetrics-api-client\n```\n\nNote that the client is updated regularly to reflect the changes made in [API v4](https://docs.coinmetrics.io/api/v4). Ensure that your latest version matches with what's in [pyPI](https://pypi.org/project/coinmetrics-api-client/) \n\nTo update your version, run the following command:\n```\npip install coinmetrics-api-client -U\n```\n\n## Initialization\n\nTo initialize the client you should use your API key, and the CoinMetricsClient class like the following.\n```python\nfrom coinmetrics.api_client import CoinMetricsClient\nimport os\n\n# we recommend storing your Coin Metrics API key in an environment variable\napi_key = os.environ.get(\"CM_API_KEY\")\nclient = CoinMetricsClient(api_key)\n\n# or to use community API:\nclient = CoinMetricsClient()\n```",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python client for Coin Metrics API v4.",
"version": "2025.2.4.18",
"project_urls": {
"Documentation": "https://coinmetrics.github.io/api-client-python/site/index.html",
"Homepage": "https://coinmetrics.github.io/api-client-python/site/index.html",
"Repository": "https://github.com/coinmetrics/api-client-python"
},
"split_keywords": [
"coin metrics",
" coin",
" metrics",
" crypto",
" bitcoin",
" network-data",
" market-data",
" api",
" handy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5f30b880274e9df620ad3cad6d58df3d072c4b3b3a8e46b3b2400b8852872919",
"md5": "f46682d262e234ee7ec73474e5b610f7",
"sha256": "ec47dba9fe51747548a0149587da6de3d4dccfae65bd7974ec52a1cb6a5849cf"
},
"downloads": -1,
"filename": "coinmetrics_api_client-2025.2.4.18-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f46682d262e234ee7ec73474e5b610f7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.9.0",
"size": 50090,
"upload_time": "2025-02-04T18:23:21",
"upload_time_iso_8601": "2025-02-04T18:23:21.134555Z",
"url": "https://files.pythonhosted.org/packages/5f/30/b880274e9df620ad3cad6d58df3d072c4b3b3a8e46b3b2400b8852872919/coinmetrics_api_client-2025.2.4.18-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "301b411e8d050d98252258161988fb238c74576ce52f6dbe30c0044e906b1ed0",
"md5": "b8c87c78d6074c3b654df9ff70cab559",
"sha256": "8a650a61877377bf1ef965ac6fb13f4850b4e32cc9008498d383f672c77e6387"
},
"downloads": -1,
"filename": "coinmetrics_api_client-2025.2.4.18.tar.gz",
"has_sig": false,
"md5_digest": "b8c87c78d6074c3b654df9ff70cab559",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.9.0",
"size": 66993,
"upload_time": "2025-02-04T18:23:23",
"upload_time_iso_8601": "2025-02-04T18:23:23.211175Z",
"url": "https://files.pythonhosted.org/packages/30/1b/411e8d050d98252258161988fb238c74576ce52f6dbe30c0044e906b1ed0/coinmetrics_api_client-2025.2.4.18.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-04 18:23:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "coinmetrics",
"github_project": "api-client-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "certifi",
"specs": [
[
"==",
"2021.10.8"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"2.0.12"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.3"
]
]
},
{
"name": "orjson",
"specs": [
[
"==",
"3.6.7"
]
]
},
{
"name": "python-dateutil",
"specs": [
[
"==",
"2.8.2"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.27.1"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"1.26.8"
]
]
},
{
"name": "websocket-client",
"specs": [
[
"==",
"1.8.0"
]
]
},
{
"name": "typer",
"specs": [
[
">=",
"0.6.1"
]
]
}
],
"lcname": "coinmetrics-api-client"
}