examples/py/playing_with_ccxt_example.ipynb
!pip install ccxt
import ccxt
# Load Exchange
exchange = ccxt.gate ()
exchange.load_markets ()
print ('exchange: %d markets loaded!' % len (exchange.markets))
# Enables 2x resolution for Retina displays
%config InlineBackend.figure_format = 'retina'
# This is the library we will use for chart drawing
import matplotlib.pyplot as plt
# Configure the look
plt.style.use ('seaborn-white')
plt.rcParams["figure.figsize"] = [15,6]
import pandas as pd
from datetime import datetime
pair = 'ETH/USDT'
# Load OHLCV (open/high/low/close/volume) data with 1-day resolution
ohlcv = exchange.fetch_ohlcv (pair, '1d')
# Get closing prices for each day
prices = [x[4] for x in ohlcv]
# Convert Unix timestamps to Python dates
dates = [datetime.fromtimestamp (x[0] // 1000) for x in ohlcv]
# Prepare a Pandas series object
data = pd.Series (prices, index=dates)
# Draw a simple line chart
data.plot ()