Playing With CCXT In Google Colab

CCXT
CCXT
Published in
2 min readJul 25, 2018

Hello world, it’s CCXT. This is the first blog post in our series! Today we will examine Google Colab and how useful it can be for quick prototyping and testing your ideas.

Google Colab is basically a cloud version of Jupyter Notebooks — a tool well-known among data scientists and ML specialists. It allows to write code in Python and see the result immediately — either in plain text or structured into sophisticated tables with graphics, backed by an enormous count of useful Python libraries for data crunching and visualization.

Start by creating a new Python 3 notebook:

Then type this (and press Shift-Enter to execute the code):

!pip install ccxt

This will install CCXT for us to simply import it and play around. Write the following in a new code paragraph, to avoid executing the previous command every time:

import ccxtbinance = ccxt.binance () # Loads Binance
binance.load_markets ()
print ('binance: %d markets loaded!' % len (binance.markets))

Again, press Shift-Enter to execute. The above code will load all available markets from Binance. Now, let’s fetch historical ETH/USDT prices and draw them in a simple chart? Easy!

First, prepare the Python chart drawing library, for big sharp-looking graphics with 2x pixel resolution and nice colours:

%config InlineBackend.figure_format = 'retina'import matplotlib.pyplot as pltplt.style.use ('seaborn-white')
plt.rcParams["figure.figsize"] = [15,6]

Then load the data from Binance and feed it to the chart drawing library with minimal preprocessing:

Thanks for reading! You can play with the working example project here:

👇👇👇

colab.research.google.com/drive/1nOwdbhR2DvTkieRiqSIV-j5Bp-ztZ70W

--

--