Ventures of an ex indie game developer

Postmortem: crypto currency trading bot

It took me one year from I quit my day-job until I was satisfied with what I had developed. Right now the trading bot, Atlas, is running in the cloud making me many moneys. I need to get back on how much (and exactly how it does that).


What went rightWhat went wrong

Emotional detachment
The code was written from scratch and blockchain is irrelevant in my life. They could go either way - all I care about is making money. That allowed for pivoting code and ideas every day.



Deceived by results
Early on I found a recipe that worked. Big mistake! It only worked ok when trading in December of 2017, when you couldn't go wrong! It took me months to realize I needed to go back to exploring, rather than trying to refine the crap I had.

Exploration
Over the last year I explored around 30-40 different ideas, each with many variations. Exploration is much better than refinement at finding a sweet spot.


Lack of domain knowledge
I'm probably slow, because it took me 11 months to understand how to take advantage of bear markets (i.e. markets where price is falling). If I knew what I know now when I started, I could have built Atlas in four days.

Python
Speed of development is more important than bug free code when you're doing exploration. Python is unbeatable in that game.


Solitary confinement
I've spent this last year sitting alone in my basement. A buddhist munk on a retreat is more social. At times it felt like I was wasting my life and money for nothing. It was hard, but also interesting.

Margin trading*
Margin trading, as opposed to exchange trading, has has three benefits. The most obvious being that you can make money when the price of an instrument goes down.


Energy drain
If you haven't tried implementing 30-40 variations of any program, you're not qualified to express an opinion about it.
VPS
Running the server in the cloud and not having to bother with one of my own reks. No updating the OS, no rebooting, no downtime.

Unsophisticated AI*
I spent approximately a couple of months experimenting with artificial neural nets. It made sense, as a market is always close to chaos, despite some predictability. Ultimately my naïve experiments failed.


* Laying down the law on AI and margin

I'm not saying AI is futile, but first go find something profitable without using AI. My best AI predictions were at 55% correct, which is pretty bad if you just use it indiscriminately. It probably has very good use in the right circumstances, but I couldn't tell you what those are.

Two other advantages of using margin trading is that you're able place bigger bets, as you're only using your capital as security; and some exchanges (such as BitMEX and Kraken) allows for leverage trading. Both of those can be used to your advantage if your robot is solid.


The most important thing

A bull market is when prices rise over a longer period of time. A bear market the opposite.
  • When in a bull market, price shocks happen to the upside.
  • When in a bear market, price shocks happen to the downside.
Is is exceptionally hard to make money betting against the price shocks. Last year (Jan 2017 - Dec 2018) has mostly been a bear market, where Bitcoin price dropped from 20000 USD to 3000 USD (soon). Many altcoins have in this time dropped more than 95%.

So for instance, if you would have shorted the alt-coin Miota in December 2017 until December 2018 (96% drop), you would have made almost 1/(1-0.96)=25 times the money. 2500% is a mean leverage on any amount.


My advice to you

Move some cash into Bitfinex (commission is 0.1% per trade, $10k required to open an account - move 'em out again afterwards if you don't want to spend it all). Go to any altcoin, such as EOS. In the order form, click "Margin". Place a market sell order to borrow someone else's money and sell them. Shut down the computer and come back in a couple of days. If your profit is a couple of percent or more, place a market buy order to get back the coins you borrowed and return them. Boom! A profit right there.

This way will only be profitable until the current bear market turns into a bull market (price starts rising again). So you should develop an application to do it for you, or you will expose to high risk when the market turns.

Now formalize by creating a simulation program. Simulation is called "backtesting" in finance. Don't use Java, and definitely don't use C/C++. Use one (or more) of the well-known finance indicators. Don't roll your own! I recommend TD Sequential.

Make your model sufficiently complex, using around 20 invariant parameters controlling stop-loss limits, take-profit limits, duration of orders, when to buy, sell, raise, lower, etc. Optimize the parameters to help you find the best set of parameters per each currency (and/or time interval). The optimized parameters will surprise you. The way the computer prefers to trade will be nothing like you would have thought up yourself.


That's it!

Strange. Now I'll give my house some love that is has been craving for the last two years. Then start teaching programming and perhaps taking some part-time contracting work. But also create a few documentaries, the first one about UFO:s. This will take some getting used to, but oh how nice! :]

About the author

Mitt foto
Gothenburg, Sweden