Created
November 25, 2021 11:16
-
-
Save ljw-612/1935b66272d9e3331258cec5ca9f7cb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install the API package | |
!pip install coinmetrics-api-client | |
# Import necessary packages | |
import pandas as pd | |
from coinmetrics.api_client import CoinMetricsClient | |
from os import environ | |
# Create a client use the community API key | |
client = CoinMetricsClient() | |
# Get the data we want. | |
# 1. Specify the market to be 'coinbase-btc-usd-spot' | |
# 2. Specify the start time and the end time | |
trades = client.get_market_trades( | |
markets='coinbase-btc-usd-spot', | |
start_time='2021-11-24T22:50:00Z', | |
end_time='2021-11-24T23:00:00Z' | |
# limit_per_market=50 | |
) | |
trades_df = trades.to_dataframe() | |
trades_df = trades_df.reindex(index=trades_df.index[::-1]) | |
trades_df.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment