Member-only story

Using CCXT for Python to Access Binance, Lykke, and more crypto-APIs

S. K.
3 min readApr 18, 2021

--

I explained how to get started with the python-Binance library accessing the Binance API in my previous article. Now that I have crypto accounts with Binance, Kraken, Coinbase, Lykke, and a few more, I would have to build an individual interface for all of them. Luckily, with CCXT, there seems to be a common interface to all of them. This article gets you started with CCXT on the examples of Binance and Lykke.

Environment Setup

As for every new Python project, I like to dedicate a virtual environment to it:

mkvirtualenv crypto-python
workon crypto-python
pip install ccxt
pip install pandas
pip install plotly

You can read up on how to set up your PyCharm IDE and your Binance account for API use in my other article on the topic. A description of how to obtain your API key for Lykke is available here. Note: with Lykke, you have to create a separate API wall, and you will only have a key — no secret.

I recommend storing your keys in a safe place and, ideally, not your script. Though not extremely safe — I keep my API key in a separate python module(JSON-like) call CryptoAPIKeySecrets. I keep the file one directory down, so I also do not accidentally commit it to GitHub. The file structure I use is like this:

apiKeySecrets={'binance':{
'apiKey':'<key>',
'secret':'<secret>'},
'lykke':{
'apiKey':'<key>',
'secret':''}
}

--

--

No responses yet