4 Useful Metrics for Algorithmic Traders, Week 4
As a part of our Open Crypto Data Initiative, we aim to provide traders and web3 enthusiasts with the tools to understand cryptocurrency markets and derive key insights into their mechanics. However, this data is limited by the knowledge of the traders using it, and so we’re providing a series of useful metris and indicators that algorithmic and high-frequency traders can add to their arsenal when developing a trading strategy.
13. Coin Days Destroyed
Due to the immutable and granular nature of the blockchain, we have the ability to track coins since their inceptions; including which wallets they go to and how often they are spent. Hence, we are able to determine some useful indicators about different tokens in regards to how often they move around, how long they’ve existed, e.t.c. One such indicator is Coin Days Destroyed, or CDD, which gives a weight to coins based on how often they’ve lied dormant in a wallet, i.e., how long they haven’t been spent. It acts as an alternative to simply looking at transaction volume.
Consider two types of traders: one is a day trader who constantly moves tokens in and out of his wallet, and so tends to not hold coins for very long. The other is a HODLer — when she buys a coin, she keeps it in her wallet for years at a time, waiting for the right time to make a move in the market. When the first trader transacts a coin from his wallet, it might not be an indicator of much — after all, he’s a day trader, so this is expected behaviour on a normal day. When the second trader transacts a coin from their wallet, however, it’s more significant, simply because she tends to hold onto her coins for longer; if she decides to make a move now after holding for years, that transaction should be considered to be more impactful than the day trader. CDD lets us weight the transactions of the second trader higher than the first trader, which can give more useful insights into how economically important these transactions are.
CDD is often considered for the whole market in order to predict trends, and some common rules of thumb are:
- CDD < 5,000,000 is often correlated with a bearish market as people tend to be holding their coins
- CDD > 5,000,000 is often correlated with standard baseline traffic
- CDD > 10,000,000 is often correlated with bullish markets as long term holders tend to be making their move
- CDD > 20,000,000 is often correlated with very high volatility
There are variations on the CDD which can provide different viewpoints on the market as a whole, one of which we will describe further below.
Formula and Calculation
Every day a coin remains dormant within a wallet, it accumulates one “coin day”, which resets whenever the coin is spent. For a given UTXO, for example, its CDD can simply be calculated as
Which is simply the underlying value of the UTXO multiplied by the number of days it has been unspent. E.g., a UTXO for 3BTC that has been held for 100 days has accumulated 300 coin days.
def cdd(value, days_dormant):
return value * days_dormant>>> print(cdd(3,100))
This is for calculating the accumulated coin days of a single UTXO. To get the actual CDD for a market, you’d have to sum the coin days of all UTXOs in a market, like so
# Format: (value, days_dormant)
utxos = [(3, 100), (1, 2), (354, 1), (0.3, 10), (12, 200), (40, 10)]>>> print(sum(cdd(x, y) for x, y in utxos))
Mary is a long-term holder of her Bitcoin, and wants to know what her other fellow HODLers are doing in the market so she can try to time her trades perfectly. At one point, she calculates the CDD of BTC as 7,000,000 by looking at all the wallets that currently hold BTC and summing up all of their accumulated coin days. Since this figure is low, she doesn’t act. Later, she does the same calculation but comes up with a figure of 16,000,000, so she figures that many other HODLers are making moves and starts to figure out her strategy as well to time the market most effectively.
14. Supply-Adjusted CDD
As time goes on and more coins are issued in a network, the lower bound of CDD will naturally increase over time: 100 days after Bitcoin launched, the maximum coin day that could be accumulated was 100 days. Now, 13 years later, the maximum is much higher, and so we run into an issue of accounting for this change so as to not overshoot our indicator. The Supply-Adjusted CDD aims to remedy this by accounting for the total volume of a network in the calculation of the CDD.
Supply-Adjusted CDD has similar use cases to the traditional CDD calculation, but can be more reliable when examining differences over time. In a traditional CDD examination, you may notice that the floor value steadily rises over time, and the peak is higher. This can give misleading results, and so adjusting for the supply can be more useful in making predictions about economic activity.
Formula and Calculation
The Supply-Adjusted CDD is given by
def supply_adjusted_cdd(cdd, total_supply):
return cdd / total_supplyutxos = [(3, 100), (1, 2), (354, 1), (0.3, 10), (12, 200), (40, 10)]
total_supply = sum(x for x in utxos)
market_cdd = sum(cdd(x, y) for x, y in utxos)>>> print(supply_adjusted_cdd(cdd, total_supply))
James is looking to predict when the market is next going to have significant price action, and he wants to use CDD to do so. He initally compares the CDD currently to the CDD of the last bull run 8 years ago, and notices that the current CDD is higher than it was then. However, he divides both of his calculations by the total supply at those times, and then notices that the current CDD, adjusted by the supply, is actually lower than it was 8 years ago. So, he decides to wait.
15. Reserve Risk
Our previous two metrics have focussed on taking into account the lengths of time that long-term investors will hold their coins, and Reserve Risk is another indicator that concerns these types of traders. In fact, the principles that underpin coin-days show up again in the formulation of Reserve Risk. We’ve seen previously that accumulating the coin days of UTXOs can be a measure of the conviction of long-term token holders, and we can expand this to take into account the price of the token. Notice that, as the price increases, the incentive to sell grows stronger, and so there is pressure on HODLers to get rid of their coins to realise their profits. Those with very strong conviction, however, may resist this temptation and incur opportunity cost. The opportunity cost associated with HODLing coins during a bull market is called the HODL bank. Reserve Risk is simply a comparison between the current price and the HODL bank. In other words, it compares the incentive to sell to the conviction of HODLers who have resisted it.
Reserve Risk tends to follow a cyclical pattern. That is, it will oscillate in accordance to macro trends in the market. In general, when reserve risk is low, it indicates that HODLer conviction is high, the HODL bank is increasing, and the price of the underlying token is low, which means it is an ideal time to invest. On the flip side, a high Reserve Risk is indication that HODLer conviction is low, the HODL bank is decreasing, and the price of the underlying token is high, making it an unattractive investment.
Low reserve risk and high reserve risk can typically be associated with relative undervaluation and overvaluation, respectively. For low reserve risk, the process can begin at the end of a bear market to the start of a bull market and slowly mature as unspent opportunity cost accumulates (which tends to take time). On the flip side, events associated with high reserve risk happen quickly and rapidly. In these situations, there is high incentive to sell, and so a rally typically occurs near the end of a bull market where long-term HODLers will cash in their realised profits, causing the market to shift back after many of the HODLers have sold their long-held tokens.
For a simple rule of thumb, one can use the following guideline for analysing reserve risk:
- Reserve Risk < 0.0026: Based on historical performance, during this time, the asset is undervalued
- Reserve Risk > 0.0200: Based on historical performance, during this time, the asset is overvalued. Tends to occur at local peaks, and resolves quickly
Formula and Calculation
The first step is calculating the Value of Coin-days Destroyed, which is a variation on the Supply-Adjusted CDD that calculates the USD value of daily Supply-Adjused CDDs
Next we calculate the HODL bank. Recall that the HODL bank serves as a measure of the opportunity cost incurred by HODLers who don’t realise their profits. This is measured by the difference between the current price and the median value of CDD (we take median to avoid outliers).
Finally, we calculate the Reserve Risk by comparing the current price to the calculated HODL Bank.
For simplicity, we will assume the daily Supply Adjusted CDDs and prices have already been determined.
from statistics import mediandef reserve_risk(prices, supply_adjusted_cdd):
vocdd = [price * cdd for price, cdd in zip(prices, supply_adjusted_cdd)]
median_val = median(vocdd)
hodl_bank = sum(price - median_val for price in prices)
return prices[-1] / hodl_bankprices = [40157, 39855, 40224, 39924, 40128, 39504, 40144, 40450, 39517, 40352, 39781, 39724, 40106, 39798, 40116, 39856, 39773, 40419, 39715, 39699, 40302, 40121, 39896, 40288, 40089, 39624, 40005, 39933, 40304, 40248, 39566, 39931, 40253, 39682, 40436, 40153, 39796, 40387, 39816, 40182, 40251, 40055, 39620, 39637, 39686, 39508, 40067, 39990, 40293, 39811, 39580, 40337, 40074, 39910, 40340, 39963, 39871, 39633, 40293, 40367, 40496, 40197, 40402, 40099, 39823, 39679, 40227, 39535, 40090, 40060, 40109, 40382, 40499, 40340, 39926, 39657, 39545, 40497, 40460, 39942, 40458, 39647, 39828, 40292, 39621, 40179, 39656, 39927, 39933, 40257, 39809, 40133, 40212, 39911, 40164, 40374, 40450, 40142, 40243, 39581]supply_adjusted_cdd = [0.72, 0.87, 0.85, 0.86, 0.53, 0.4, 0.17, 1.01, 0.31, 0.78, 0.47, 1.02, 0.64, 0.3, 0.35, 1.0, 0.21, 1.02, 0.34, 1.01, 0.78, 0.49, 0.46, 0.16, 0.33, 0.43, 0.81, 0.71, 0.94, 0.64, 0.23, 0.82, 0.88, 0.72, 0.48, 1.09, 0.34, 0.7, 0.82, 0.23, 0.94, 0.44, 0.5, 0.72, 0.88, 0.46, 0.56, 0.84, 0.49, 0.7, 0.44, 0.37, 0.41, 0.32, 0.85, 0.33, 0.83, 0.39, 0.85, 0.43, 0.28, 0.79, 0.86, 0.49, 0.65, 0.26, 0.33, 0.58, 0.59, 0.29, 0.9, 1.01, 0.88, 0.96, 0.31, 0.62, 0.93, 1.04, 0.2, 0.46, 0.5, 0.23, 0.7, 1.04, 0.65, 0.25, 0.45, 0.92, 0.64, 0.61, 0.28, 0.4, 0.95, 0.51, 0.41, 0.43, 0.63, 0.36, 0.37, 0.63]>>> print(reserve_risk(prices, supply_adjusted_cdd))
Mitchell wants to predict the movement of the market by looking at the behaviour of long-term HODLers. He begins by collecting the daily prices over the past few years, and collects the Supply Adjusted CDDs over the same time period. He determines the median Value of Coin-Days Destroyed by multiplying these prices by the associated Supply Adjusted CDD, and calculates the median value to be 3.16. He then calculates the HODL bank by summing the differences between all of the historical prices and the median Value of CDD, getting a value of 4838. He divides the current price, 9.1922, by the calculated HODL bank, getting a value for the Reserve Risk of 0.0019. As this is less than 0.0026, he determines that the asset is undervalued, and so looks to invest in the coin.
16. MVRV Ratio
The market value to realized value is simply a ratio of an asset’s market cap versus its realized cap. In essence, the MVRV ratio seeks to determine whether an asset is priced above or below its “fair value”. In situations where the market value and realized value differ greatly, we can infer that the market is either at a top or a bottom since they reflect periods where investors have extreme unrealized profit and unrealized loss, respectively. Examining it from a macro view, the MVRV is an analytical tool that is a study of aggregate investor behavior as the price moves. It can also be modelled as a mean reversion model where realized cap functions as the mean, and MVRV measures deviations from this mean.
MVRV is a relatively simple metric and leaves little room for ambiguity. By plotting the market value versus the realised value of BTC over a time period, we can immediately see the intuition behind the ratio.
The realised value has a strong correlation with the market value for obvious reasons, but it behaves more like a step function than a smooth curve. This is because the realised value changes in response to a bull / bear market, where undervaluations/overvaluations are remedied by market forces and investors realising their profits/losses. If every investor held their tokens during a massive swing in the market cap, then the realised cap would stay flat. Hence, by simply comparing these two valuations we can determine whether a token is undervalued, overvalued, or fairly valued.
In the case of a high MVRV value, it indicates that the price has diverged greatly from the cost basis, meaning there is a large opportunity for profitability across the market. In other words, there is strong incentive for holders to sell their tokens. Extreme values (typically considered > 3.5–3.7) are a strong indication of an incoming bear market as investors will begin to realise their profits.
On the flip side, in the case of a low MVRV, we can make the assumption that a bear market is at its bottom. The logic is similar to the high MVRV case — the price has fallen below the cost basis, which means that investors are either holding low unrealized profits or large unrealized losses, and in most cases, they will give into the bear market, abandon their positions (temporarily worsening the bear market as they sell their positions), and re-accumulate while the token is at a market bottom. The threshold for a market bottom is less strict than a market top: even when the MVRV falls just below 1, a bear market has a good chance to follow.
Formula and Calculation
The MVRV is calculated by simply getting the ratio of market cap to realised cap
Where Realised Cap is a variation on the market cap that measures the values of UTXOs when they were last traded, instead of their current values at the current price point, which is what Market cap measures.
def mtrv(prices, sizes):
market_cap = prices[-1] * sum(sizes)
realised_cap = sum(x * y for x, y in zip(prices, sizes))
return market_cap / realised_cap# UTXOS seperated into the price they were bought at, and their sizes.
# Note that the last entry in prices is the current price
prices = [40234,40183,39834,41934,40189, 40123]
sizes = [40, 32, 45, 21, 34, 12]# Since this is a small sample size, the ratio will be close to 1
>>> print(mtrv(prices, sizes))
Julia wants to use market cap and realized cap to predict the trends in the market for a coin $ABC — namely whether the market seems to be approaching a peak or a trough. To do this, she collects all of the UTXOs from the past few years and stores them in a list, keeping track of the last price those UTXOs were traded at. She then calculates the market cap by multiplying the current price by the total size of her collected UTXOs. Then, she calculates the realized cap by summing up the prices these UTXOs were traded at multiplied by the sizes of those UTXOs, and finds the ratio between these two, getting an MVRV of 3.9. Because of how high it is, Julia makes the assumption that the market is at or soon to be at a top, and prepares to take a short position.