🐺 Wolf of Crypto

During and after my Master Thesis, I spent a considerable amount of time in the cryptocurrency space. As the markets were in recession at the time (mid- to end-2018), it seemed interesting to find strategies that would help me beat the market and minimize loss by doing margin trading. For this reason, I analyzed classical strategies based on Moving Averages (MA), Bollinger Bands (BB), Relative Strength Index (RSI), and so on. I realized after some weeks of testing and tweaking parameters that these just won't cut it. I quickly learned that the cryptocurrency market was any other market on steroids and the volatility should be accounted for. Here is a stance on what I've learned about trading while developing my personal trading bot, the Wolf of Crypto.

You'll need to bring a lot of patience

There is often the misconception with cryptocurrency trading that you can earn a lot of money in a very short amount of time. Humans fall into this trap, be it at the casino, in pyramid schemes, and at the stock market. Decide for yourself whether you like margin trading or exchange trading. Usually referred to as day-trading, it can be highly rewarding and extremely risky at the same time, depending on your trading methods and also your competency. Even though margin trading is the riskiest, it is also an enormously rewarding form of crypto trading.

You'll need to manually find patterns, find ways to simplify the surplus of information to simple, (almost) omni-valid conclusions. Therefore I urge amateurs to begin with mid-term strategies, lasting a couple of weeks and months, with many days between your trades.

In order to be successful at algorithmic trading, without having the HFT equipment of an investment bank, you will need to track your strategy on a regular basis, depending on how busy you are next to trading. There is this dream of being able to relax at the beach and let the bots do the money for you; sorry to burst you bubble, but that is far from reality. The reality is a constant and continuous analysis of price indication and bot performance, with the condition that the bot runs multiple days at a time without any errors.

Go back to basics

Before trying to calculate direct or indirect price indicators yourself, I highly recommend to first go back to basics and use the technical indicators that traders have been using for decades on stock, forex, and commodity markets. Open a chart such as BTCUSD or XRPUSD and follow online tutorials on how to set trend lines, counter trend lines, and Fibonacci levels. Play around with the Relative Strength Indicator (RSI), Simple Moving Averages (SMA), and Exponential Moving Averages (EMA) and just get a feeling for what these indicators tell you about the price movement. From these you can get an idea of what counts interpreting market movement.

The first indicator I used for manual trades were SMA with EMA crosses. I experimented with the time frame and lengths applied to these moving averages and soon found out that they were a solid tracking tool to makes buy/sell decisions. However, the offsets and lack of covering sudden bursts and plunges soon made me look to alternatives.

With every trading strategy, there is always a hidden trade-off. You can't get 100% of the trades, neither by manual intervention nor algorithmic trading.

Machine learning does not do magic

A large preconception in the algorithmic trading space is that if you implement an AI-based trading agent, all your problems will be solved and you can relax at the beach after all. I'm sorry for bursting your bubble again...

Reinforcement learning has been widely used for developing intelligent trading strategies, i.e. predicting the price outcome based on iteratively optimizing a cost function according to a policy. This policy is a set of rules defining the concrete trading implications of the model outputs: e.g. depending on a threshold for the model confidence of a given prediction, what position do you place on the market, what position size, for how long do you hold a position in the given state of the market etc. A policy usually comes with some more free parameters which need to be optimized. In the context of supervised learning discussed here, this is a fairly manual process based on backtesting and grid search.

Developing the policy is not part of the learning-based modeling but a manual process guided by intuition, experience or just simple heuristics. This manual process is based on a lot of assumptions. You'll just have to jump into the cold water and try them. Let's imagine you would place a margin buy order when the model predicts a price increase. A myriad of other questions arise: But how many contracts do you buy? What confidence threshold do you use? How long do you hold your position in the face of adverse market conditions?

Your AI system is only as good as the data you feed it with and the amount of flexibility you grant it through a tedious manual process.

Backtesting, backtesting, backtesting

Algorithmic trading stands apart from other types of investment classes because we can more reliably provide expectations about future performance from past performance, as a consequence of abundant data availability. The process by which this is carried out is known as backtesting.

In simple terms, backtesting is carried out by exposing your particular strategy algorithm to a stream of historical financial data, which leads to a set of trading signals. Each trade (which we will mean here to be a 'round-trip' of two signals) will have an associated profit or loss. The accumulation of this profit/loss over the duration of your strategy backtest will lead to the total profit and loss (also known as the 'P&L' or 'PnL').

Backtesting provides a host of advantages for algorithmic trading. However, it is not always possible to straightforwardly backtest a strategy. In general, as the frequency of the strategy increases, it becomes harder to correctly model the microstructure effects of the market and exchanges. This leads to less reliable backtests and thus a trickier evaluation of a chosen strategy. This is a particular problem where the execution system is the key to the strategy performance, as with ultra-high frequency algorithms.

Furthermore, it should not be the goal to backtest a strategy on a certain timeframe, tune its parameters until the profit is as high as possible. It must be key to test a strategy for robustness against time periods.

Twitter and Google Trends as direct price indicators for day-trading are worthless

I spent a considerable amount of time scraping tweets from the last year about #crypto, #bitcoin, #btc and the like. Since Twitter's API restricts the amount of tweets to be harvested, I used a work-around with pyquery and urllib to populate a database with around 4 million tweets and counting. After cleaning and rooting the tweets, I analyzed the sentiment of each with different openly available NLP tools and averaged a batch. This is a typical result for #bitcoin and #btc, which shows heavy noise and mostly no correlation to the price.

Smoothed Twitter Sentiment and BTCUSD

Furthermore, I spent some time experimenting and analyzing Google Trends. This is the ubiquitous sentiment indicator many popular bloggers, YouTubers, and so on use to adjust their content. Often times I see people not properly using the tool, and putting too heavy of a reliance on it. Since Google Trends has a delay of a few hours, it is useless for short-term crypto trading. However, on the long-term, it gives you a reaction of people to the market at e.g. bull runs or inflection points.

Instead of using Twitter, Google, or Reddit as a sentiment indicator, use the information on margin longs versus margin shorts, which are reported by Bitfinex for example. DataMish provides an excellent real-time visualization of long-short-behavior I have I like to look at the raw data (total longs and shorts) as well as the percentage (how much percent of total staked asset was in long and how much was in short). On TradingView charts, you can easily add these two by searching BTCUSDLONGS and BTCUSDSHORTS and adjusting the y-axis for scaling.

Long-Short-% and BTCUSD

The green-red plot shows one of the analyses I made over the weeks developing the Wolf of Crypto. The green area shows the percentage of longs based on the left axis (~45.25% at t=0, the time axis is in minutes). This means at 54.75% shorts the general sentiment is bearish. I called the blue line, the gradient of the percentage line, the "Sentiment" with the axis at the right. Regarding micro-movement, a strong correlation can be seen between the price fall at around 420 minutes and the subsequent drop in long position contracts. This is where the Sentiment curve drops to a local minimum. This is where the crypto market is unique: a price drop of a few $100 for the BTCUSD is nothing special anymore. It's characterized by its high volatility, and therefore high emotionality of traders behind their screens.

Don't underestimate market manipulation

A large caveat in cryptocurrency trading as a small fish is its high level of manipulation at certain points in time, but that is the cost of having an unregulated market. In general, we can categorize the types of market manipulation into five categories:

Pump & Dump (P&D)

Pump & Dump is the most common method of market manipulation in the crypto space that involves prying on the weakest, most emotional, most speculative investors. In general P&D can be summarized in four steps:

  1. A group of manipulators formulates, agree on date/time to acquire a certain cryptocurrency en masse
  2. New investors, which are not part of P&D group, begin to buy due to increase in price
  3. Original pumpers begin to dump
  4. Volume dries up / new investors are forced to sell for low price or hold on the way down
Example of P&D for the ELEC-ETH pair. Shortly before 12:00 market manipulators form and pump the price.Shortly after a 37.5% increase of price after new investors join the bull run, the pair is dumped as the original pumpers begin to sell.

In summary, P&D manipulators will trick people into buying too late in subsequent buying and selling schemes.

Market Makers

A market maker is a high-level trader with large assets, also known as a whale. Market making is not illegal, especially not in an unregulated market such as the crypto markets, yet instead plays an essential function of keeping the market in movement. The function of the market maker is to bring liquidity into the market with low volume for steady trading/investing.

In the most common cases, these enter with new ICOs to bring liquidity and narrow the orderbook (to narrow the spread between bid and ask) for more steady trading. The market maker will acquire large supply of coins, more liquidity, then trade these coins to new investors and profit from the spread of bid and ask.

The cycle of market making. After acquiring a large amount of coins through an ICO for example, he provides the market with liquidity, narrowing the bid-ask-spread. After trading these coins to new unknowing investors, the spread of bid and ask widens, from whose difference the market maker is able to profit from.

Generally, the exit of a market maker can be detected by unusually high trading volume as seen in the following chart:

Algorithms

This is an obvious one and a manipulation method I have fought with a lot as a little trading fish. Multiple studies have shown that 84%-90% of all stock trades are ordered by high-frequency trading computers, 10-16% done by human traders. Most decision-making relies on whether a certain price is hit. Algorithmic trading cuts out the emotional aspect of trading and accelerates the process of giving up trading orders. Therefore algorithms take advantage of the time delay of humans reacting to a certain price movement.

Wash Trading

The method of wash trading is a form of market manipulation when an investor or two coordinated investors simultaneously sell and buy the same financial to instruments to create misleading artificial activity in the marketplace. Now some might look at wash trading and ask: How is it market manipulation? Where's the gain in the process? It depends on who's doing the wash trading, as it can be used for a variety of benefits.

In traditional markets the common users of wash trading were generally brokers aiming to generate more commission fees. However, as we step into crypto markets, the most notable example of wash trading is found within the exchanges, where many have not only been caught, but many others have been accused of using wash trading to push up high artificial levels of volume in order to attract investors.

In effect, wash trading may be done by one investor with two or more accounts and also two coordinated investors, mitigating practically any risk. Wash trading can also be used to manipulate price or how a market is evaluated regarding an underlying currency.

Spoofing

The objective of spoofing can be to leave a bid or ask or an order to buy or sell that's not meant to execute on the open exchange. Spoofing can be used a variety of ways to lead to misconceptions or manipulation within the orderbook, but the most common example I have seen in crypto markets is when a whale (an investor with a large amount of assets) goes about setting a limit or ask order that is never meant to be fulfilled.

This order gives us the illusion that we know what the whales are intending or aiming for the price to go, since the orderbook is accessible to everyone. This creates a wall in the orderbook (see first figure), after which all the small fish start aggregating to that price. Shortly before the price is reached determined by the whale order, the whale cancels the order through HFT and has now successfully drive the price in the direction of his favor.

Ask wall generated by spoofer.
Ask wall disappears after price shift.

An alternative way of spoofing is setting a series of large market orders at a certain price and cancelling them one-by-one, giving the people the misconception that the orders are going through. This motivates other small investors to set orders at this price as well and drive the price in a certain direction.

For more information, please watch this amazing video by DataDash.

Finally: Find a good balance between fundamentals, technicals, and sentiment

Apart from all the challenges and obstacles I've run into during the weeks and months I spent into developing the Wolf of Crypto, it was key to find a balance between the hardcore fundamentals, the price and trading volume information, technicals, which include everything from MAs over Indices to Oscillators, and sentiment information, which I classify mainly as long-short contract behavior. The following figure will give you an overview of what I kept an eye open for and on which features I based my strategies.

Three pillars working together.

These three pillars will hopefully guide you in finding the optimal strategies for your trading career.