by MAX Contributor Andrew Jim
DISCLAIMER; This post and its contents should in no way be considered investment advice.
This is the third piece to come out of our contributor series which represents market analysis by individuals independent of the MAX Exchange, helping to write quality content on our platform in a freelance capacity.
Given the roller coaster history of cryptocurrencies and their inherent volatility, there is always an aim to try and accurately detect unusual outliers or ‘anomalies’ — which are exceptional events that could help in trading and/or position sizing.
In this piece, anomaly detection was performed on BTC to highlight significant outliers, and an upper and lower grey trading band (Currently 3450 to 6100) was created around the normal observed data points. It was shown that given the recent break below $4500, BTC created downside anomalies which can be used as an opportunistic entry point or as a trading stop — depending on trader strategy. Interestingly BTC was the ONLY crypto currency in the top 20 by market cap to trigger downside price anomolies in the recent Nov-Dec sell-off.
The exercise was scaled up to examine anomalies in the Top 20 cryptos to see if there were any discernible patterns for these anomalies. In order to reduce the dimensionality of the problem, the top 20 cryptos were further classified using a K-medoid clustering algorithm. Two representative cryptos were found (surprisingly, Monero XMR and Stellar Lumens XLM). The net effect is that despite Bitcoin having a ~50% market cap dominance, we can show that the price profiles of XMR and XLM are more typical of the overall price movements of the crypto universe than BTC. Theoretically, buying just these 2 coins would give you better exposure to typical moves of at least the top 20 cryptos.
Although the range bands are continuously changing, and correlation does not imply causation, it will be interesting to see how Bitcoin, XRP and the overall crypto universe moves, should XMR break to the upside of its upper trading band of $60 (a ~11% move) and XLM break above its upper trading band of $0.13 (a ~10% move).
In our exercise, we use 2 years of aggregated daily Bitcoin price data taken from Cryptocompare.com with USD prices ranging from $500 to $20,000 (for about a 40X gain) as seen below:
Before any anomaly detection can be done, the BTC daily time series data was analyzed and decomposed into its (weekly) seasonal and (rolling 90 day) trend components. These two components were then stripped out of the time series, and anomaly analysis was then performed on the remainders.
Seasonal and Trend decomposition was done via the STL method(https://otexts.org/fpp2/stl.html) using Loess (locally weighted) smoothing (https://tinyurl.com/ycjcub3a).The STL method can handle different types of seasonality, variation in the smoothness of the trend, and is overall more robust to unusual outliers which could impact both seasonality and trend.
Next, an iterative statistical process, GESD (a Generalized Extreme Student Deviate test)(https://tinyurl.com/ydyugfh5) was done on the remainders to see which ones qualified as extreme outliers. It progressively evaluated the anomalies, removing the worst offenders and recalculated the test statistic and critical value. Overall, BTC data generated 83 anomalies (or about 12% of its total data points).
The chart below shows the observed BTC daily price data along with its decomposed seasonal, trend, and remainder components respectively. As can be seen, any seasonality impacts were relatively small (+/-30pts) compared with some of outliers in the remainders which were above 9000pts! The anomalies are highlighted in red below.
Finally, after anomaly detection was performed and anomalies identified, the decomposed components were ‘recomposed’ again, along with upper and lower bounds for the outliers created around the normal observed values. As can be seen below, the latest downside anomalies for BTC occur after the recent aggressive break below the $5000 level.
Once the outliers have been detected a grey “trading band” is drawn around the rest of the normal observed data. The band is clearly a continuously moving and changing envelope but it can be used as a guide for long/short trade positioning. For example, the recent break below $4500 can be a used as a stop/stop loss, or conversely, as an interesting entry level for an opportunistic buyer.
The band suggests bounds for current ‘normal’ observed values should lie between 3450 ~ 6100. Please note: whether a move above 6100 would be considered bullish (or a break below 3450 bearish) really depends on the strength of the move. For example, if BTC were to suddenly surge above 6100 in a couple of days, it would likely create price anomalies. The price could accelerate further but in general anomalies are exceptional in nature and do not last (ie. potentially an opportunistic area to sell or short). On the other hand, if BTC slowly edged its way up to 6100 then those new data points would likely remain inside of its normal trading range even as the envelope edged upwards. In theory, BTC could even trade all the way up to 20,000 again without creating any anomalies, but given trader emotion, the existence of large players (“whales”), and automated trading bots with the same strategies adding to the volatility — it is more than likely that anomalies will be created at some point.
The GESD algorithm aims to classify those anomalies correctly, and ranks them according to impact strength relative to any anomalies already created. It will also keep the total number of anomalies capped at 15% of all data points as a way of isolating the more important ones.
TOP 20 CRYPTOS:
The anomaly detection was scaled up to examine anomalies in the Top 20 cryptocurrencies which collectively represent about 90% of the total crypto universe market capitalization of ~$120bn and almost 90% of daily exchange traded volumes. We want to see if there are any discernible patterns for these anomalies across different cryptos. For consistency, and to isolate the more important outliers, the maximum number of anomalies for each crypto were also capped at 15% of all data points.
Repeating the STL decomposition, GESD outlier detection, and then recomposing the detected outliers back with the original seasonal, trend and remainders gives the following charts:
The anomaly charts above showed that most cryptos generally moved inline with BTC and spiked with multiple anomalies from mid-Dec 2017 to mid-Jan 2018. On average about 40% of all anomalies occurred during that time. USDT being a stablecoin was an exception which only had 8% of its outliers at the peak. MAKER(MKR) and ZEC were also two notable coins with low single digit anomalies as a percentage of their total data points. The table shows that on average for each crypto, about 76 anomalies qualified as statistical outliers accounting for about 11% of all data points.
Interestingly, the charts show that only BTC formed downside anomalies in the most recent sell off in late November, whereas WAVES was the only crypto that formed upside anomalies after breaking above $2.50 on Dec 18.
The above 20 charts and their anomalies represent a lot of data to absorb. However, to reduce the dimensionality of the problem we can use a K-medoids clustering algorithm (https://tinyurl.com/ya7yvkq2) to partition the top 20 cryptos into an optimal number of clusters and extract a typical or representative profile (the medoid) for each cluster. Similar to the K-means method which tries to minimize the total squared error between each observation, the K-medoid method minimizes the sum of dissimilarities between each point in the cluster. In our case, it will isolate the crypto that is the least dissimilar to the other cryptos in its cluster. In general, the K-medoid approach is more robust to noise and outliers than the K-means method.
The Davies-Bouldininternal valuation index (https://tinyurl.com/yd5fvt7t) was used to determine the optimal number of clusters. We are looking for the smallest DB index number, and the graph below suggests that the best number of clusters to partition our top 20 cryptos is 3:
Before clustering, each of the top 20 cryptos were preprocessed by normalizing each time series using a Z-score which implicitly removes noise and emphasizes the essential characteristics of the data. The K-medoid method with 3 clusters was then applied with the following results:
We see that 3 typical profiles were extracted by the algorithm (the medoids of the clusters). Cluster 1 is the largest and consists of 13 cryptos and is represented by the medoid Monero(XMR) and surprisingly not BTC which is also in the cluster. Cluster 2 has 6 cryptos with Stellar Lumens(XLM) as the typical profile, and it is interesting to see that Ripple (XRP)which is grouped in the same cluster was not the medoid. Cluster 3 only has one profile which we can safely ignore. It is actually the stablecoin USDT, which the algorithm correctly identified as having a very unique profile versus the other cryptos given the nature of the coin.
For clarity, the anomalies for XMR and XLM(as of 2018–12–28) are shown in the bigger charts below. In contrast to the downside outliers created by the movement of BTC, there were no recent downside anomalies created in XMR or XLM. So that implies that current price moves for both XLM and XMR are within their norms (not extraordinary). From a trading viewpoint, there is a glimmer of hope with both coins trading closer to the upper end of their range despite the generally downward trending bands. XMR(currently at ~$51.5) is moving towards its current upper range (~$60) and XLM (currently at ~$0.12) has a tighter range band and is about ~10% away from its upper band at ~$0.13.
BTC has a ~50% market cap dominance and will always be watched as a leading indicator. But we have shown that XMR and XLM are also statistically representative of the crypto movements in general despite their smaller market cap. Theoretically, buying just these 2 coins would give you better exposure to typical moves of at least the top 20 cryptos including BTC and XRP (but excluding USDT of course) and likely a better hedge than just owning BTC or XRP alone.
Happy trading in 2019!
DISCLAIMER; This post and its contents should in no way be considered investment advice. We may individually hold positions in some of the assets we discuss. Any projections, conclusions, analysis, views are to be considered hypothetical & for informational purposes only & not meant as recommendations for investment. Anyone considering an investment in crypto should only invest what they can afford to lose. You alone are responsible for evaluating the risks & merits of our content.