This time I decided to pick up a trendy topic, where I believe I will be able to add a different angle through my expertise and provide a basic guide on how to set up a bot if you are just starting. Since the crypto prices surge more and more, people get lured into understanding more about how the distributed ledger works and consequently their interest in programming languages. Algorithms were strictly reserved for the institutional traders a few years back, but due to technology advancement, faster internet connectivity and availability of open-source projects this strategy is easily accessible to individual traders today.
One of the easiest and hassle-free options is simply to use a third party’s plug-and-play algo. Multiple firms offer their automated trading strategies online, which one can directly connect to a crypto exchange account. It requires no technical skills and can implemented immediately.
For fellas with no programming skills, but enough trading knowledge there are platforms providing the interface with input capability. After choosing all the trading rules, the platform will process it and generate it in a code form, which can be connected to the crypto exchange.
Step 1: Picking the exchange, API and trading instruments
You need to make sure that the exchange you will be trading at has a public API (I would recommend using FIX, which is faster than REST, more scalable and used for pro trading in conventional markets as well) and build your code according to it and not the other way around. Additionally, choosing your investment products range by checking on their daily volumes and volatility.
Step 2: Choosing where to host your bot
The crypto markets are open 24/7, so ideally you will be running the bot non stop. Running it on a computer for testing purposes is possible, but if you want to scale it up and optimize, it is better to rely on a cloud service such as Azure, AWS or Google. A short note: Google Colab allows you program, execute and host online which is a simple solution for beginner traders, if you want to test and gain better understanding without the need of downloading python and all the libraries.
Step 3: The Strategy
Here the sky’s the limit, based on your risk profile you can scan through multiple strategies, the most famous are arbitrage, mean reversion, trend following, standard deviation, reversion etc. I personally prefer technical analysis based strategies for more well established cryptos like BTC and ETH, since they are also highly customizable.
Step 4: Back testing
The back testing is the most crucial part of creating a successful trading algorithm, starting with collecting data on the pairs that will be traded and formatting it. Splitting the data into two samples for training and testing 70:30 will help back test the strategy on the 70% of the data and then use the 30% as a forward looking data set. You may download a data set to excel or directly connect your code to an API and download real time. Generally speaking, algorithms achieving 50% + accuracy are considered successful, so if your algorithm scores anywhere above it should work well enough with the proper risk management tools in place. One other way to evaluate it is to compare it to a benchmark of a buy and hold strategy – for example, if we bought BTC in January and hold until June would have generated a 40% return, then that will be the minimum expected return of the algorithm to proceed with deploying it.
Step 5: The Code
Importing the data; An easy way to import the data is through Binance API, especially if this is the platform that you will be using for the trading as well. Defining the logic; Depending on the strategy chosen identifying the buy and sell signals.
Portfolio size: Fetching your existing portfolio to the algorithm to be able to calculate the positions size and risk.
Risk measures/Stop Loss based on the strategy, you may add a cut-off level at which the algo will close all trades, partial take profit if multiple positions are opened etc.
Buy/Sell order size based on the portfolio size and the risk parameters. Freqtrade: https://github.com/freqtrade/freqtrade
Freqtrade is a free and open source crypto trading bot written in Python. It is designed to support all major exchanges and be controlled via Telegram. It contains backtesting, plotting and money management tools as well as strategy optimization by machine earning.
This bot is based on technical signals generated by the EMA12 and MACD indicators.
Crypto Trading Bot by JPStrydom https://github.com/JPStrydom/Crypto-Trading-Bot
This bot can be used to autonomously trade and monitor over 250 crypto currencies on Bittrex. Users can configure their own custom trading parameters which will control when the bot buys and sells. .