In light of the rapid development of the crypto industry and crypto trading in particular, our team decided, as an experiment, to create a trading robot whose main purpose is to trade on the poloniex crypto marketplace. In this article I will try to talk about all the difficulties encountered while writing the robot, as well as the results we managed to achieve.

The beginning of the story

At the beginning of our journey, we needed a resource where we could track our 'holdings' - i.e. the balances of different currencies on different exchanges in one place, with charts and full amounts. There was also a need to add wallets for the major currencies, with a track record of transactions on them. So, after reading reviews of trading robots on https://scammerwatch.com/, we decided to try making our own crypto-bot.

The robot's operating algorithm

The robot's operating algorithmOriginally, the robot polled the exchange once every few seconds, made some simple calculations using Bollinger bands (link) calculation and placed orders if it found it profitable.

This algorithm worked for several months, and then the idea was born to fundamentally change the operating logic - the robot should not interrogate the exchange market for price changes, it should know about the price change at the very moment of its change. At the time the script was written, one of the cryptocurrency exchanges we used, poloniex, had such functionality. This functionality is called WAMP protocol. It allows you to subscribe to the necessary channel on the exchange, and receive timely messages about rate changes.

Once we had the most up-to-date information about the current market situation, we had to work out when to place the order, under what conditions to cancel it and how long the buy or sell order would live if it failed to execute.

new-istockphoto-1356676807-612x612.jpg

When to place an order?

The main goal of any robot with this kind of task is to correctly determine the moment to buy and sell. In our script we decided to use the directional mechanism when the algorithm tries to predict the next step where the exchange rate of the desired currency will go. Below is an excerpt from the bot's logs where you can see the "directions" for the BTC - ETH pair.
The algorithm for finding directions is not very complicated - if a currency pair's high bid and low ask are both rising relative to their previous values, the price is likely to rise in the next moment, otherwise the opposite is true.

Other settings

The settings such as the desired amount of currency and the pairs we want to trade, we decided to put in the Web interface, so that during our work we can choose what to trade. We have set the order lifetime to 5 minutes - orders older than this time are simply canceled.