coinmetrics-api-client


Namecoinmetrics-api-client JSON
Version 2021.5.6.22.7 PyPI version JSON
download
home_pagehttps://coinmetrics-io.github.io/api-client-python/site/index.html
SummaryPython client for Coin Metrics API v4.
upload_time2021-05-06 21:12:21
maintainer
docs_urlNone
authorCoin Metrics
requires_python>=3.6,<4.0
licenseMIT
keywords coin metrics coin metrics crypto bitcoin network-data market-data api handy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Coin Metrics Python API v4 client library

This is an official Python API client for Coin Metrics API v4.

## Installation
To install the client you can run the following command:
```
pip install coinmetrics-api-client
```


## Introduction
You can use this client for querying all kinds of data with your API.

To initialize the client you should use your API key, and the CoinMetricsClient class like the following.
```
from coinmetrics.api_client import CoinMetricsClient

client = CoinMetricsClient(environ.get("CM_API_KEY"))

# or to use community API:
client = CoinMetricsClient()
```

After that you can use the client object for getting stuff like available markets:
```
print(client.catalog_markets())
```

or to query all available assets along with what is available for those assets, like metrics, markets:

```
print(client.catalog_assets())
```


you can also use filters for the catalog endpoints like this:

```
print(client.catalog_assets(assets=['btc']))
```
in this case you would get all the information for btc only

You can use this client to connect to our API v4 and get catalog or timeseries data from python environment. It natively supports paging over the data so you can use it to iterate over timeseries entries seamlessly.

The client can be used to query both pro and community data.

## Getting timeseries data

For getting timeseries data you want to use methods of the client class that start with `get_`.

For example if you want to get a bunch of market data trades for coinbase btc-usd pair you can run something similar to the following:

```
for trade in client.get_market_trades(markets='coinbase-btc-usd-spot', 
                                      start_time='2020-01-01', end_time='2020-01-03'):
    print(trade)
```

Or if you want to see daily btc asset metrics you can use something like this:

```
for metric_data in client.get_asset_metrics(assets='btc', 
                                            metrics=['ReferenceRateUSD', 'BlkHgt', 'AdrActCnt',  
                                                     'AdrActRecCnt', 'FlowOutBFXUSD'], 
                                            frequency='1d'):
    print(metric_data)
```
This will print you the requested metrics for all the days where we have any of the metrics present. 

### Paging
You can make the datapoints to iterate from start or from end (default).

for that you should use a paging_from argument like the following:
```
from coinmetrics.api_client import CoinMetricsClient
from coinmetrics.constants import PagingFrom

client = CoinMetricsClient()

for metric_data in client.get_asset_metrics(assets='btc', metrics=['ReferenceRateUSD'],
                                            paging_from=PagingFrom.START):
    print(metric_data)
```

PagingFrom.END: is available but it is also a default value also, so you might not want to set it.

## Extended documentation
For more information about the available methods in the client please reference [API Client Spec]([https://coinmetrics-io.github.io/api-client-python/site/api_client.html])

            

Raw data

            {
    "_id": null,
    "home_page": "https://coinmetrics-io.github.io/api-client-python/site/index.html",
    "name": "coinmetrics-api-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6,<4.0",
    "maintainer_email": "",
    "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/60/20/e9ff91117906c9cde69296dd104a6727f72c9a3e210a1ded004ab2e09d5c/coinmetrics-api-client-2021.5.6.22.7.tar.gz",
    "platform": "",
    "description": "# Coin Metrics Python API v4 client library\n\nThis is an official Python API client for Coin Metrics API v4.\n\n## Installation\nTo install the client you can run the following command:\n```\npip install coinmetrics-api-client\n```\n\n\n## Introduction\nYou can use this client for querying all kinds of data with your API.\n\nTo initialize the client you should use your API key, and the CoinMetricsClient class like the following.\n```\nfrom coinmetrics.api_client import CoinMetricsClient\n\nclient = CoinMetricsClient(environ.get(\"CM_API_KEY\"))\n\n# or to use community API:\nclient = CoinMetricsClient()\n```\n\nAfter that you can use the client object for getting stuff like available markets:\n```\nprint(client.catalog_markets())\n```\n\nor to query all available assets along with what is available for those assets, like metrics, markets:\n\n```\nprint(client.catalog_assets())\n```\n\n\nyou can also use filters for the catalog endpoints like this:\n\n```\nprint(client.catalog_assets(assets=['btc']))\n```\nin this case you would get all the information for btc only\n\nYou can use this client to connect to our API v4 and get catalog or timeseries data from python environment. It natively supports paging over the data so you can use it to iterate over timeseries entries seamlessly.\n\nThe client can be used to query both pro and community data.\n\n## Getting timeseries data\n\nFor getting timeseries data you want to use methods of the client class that start with `get_`.\n\nFor example if you want to get a bunch of market data trades for coinbase btc-usd pair you can run something similar to the following:\n\n```\nfor trade in client.get_market_trades(markets='coinbase-btc-usd-spot', \n                                      start_time='2020-01-01', end_time='2020-01-03'):\n    print(trade)\n```\n\nOr if you want to see daily btc asset metrics you can use something like this:\n\n```\nfor metric_data in client.get_asset_metrics(assets='btc', \n                                            metrics=['ReferenceRateUSD', 'BlkHgt', 'AdrActCnt',  \n                                                     'AdrActRecCnt', 'FlowOutBFXUSD'], \n                                            frequency='1d'):\n    print(metric_data)\n```\nThis will print you the requested metrics for all the days where we have any of the metrics present. \n\n### Paging\nYou can make the datapoints to iterate from start or from end (default).\n\nfor that you should use a paging_from argument like the following:\n```\nfrom coinmetrics.api_client import CoinMetricsClient\nfrom coinmetrics.constants import PagingFrom\n\nclient = CoinMetricsClient()\n\nfor metric_data in client.get_asset_metrics(assets='btc', metrics=['ReferenceRateUSD'],\n                                            paging_from=PagingFrom.START):\n    print(metric_data)\n```\n\nPagingFrom.END: is available but it is also a default value also, so you might not want to set it.\n\n## Extended documentation\nFor more information about the available methods in the client please reference [API Client Spec]([https://coinmetrics-io.github.io/api-client-python/site/api_client.html])\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python client for Coin Metrics API v4.",
    "version": "2021.5.6.22.7",
    "split_keywords": [
        "coin metrics",
        "coin",
        "metrics",
        "crypto",
        "bitcoin",
        "network-data",
        "market-data",
        "api",
        "handy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "84bc0e7842fd65a878886c3ccc6df947",
                "sha256": "83c7372da5868dd23848a7daca7ed858fcebc17bc27e197aa282d18a8396f01c"
            },
            "downloads": -1,
            "filename": "coinmetrics_api_client-2021.5.6.22.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "84bc0e7842fd65a878886c3ccc6df947",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<4.0",
            "size": 9793,
            "upload_time": "2021-05-06T21:12:24",
            "upload_time_iso_8601": "2021-05-06T21:12:24.154783Z",
            "url": "https://files.pythonhosted.org/packages/20/13/ec1bce92dafe490e7e66e1d834d660a507981731c774b52a331cc545249b/coinmetrics_api_client-2021.5.6.22.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "0ea3067cecf4abeb0035cb73019bfc82",
                "sha256": "78235bd229bd4d7888ecd558d43ab62190e5d1e9221183eaaa97882338e8e397"
            },
            "downloads": -1,
            "filename": "coinmetrics-api-client-2021.5.6.22.7.tar.gz",
            "has_sig": false,
            "md5_digest": "0ea3067cecf4abeb0035cb73019bfc82",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6,<4.0",
            "size": 8570,
            "upload_time": "2021-05-06T21:12:21",
            "upload_time_iso_8601": "2021-05-06T21:12:21.867462Z",
            "url": "https://files.pythonhosted.org/packages/60/20/e9ff91117906c9cde69296dd104a6727f72c9a3e210a1ded004ab2e09d5c/coinmetrics-api-client-2021.5.6.22.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-05-06 21:12:21",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "coinmetrics-api-client"
}
        
Elapsed time: 0.27028s