How to build a Cryptocurrency Trading Bot

How to build a Cryptocurrency Trading Bot

This article is a guide to create your own Cryptocurrency Trading Bot, starting from zero. We are going to build a system that trades 24/7, even while you sleep.

This article is focused on setting up that system, making it profitable is not concerned here. I provide strategies in the member area of my blog. This tutorial is for people who have basic knowledge with Bitcoin and Cryptocurrencies, if you are new to this then go there.

Disclaimer: There will be some costs, since we will use the API from several servers 24/7.

What you will need is:

  1. A Trading Exchange
  2. A Web Service for traders
  3. A connector for those two
  4. An internet connection

Choose a Trading Exchange

This is the first thing to do, since it can take several days or a week to get your account verified. We are going to use Binance, this exchange has a Trading API that we can use, it has a decent amount of crypto markets, and his fees are really low (0.10% to 0.05% if you have some BNB and that you configure your account to use BNB for commissions). Most importantly, it is one of the most used exchange, and one of the most secure ; Each time a problem occurred their team handled it very quickly and without blunders (do your own research, don't take my work for granted). You can create an account here. Once you have created your account, you need to reach the tier 2 validation. For more security, I recommend enabling 2FA identification in your account settings (make sure to also keep your 2FA recovery code in case you lose your phone!). Also check Binance's tutorials for more detailed instructions.

Using real time data

In order to trade you will need access to 24 hours / 24 and 7 days / 7 chart data, as well as programmable alerts hosted on a server. This is where Tradingview comes into the game. It's a social network for traders, with an interactive chart and a specific programming language : Pine Script. With this you will be able to create indicators, strategies, backtests, but most importantly, set up alerts. Those alerts will trigger on a condition that your script will have calculated using the chart real time data, price candles. And this is upon this condition, that a trade will be made, automatically, using a connector that I talk about in the next paragraph. You can test Tradingview for free, but you will need a premium account in order to use several alerts. You can create an account here.

Linking the alerts to the trading platform

There is an easy way to connect Tradingview's alerts with Binance API. It's a Chrome extension called Autoview. For 3€ per month (for Binance access), it will catch every alert from Tradingview and send an order to Binance that you will have chosen. The process is simple: retrieve your API keys from Binance, you will need them for configuring Autoview. Connect Binance in Autoview. Configure your alerts in TradingView using the Autoview syntax. Here is a getting started tutorial. I recommend to do some testing first, with by example the -d parameter for test orders and having the background console open for debugging. There also Autoview's tutorials are useful.

Getting everything running

To sum it up, in order to set up your Trading Bot what we need is an internet connection: a Chrome tab open with a Google account connected and Autoview installed on it. That's all. Once your alerts are configured on your Tradingview account, everything is automatic. Then it's up to you: you can let it run your computer or use a server. Personaly, I use my mining rig for it.

Written by Cyatophilum - -