Trial and Epic Fail

Ventures of an ex indie game developer

Wadu Hek Profit

After some coding to generalize the extremely slow backtesting of my new idea it looked pretty pointless yesterday. I went to bed thinking I was done. Pretty content with the trading bot I've got right now, but no jumpin' jacks.

This morning I took a last look, just to make sure. I found a bug in the code: I had mistakenly inversed the profit! When I corrected that it shows a wadu hek profit; i.e. it's actually hard to loose money if this method can be executed well!

Right now I'm manually optimizing my only three parameters (!), but every backtesting run takes around five minutes, so one hour later I haven't gotten very far.

One minimal thing I need to do now is to just check that my orders go through (i.e. there's a low below my bid and a high above my ask some time after). Given the other parameters I'm using, I suspect that this shouldn't be a too big thing, and I simply skip taking slippage partial fills into account.

I've spent a year trading, without studying trading theory at all. All I've done is experimentation. If this, my last experiment, is successful the way it seems right now, I've managed to find a fantastic low risk/high reward strategy, which is pretty much unheard of in trading.

This wadu hek profit still seems to good to be true. Hm. I've got more digging to do.

Not so fast!

My Atlas bot has been running for 3.5 days with my latest parameters, and although it's way too early to say, it looks to be making around +100 to +800% profit per year. That's a big span, in a month I'll be able to be more precise, but my current best estimate is around +350% per year. Altough that is amazing in the true sense of the word, it won't make me rich, because profitability will go down as my capital (and thereby order sizes) will increase. It's certainly non-linear, so exactly how that would play out is hard to say.

After a few days of not hacking much I found some renewed energy and backtested another trading ideas. It's fairly easy to implement and looks absolutely insanely profitable!!!

When things looks too good to be true, watch out! But I must say that is seems exceptionally profitable both in theory and in my rudimentary backtesting. If I am able to pass limit orders close to the closing prices I'll be rich within months. If I need to chase price or even place limit orders, profitability should be close to what I already have. One of the main downsides is that I'll be putting much more emphasis on fewer currencies, which increase risk.

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.

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.

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.
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! :]

Shorting sure is the way to go

I've spent the last three days implementing margin trading, especially 1x shorting on Bitfinex. Fixed a lot of bugs in the trading code in general, and spent a couple of days manually inspecting the results to find and eliminate further bugs. Started "Atlas" the robot yesterday afternoon. The results look promising so far:

NEO short already took an 8.3% profit before entering again, and is now up another 1.37%.

Atlas is only lending/shorting as much dough as I have in the wallet. I could lend up to three times more (wallet money is used as security), which would increase the profits. I'm not sure yet if that would reduce my liquidation price (even though it shouldn't matter, since I use stop-loss).

This is going to be very profitable until the market turns. At that point I'll tweak the shorting parameters to breakeven, and hopefully the long strategies should take over profitability by then. The crypto market will turn (short-term) bullish in about a week.

That's a wrap, folks! Next post is a post-mortem.

Nope, done

My find in my previous post was a high long-term correlation between Litecoin/Tether and Ontology/Tether, but with a low short-term correlation. In layman's terms: they move in the same direction over time, but have different speeds at getting there. That should be a great way to make money, and even the simplest implementation (long one, short the other) is not too hard. (Although I don't know of any site that supports ONT/USDT shorting.)

However, I'm not going to persuit it. I don't have the energy to build good back-testing for it.

Instead I'm going to refine my already working solution. Next step is to support shorting, so that I could spread my dollars around a little bit, and reduce risk. I like that for this whole 1-year project I pretty much only did exploration; even though it has been exhausting. Refinement, in comparison, is a breeze!

Get rich v2.0

Hm, I was too fast at thinking I was done. I just found something that one just might be able to live off of! It's a kind of arbitrage I found by turning things on its head. I need to dig into it and come back with the post mortem at a later point in time.


Think I just 1.0'ed, but till will have to tell. The journey was a lot longer than I thought at times. 1.0 is not hugely profitable, but around +12% per month might be possible (year-equiv +300%). Let you know either way.

Bitcoin just dropped big time, so expecting volatility to come back, at least for some time.

Next post will be a post mortem for "Project Atlas."

About the author

Mitt foto
Gothenburg, Sweden