Project Tradebot VII: optimisation

Tuesday 24 May 2016

Working is one thing, working well is another...

Well, it’s getting to the end of this miniseries on tradebots. I’ve learned a lot about creating, coding and debugging my grid trading software, having started almost from scratch. Now it’s basically working pretty well, but I need to optimise it to make maximum profits. This essentially comes down to 1) Make as many trades as possible in a day, and 2) Make sure each trade is as profitable as possible. However, increasing 1) may adversely affect 2), and vice versa.

I went into this endeavour hoping it would be a set-and-forget enterprise: I’d just unleash the bot and it would run around on the exchange, making me money 24/7. And although it works like that some of the time, it’s a little more high maintenance than I’d hoped. It’s as much an art as a science. Markets change, and so you need to change your strategy - whether that’s the pair you’re trading, or the parameters for buying and selling.

Take the trading pair. You need to know your market pretty well before you can set the bot off. It’s not just that you need to know what range to trade in, and that’s a matter of judgement. It’s that the nature of the market is important. Take NXT, for example, which I started out on. It’s low volume, but there are some sharp moves. So very little happens but then the price could drop 100 satoshis or more before bouncing as much. So it’s great for trading small amounts, but if you use larger tranches then you actually affect the market. It’s like the Heisenberg uncertainty principle, applied to crypto: you want to fly under the radar. You don’t want to affect the phenomenon you’re trying to employ/observe.


Efficiency is key: the higher the turnover of trades, and the more profitable each one, the better. Just ask this guy.

I switched to BTS, which had better liquidity, to avoid this. But that could be a little too stable. There were plenty of moves, but still long periods where nothing much happened - and the moves, when they came, weren’t so big as with NXT. A lot of the time the price would buzz around a narrow range, and I didn’t make anything much.

Reducing the spread helped in that instance. In fact, it’s possible to drop the spread right down to just a few satoshis. If BTS is trading at 1400 sats, you’ll pay 2.1 sats on every trade in fees (0.15%), so you can decrease the spread right down to 7 or even 5 sats and still make a profit. It grates a little to know you’re spending a third or a half of your profits on fees, but if you can increase the number of trades significantly by such a strategy, it’s worth it. At this point, the bot is acting a lot like a marketmaker, since a lot of the action simply takes place as the price bounces between your buys and sells at the same price.

It’s an approach I like a lot, and so I shifted to ETH where the volumes are huge and reliable. There is hardly a minute of the day where a trade doesn’t occur, which is not the case in other cryptos. The action is great there: plenty of volatility, but not crazily so. It’s easy to make around 1% per day - around 400 trades, with 200 tranches spread out between 0.019 and 0.029 BTC, and each trade making 0.5%. I buy in at 0.024 and use half the money on each side.

Finding the right entry point is critical, I’ve learned, because profits are optimised if you can trade within as narrow a range as possible. Plus, if you go out of range, you want to go out to the upside ideally. Obviously, if the price goes outside of your range of tranches, you stop making money. That’s exactly what happens with ETH. Not long after I start the bot running, the price tanks - shedding over 20% and dropping out of the bottom of the tranches I’ve placed down to 0.019. This poses a problem; I could load up the account with a little more BTC and keep going, or I can wait to see if the price rises again. This is why botwork is an art as well as a science. The gridbot is a robust system that makes good profits (in theory) from a broad price range - but there’s still no guarantee it won’t go out of the range you set. The only solution is to set tranches right down to zero, but that’s inefficient. So: Know Your Market. In the event, I put another set of funds in, buying in at 0.0175 or so, to take advantage of the action at the lower range. The bot was then set to work between 0.014 and 0.029, which reduced its yield, but hey - it’s something rather than nothing. A few weeks in, and it came out of the top of that range. At this stage, I switched it off and will wait a while to see where the market goes to decide my next move: ETH is just too crazy right now for safe bot trading.

Ultimately, optimisation is a matter of trial and error. It’s very hard to know what the best approach is without running two separate bots on the same exchange and comparing strategies. Overall, though, I’m pretty happy with what I’ve achieved - and I have a new appreciation for developers. I doubt I’ll ever pay the mortgage this way, but it works, and it’s been fun.

comments powered by Disqus