WALL-E
12
Aug

Bots, Machine Learning, And Other Things Of Importance

In total, I use 5 varieties of bots. Crypto to crypto, fiat to crypto, fiat to fiat, usd to usd, and a discretionary trading bot. I sold out of my crypto positions, so the first 2 are out of the question. The 2 fiat systems work great and are constantly running, but the discretionary bot is producing milquetoast results- hence is shut off for the interim.

The crypto to crypto and fiat to crypto systems are quite straightforward and require no explanation. You buy an asset in one market and sell it in another, simultaneously, pocketing the difference. This is classical arbitrage and it works. The only downside is you take the risk of owning the asset (crypto coin) and your opportunities are limited to small amounts.

Fiat to fiat. I like this system because its stable. However, despite its name, you don’t actually need to own fiat. You do this owning some crypto coin. Find 2 markets denominated in a different fiat currency. For instance, there are many Chinese crypto exchanges denominated in RMB, many in Euro, Dollar, or many other currencies. What you want to do is exploit the difference in premiums between 2 different coins and end up back with a neutral position – all in the same instance.

Let me give you an example. BTC is trading 2% higher on the Indian market than it is on an American market. This means you can buy BTC with USD and sell it into Rupees for an immediate 2% gain. However, now the problem is you are stuck in Rupees and if you want to bring it back to USD, you would lose that 2% – leaving you back where you started and looking rather foolish.

Now what about this. Let’s say ETH is trading 1% higher on the same Indian market, since the people on that market don’t give a fuck about ETH and are not willing to pay the same premium as BTC.

Now you have an exit. You can buy BTC in USD, sell it into Rupees, buy ETH with your Rupees, and sell it back into USD. You would have gained 2% on the first trade and lost 1% on the latter, netting you 1%. This may not seem like a lot, but all of this is executed in less than 2 seconds. This means you are right back where you started, in USD, but with 1% more. All of this can be done with a simple formula, and your bot will be on the lookout 24/7 for said opportunities.

On to USD to USD.

What the fuck does that mean, you ponder? Well, the cryptocurrency space has evolved to include all kinds of different coins. You have your shitcoins, bitcoins, coins for smart contracts, and among others; stablecoins. Stablecoins are designed to mimic something stable, for instance, a fiat currency. The inner workings of what makes this possible are irrelevant, but just understand that it functions as designed.

So within the realm of stablecoins, there is a coin that tracks the value of the USD. In fact, there are a few. They are not actual USD currency, but simply carry the same value as a dollar. This means that by definition, they should trade at 1:1 to the dollar. This holds true for the most part, but markets are never perfect and it will never trade on par. This leaves room for botting – making systems that take advantage of the price differences.

In short you want to buy USD when it is lower than par and sell when it is higher. Pretty straightforward. Doing this efficiently is a lot more tricky, and there are much more complex calculations that can go into finding optimal buy and sell points, but you can figure that out on your own. I like to use a combination of VWAP and the trailing 24 hour price range to calculate bid and ask points.

Alas, the discretionary trade bot.

The trade bot is different than all the others in the sense that it actually takes risk, meaning there is a chance of you losing money, just like actual trading. The only difference is that a bot is doing it for you, which is good since bots are disciplined to code and not prone to doing stupid shit based on emotion.

Generally, people start by basing their bots of technical indicators. When 2 moving averages cross; buy that shit, etc, etc. This is the first step, albeit not profitable.

After that, its up to you to game it.

My system evolved as I came up with new ideas, and the result was just that; unorganized. I first began by collecting my own proprietary set of data – meaning I made a separate bot to create data on my own, rather than use what was available out there. Why? Well the data I wanted simply wasn’t available – not on the short term timeframes that I needed it. That data consisted of technical indicators, momentum indicators, previous prices points, standard deviations, etc – anything that would produce a complete snapshot of the market for the bot to decipher.

Once I had my data, I fed it to a sundry of machine learning algorithms to see what it would spit out. Naturally, that didn’t work and all I got was unusable drivel.

Now, there are 2 approaches to using machine learning algos; regression or classifier methods. A regression method would predict that a stock is going up $x.xx amount over a certain time frame. A classifier method would classify it as a buy or a sell, rather than give you a specific amount. In the world of trading, both are applicable but I notice many more models being created using regression methods.

I chose the classifier method. Why? There is no way of knowing an asset price will go up by precisely $x amount, and rather than predicting that, I see more importance in gauging the overall strength of the move.

At first, this also didn’t work and here’s why. If you feed the entirety of your data into an algorithm, it makes predictions for outcomes at every single point of data. That means that if you’re collecting data by the minute, it will try find something to buy every single minute. This is nonsensical because most of the time there is no action to be made. More importantly, you over-train your algorithm with too much data on times of inaction. The solution; you need a trigger.

A trigger can be whatever you want it to be, but it needs to be specific and consistent. An example would be when a short term moving average crosses a long term moving average – a ridiculous concept, but an example of a trigger nevertheless.

So what you would do is feed data to the algorithm only at times when the trigger is triggered. That way, your algo only screens through data of times only when the short term MA crossed the long term. Doing so will help train it to learn which triggers and valid and which are not, and with much higher accuracy. A clear defined goal and a clear defined outcome. With enough data, and more importantly, the right data – you can reach scores of 90%+ accuracy for a trigger.

I use a combination of 3 different algorithms; Support Vector, Multilayer perceptron, and K-Nearest neighbors. They all use different formulas to produce their predictions, and by far, K Neighbors provides the highest accuracy. In my system, data is fed to all 3 and a decision needs to be confirmed by 2/3 in order for a trade to be executed.

Putting this into practice, whenever my defined trigger is triggered, data is fed to the above algorithms, and they will spit out a prediction of either ‘yes’ or ‘no’. In effect, this is a response to the system querying the algos; ‘I’m getting a buy trigger. Should I buy or not?’

Along with a yes, the algorithms will produce a confidence level, in essence, stating how confident they are with that decision. I generally use this to adjust the weighting I use per trade.

For instance, if I have $5,000 to allocate per trade, a 60% confidence level will execute a $2,500 trade – whereas a 99% confidence level will use the full $5k amount.

Sounds great. So why the fuck did you turn the system off, you ask?

If this was me 5 years ago, I’d probably dial it up a couple notches and have my bots make oversized, audacious bets. However nowadays, I’m more interested in using bots to minimize risk rather than take take it. I’m perfectly content with my no-risk slow moving bots (that can still pull in 1-2% per week) than have to deal with the unpredictable gyrations of higher risk-taking trade systems. This gives me a piece of mind and allows me to focus on other stuff, while still enjoying the amusement of managing money.

In addition, the system is not perfect – in fact, far from it. There are much better ways of designing a trade system, and with higher accuracy. But if I were to change now, it would be faster to discard my current system and start fresh – a time consuming endeavor I am not prepared to take.