The Important Concept of Arbitrage

I’ve spent the last 3 months locked up in the office feverishly typing code into my computer, building a system that has finally reached some level of satisfaction. Admittedly, my original plan was to hire someone to do all this for me but there is no way I would’ve been able to explain what I needed to any coder out there. Plus anyways, the way I see it, everything I do in life will pay off 12 months later and this is just another one of those ‘things’ I’m glad I am doing and have been learning immensely from doing so.

I’ve just finished stage 2 of my longer term plan, which was to build a functional discretionary trading system that will buy and sell financial securities all day and all night long. Albeit I am still in the final stages of testing, I have put together something quite reliable that involves a massive amount of data accumulation, triggers, and AI algorithms that work together in harmony. More on that in a minute.

Before I get there, let’s talk about arbitrage.

Imagine you are leaving to a foreign country and show up at your local airport with US dollars in hand, eager to change it for foreign money. You approach the nearest currency dealer and he offers to sell you Thai Baht at 30 Baht per $1. You take the deal and walk away.

Curious to know whether or not you got ripped off, you log into your smartphone and search the live rate. You see that the Baht is actually trading at 29 Baht per dollar, confirming your suspicion of overpaying. Chagrined,  you glance back at the currency dealers board to see that he is offering to buy your Baht back at 28 Baht per dollar, offering him a comfortable 1 baht margin on both the buy and sell sides. That’s his to keep.

Here’s the thing. The real rate is around 29 Baht per dollar, the actual bid and ask probably as thin as 28.99/29.00. In theory, if you had access to the real rates, you can hi-jack the currency dealers business by offering travelers at the airport to buy their Baht at 28.5 and sell it to them at 29.5, whilst immediately offsetting your position with the real rates. In theory this would work, but the unfortunate reality is you can’t – since the currency dealer owns this business and can offer bid and ask quotes at whatever prices he well pleases.

Enter cryptocurrencies.

Imagine this; each one of those currency dealers around the world suddenly became market places, allowing anyone to jump in and offer their own prices. Now the above scenario is completely possible – all that’s required is an accounts at each market. Granted, this is not a job for humans, since markets move way too quickly for humans to keep up.

The above is effectively how I got into this ‘bot’ game and over the past few months have put together 22 bots that I have running 24/7, throwing out orders and arbitraging between crypto currencies. Despite the concept being very simple, the actual execution is a lot more complex.

The markets move fast and if you let your order sit for too long, it will get stale, increasing your risk. To mitigate that risk, my offers are live for a maximum of 8 seconds, upon which those orders are retracted and updated with the latest prices. On average, each bot throws out a new order every 10 seconds. Multiply that across 22 bots and you are looking at close to 200,000 orders being thrown out into the markets within a 24 hour time frame – 99.9% of which get cancelled.

Typically, servers don’t like getting bombarded with that kind of volume. They don’t like it one bit. What I noticed in the beginning was that within a few hours – usually daytime hours in Asia when there is a lot of activity, I start seeing issues with connecting with the market exchange servers. This is essentially the exchange’s way of telling you to ‘stop overloading their servers’, which I took note of and immediately began brainstorming a fix. After trying numerous things with no avail, one simple modification did the trick.

I set the bot to only throw out orders that had a possibility of getting filled, meaning they would be either the highest bid or the lowest ask. This may seem like common sense since there is slim chance your order gets filled being number 2, especially if it is live for only 8 seconds, but at first I didn’t think it would make much of a difference. It turns out that not only does this cut the amount of orders down to less than 10%, solving the server connectivity issue, but it also hides your hand in the game of poker with other bots – since your bot essentially goes invisible when there is no activity to be taken. The last thing you need is having your bot figured out and countered, and all profitability taken away.

In my eyes, arbitrage is essentially risk free. Granted, there is no such thing as risk-free, but that’s as close as you can get to being there. The only problem with arbitrage is that it is limited to the opportunities that are available, which quite often is not that much.

At the moment, my arbitrage systems produce a gain of about 3-5% per week. Annualized that’s a monster of an investment, but don’t get too excited, as the activity is limited. I’d say, anything after $10k, the %-wise returns start to decrease, and fast.

Naturally, the next step was to tinker with a new system that takes on a little bit of risk.