From 083e1fb0f57a12443733179fc7af6f5f937c52ff Mon Sep 17 00:00:00 2001
From: Release Bot The tool is installed a long with the The export tool requires access to a CoinMetrics API key, and is accessed with the environment variable To confirm the tool is installed correct execute the command
+
+ Changelog2024.12.16.21¶
Added¶
+
+time_increment
in parallel()
Changed¶
+
+
+2024.12.16.21¶
+Added¶
+
client
API calls2024.12.11.19¶
-Added¶
+Added¶
2024.12.10.20¶
-Changed¶
+Changed¶
reference_data_*().to_dataframe()
return2024.11.21.20¶
-Changed¶
+Changed¶
2024.11.18.19¶
-Changed¶
+Changed¶
@@ -417,17 +434,17 @@ format=json_stream
for catalog
and reference_data
functions by default, drastically improving speedFixed&
2024.10.15.19¶
-Changed¶
+Changed¶
2024.10.9.20¶
-Added¶
+Added¶
txids
as a valid parallelize_on
variable2024.10.4.15¶
-Added¶
+Added¶
@@ -436,7 +453,7 @@ catalog_*_v2().to_dataframe()
that flattens these dataframesFixed2024.9.18.17¶
-
Added¶
+Added¶
@@ -449,12 +466,12 @@ FixedAdded¶
+Added¶
base_native
and quote_native
fields to reference_data_markets()
2024.8.20.13¶
-Changed¶
+Changed¶
@@ -463,28 +480,28 @@ on_error
for CmStream
defaultRemovedAdded¶
+Added¶
catalog
deprecation2024.8.14.17¶
-Added¶
+Added¶
txid
, accounts
, block_hashes
, heights
, and sub_accounts
as valid parallel
variablesheight_increment
as a valid parallel
parameter2024.8.5.13¶
-Added¶
+Added¶
to_dataframe()
call for reference_data_*
and security_master_*
functions2024.7.12.14¶
-Added¶
+Added¶
2024.2.6.16¶
-Added¶
+Added¶
get_market_funding_rates_predicted
, catalog_{full}_market_funding_rates_predicted_v2
Fixed2023.11.27.17¶
-
Added¶
+Added¶
-blockchain_metadata_tags()
and blockchain_metadata_tagged_entities
functionsChanged¶
+Changed¶
2023.11.13.14¶
-Added¶
+Added¶
get_snapshots_of_asset_metric_constituents
and get_timeframes_of_asset_metric_constituents
2023.10.30.13¶
-Added¶
+Added¶
get_stream_market_open_interest
2023.10.19.17¶
-Added¶
+Added¶
get_stream_market_liquidations
2023.9.29.14¶
-Added¶
+Added¶
metrics
parameter to catalog_{full}_markets_v2
catalog_index_levels_v2
and reference_data_markets
2023.9.22.21¶
-Added¶
+Added¶
blockchain
endpoints2023.9.11.14¶
-Changed¶
+Changed¶
-frequency
parameter with granularity
for get_market_quotes
and get_market_orderbooks
Added¶
+Added¶
reference_data_assets
, reference_data_indexes
, reference_data_pairs
2023.8.30.20¶
-Added¶
+Added¶
security_master_assets
, security_master_markets
2023.8.28.16¶
-Added¶
+Added¶
catalog_{full}_pair_candles_v2
, catalog_{full}_index_candles_v2
, catalog_{full}_asset_chains_v2
, catalog_{full}_mempool_feerates_v2
, catalog_{full}_mining_pool_tips_summaries_v2
, catalog_{full}_transaction_tracker_assets_v2
2023.8.25.15¶
-Added¶
+Added¶
2023.8.24.13¶
-Added¶
+Added¶
@@ -563,17 +580,17 @@ reference_data_asset_metrics
, reference_data_institution_metrics
Fixed2023.8.22.14¶
-
Added¶
+Added¶
catalog_{full}_asset_metrics_v2
, catalog_exchange_{full}_metrics_v2
, catalog_{full}_exchange_asset_metrics_v2
, catalog_{full}_pair_metrics_v2
, catalog_{full}_institution_metrics_v2
2023.8.10.19¶
-Added¶
+Added¶
on_close
handler to CmStream
2023.7.11.17¶
-Added¶
+Added¶
@@ -584,22 +601,22 @@ catalog_{full}_contract_prices_v2
, catalog_{full}_market_trades_v2
, catalog_{full}_market_candles_v2
, catalog_{full}_market_orderbooks_v2
, catalog_{full}_market_quotes_v2
, catalog_{full}_market_funding_rates_v2
, catalog_{full}_market_contract_prices_v2
, catalog_{full}_market_implied_volatility_v2
, catalog_{full}_market_greeks_v2
, catalog_{full}_market_open_interest
, catalog_{full}_market_liquidations_v2
, catalog_{full}_market_metrics_v2
.Fixed2023.5.26.17¶
-
Added¶
+Added¶
2023.5.17.19¶
-Changed¶
+Changed¶
-Added¶
+Added¶
2023.5.2.20¶
-Added¶
+Added¶
Fixed2023.4.24.14¶
-
Added¶
+Added¶
2023.3.16.17¶
-Changed¶
+Changed¶
-Added¶
+Added¶
2023.2.27.22¶
-Added¶
+Added¶
2023.2.23.0¶
-Added¶
+Added¶
2023.1.26.23¶
-Added¶
+Added¶
2023.1.10.21¶
-Added¶
+Added¶
Added2022.11.14.16¶
-
Changed¶
+Changed¶
2022.11.3.18¶
-Added¶
+Added¶
Fixed2022.10.18.18¶
-
Changed¶
+Changed¶
2022.10.14.20¶
-Added¶
+Added¶
Authorization for flat files down
Installation and set up¶
coinmetrics-api-client
, it's recommended to create a new Python [virtual environment]
for your project and install the package: python -m venv .venv
+
+pip install coinmetrics-api-client
+python -m venv .venv
source .venv/bin/activate
-pip install coinmetrics-api-client
CM_API_KEY
,
the easiest way to set this is to run export CM_API_KEY=<API_KEY>
in your terminal on MacOS/Linux or just set CM_API_KEY=<API_KEY>
on Windows. Additionally, you have the option of passing it in which each command instead.coinmetrics export --help
which brings up relevant
documentation. At the bottom of the help message all the available commands are shown:
-Commands:
+
Further documentation is available on any of the commands by running coinmetrics export <command> --help
, for example
running coinmetrics export market-trades-spot --help
prints:
-
Usage: coinmetrics export market-trades-spot [OPTIONS] EXCHANGES [START_DATE]:
+Usage: coinmetrics export market-trades-spot [OPTIONS] EXCHANGES [START_DATE]:
[%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m
-%d %H:%M:%S] [END_DATE]:[%Y-%m-%
d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d
@@ -141,12 +143,12 @@ Exporting Market Trades Files¶
If you want to get the flat files for spot-market-trades from coinbase and binance for the first 5 days of June 2022:
coinmetrics export market-trades-spot binance,coinbase 2022-06-01 2022-06-05
In your current directory you will see:
-
market-trades-spot
+market-trades-spot
├── binance
│ ├── 2022-06-01.json.gz
│ ├── 2022-06-02.json.gz
@@ -158,7 +160,8 @@ Example:gzipped json files - they are compressed in
order to take up less space. If you instead wish to download the data as a csv or json you can use:
coinmetrics export market-trades-spot binance,coinbase 2022-06-01 2022-06-05 --output-format csv
@@ -183,7 +186,7 @@ Exporting market candlesExample to download 5m spot market candles for coinbase and binance for a date range:
coinmetrics export market-candles-spot 5m coinbase,binance 2022-01-01 2022-01-05
Which creates these files:
-market-candles-spot-5m
+market-candles-spot-5m
├── binance
│ ├── 2022-01-01.json.gz
│ ├── 2022-01-02.json.gz
@@ -195,7 +198,8 @@ Exporting market candles
+ └── 2022-01-05.json.gz
+
The functionality is the same for market-candles-future
Using API Key without setting an environment variable¶
If you don't wish to put your CoinMetrics API key in your environment, you may also pass it in with any command with the
@@ -209,21 +213,22 @@
Downloading files in parallelUsing the CoinMetricsDataExporter in Python instead of CLI¶
Depending on the use case it might be more convenient to use the CoinMetricsDataExporter directly in Python rather than
-from the CLI. There is several examples in the examples/file_downloads directory
. Below is one example.
-
from coinmetrics.data_exporter import CoinMetricsDataExporter
-from datetime import datetime
+from the CLI. There is several examples here as well as one below:
+from coinmetrics.data_exporter import CoinMetricsDataExporter
+from datetime import datetime
-CM_API_KEY = "<YOUR_API_KEY>"
-data_exporter = CoinMetricsDataExporter(api_key=CM_API_KEY)
+CM_API_KEY = "<YOUR_API_KEY>"
+data_exporter = CoinMetricsDataExporter(api_key=CM_API_KEY)
-if __name__ == "__main__":
- """
- This script will export all the daily market-trades-spot files for Coinbase and Gemini for the month of January
- """
- start_date = datetime(2019, 1, 1)
- end_date = datetime(2019, 1, 31)
- exchanges = ["coinbase","gemini"]
- data_exporter.export_market_trades_spot_data(start_date=start_date, end_date=end_date, exchanges=exchanges, threaded=True)
+if __name__ == "__main__":
+ """
+ This script will export all the daily market-trades-spot files for Coinbase and Gemini for the month of January
+ """
+ start_date = datetime(2019, 1, 1)
+ end_date = datetime(2019, 1, 31)
+ exchanges = ["coinbase","gemini"]
+ data_exporter.export_market_trades_spot_data(start_date=start_date, end_date=end_date, exchanges=exchanges, threaded=True)
+