This article aims to introduce the power of python coding in the cryptocurrency market analysis. If you are a trader and have some experience in crypto trading, you probably know time is very important in terms of catching trade opportunities. This is because of high volatile crypto market nature which causes severe price fluctuations.So, as a trader, you should be aware of such fluctuations and find the best entry point to trade.
Regardless of your trading strategy, you always need to know which pair satisfies your strategy’s criteria. In a exchange like Binance, you must search and evaluate more than 400 pairs to find the probable long or short positions.
In this tutorial, I will show you how to code a very simple application to filter pairs which fit into your strategy and save time.
To start, some assumptions need to be taken:
۱- We will use Binance Exchange API to get the market data.
۲- The coding samples are represented for Python3.6.
۳- Basic knowledge about python programming and trading indicators is preferable.
۴- Challenge is to search and filter pairs which those SMA_۳ is higher than SMA_۹.
Binance CryptocurrencyExchange serves very powerful API to get the market data. This API service is free for everyone who signs up in Binance. For this tutorial, it is not really important which exchange you prefer to work with, we just need OHLCV (Open, High, Low, Close, Volume) data to calculate Moving Average indicators.
After you generate and fetch the API keys from Binance (Go to API section in your Binance profile and generate a new key) you will have:
API Key: ************************
API Secret: ******************
These keys are a bunch of characters and symbols.
For python coding we need just Binance library:
Python-binance:pip install python-binance
OK let’s dive in to the coding:
First we need to connect our python to the Binance Core Market:
Insert your API and API Secret keys in the Client function. You’ve generate these keys in your Binance Account.
Next we need to have all of the pairs which are being traded in the Binance, there are lots of ways to get the pair list but let’s have below solution to get all of the pair list:
By this function client.get_all_tickers() you will have real time prices in a list of dictionaries: