Python client for Coin Metrics API v4.
Project description
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.
client = CoinMetricsClient(environ.get("CM_API_KEY"))
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
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=['ReferenceRate', '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.
For more information about the available methods in the client please reference API Client Spec
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for coinmetrics-api-client-2020.7.27.15.17.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd6a523cc164fc9f43d2607fcc8d9d5fc267857beb0b185a04059851114cfbcd |
|
MD5 | 28eeadbeaf45829aaa5399deed916d19 |
|
BLAKE2b-256 | 79d760d82924f6bcbe7fdb7e05f19989f2488f9fe41fa20f0cc999852b50b494 |
Hashes for coinmetrics_api_client-2020.7.27.15.17-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15a29b9cf5742b6695af8183277bece4ee7d9e5b57cadec2712cddc895277a1a |
|
MD5 | 8c11da0b6046b80bfca970ab209054a4 |
|
BLAKE2b-256 | 293457802d590aa5fba0175d6acafa1f68452451c1bb752b4fed8d5a09e1af4e |