Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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