4 Useful Metrics for Algorithmic Traders, Week 3

Introduction

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.

9. Herfindahl–Hirschman Index

Abstract

The Herfindahl–Hirschman index, commonly referred to as a HHI-score, is a measure of market concentration and is often used to determine the overall competitiveness of an industry. In the context of cryptocurrency and Web3, one can use the HHI-score to determine the overall decentralisation of an asset. Specifically, it can measure how concentrated the supply of a token is amongst all of the addresses in an ecosystem. The HHI-score for an ecosystem falls between 0 and 10,000. Results are typically interpreted as follows:

  • HHI < 1,500: The market is competitive
  • 1,500 ≤ HHI ≤ 2500: The market is moderately concentrated
  • HHI ≥ 2500: The market is highly concentrated

Use Cases

HHI-scores have a strong involvement in competition law in traditional finance. The U.S department of Justice uses HHI-scores to determine whether a merger between two or more firms raises anti-trust concerns: mergers that increase the HHI by noticeable amounts raise issues in regards to antitrust — the FTC and Department of Justice have a guidelines for horizontal merges that show how they use HHI for analysing industries:

The Agencies employ the following general standards for the relevant markets they have defined:

Small Change in Concentration: Mergers involving an increase in the HHI of less than 100 points are unlikely to have adverse competitive effects and ordinarily require no further analysis.

Unconcentrated Markets: Mergers resulting in unconcentrated markets are unlikely to have adverse competitive effects and ordinarily require no further analysis.

Moderately Concentrated Markets: Mergers resulting in moderately concentrated markets that involve an increase in the HHI of more than 100 points potentially raise significant competitive concerns and often warrant scrutiny.

Highly Concentrated Markets: Mergers resulting in highly concentrated markets that involve an increase in the HHI of between 100 points and 200 points potentially raise significant competitive concerns and often warrant scrutiny. Mergers resulting in highly concentrated markets that involve an increase in the HHI of more than 200 points will be presumed to be likely to enhance market power. The presumption may be rebutted by persuasive evidence showing that the merger is unlikely to enhance market power.

The intuition for HHI can be applied to crypto with similar thinking as traditional markets. Coindesk used it to analyse the concentration in Bitcoin mining overtime for the top 9 countries that engage in the practice, and derived some interesting results:

What this figure shows is that bitcoin mining has become more competitive between nations over the past few years.

Formula and Calculation

The formula for the HHI is simply

Where H is the HHI, N is the total number of firms, wallets, e.t.c., and s_i is the share of agent i in the market. To calculate the HHI for a cryptocurrency, we can find the total circulating supply not owned by special wallets (exchanges, smart contracts, e.t.c.), and determine the share that each wallet holds of the total supply. Then, the HHI for that token will be the sum of the squares of the distribution of market share.

There is also the normalised version of the HHI index, which ranges from 0 to 1 and removes information about the total number of agents, which means it can be useful as a measure of equality but not for concentration (as a system with 10,000 agents that each have the same share in the market is obviously more competitive than a system with 2 agents that both have 50%, but they are both perfectly equal):

Code

def HHI(market_shares):
return sum(map(lambda x: x**2, market_shares))
>>> print(HHI([50,25,25]))
3750
>>> print(HHI([50,50]))
5000
>>> print(HHI([1]*100))
100

Example

John is managing an ERC-20 token and wants to determine how concentrated his token is. He first finds the total circulating supply amongst token holders, and then determines how much of a share each token holder has. He determines that there are 3 addresses, A, B, and C, and determines the following:

  • A has 70% of the tokens
  • B has 25% of the tokens
  • C has 5% of the tokens

He calculates the HHI of his token as 70² + 25² + 5² = 5550, and so comes to the conclusion that his token is highly concentrated

References

https://www.justice.gov/atr/horizontal-merger-guidelines-08192010#5c

https://www.coindesk.com/markets/2021/10/17/bitcoin-mining-is-decentralizing-heres-proof/

10. Fee Ratio Multiple

Abstract

In order to keep the security of a PoW network up to a high standard, sufficient monetary incentive needs to be given to miners who contribute electricity to keep the network running. The share of a protocol allocated to sustaining this is called the security budget, and it is important to ensure that the security budget is sufficiently high at all times. However, as the block rewards in a chain diminish for deflationary purposes (in the case of Bitcoin, halving every 4 years), there is a gap that needs to be filled via some other form of subsidy. This is almost always via transaction fees, and so, an important questions begins to be asked by the community: “If the block rewards of a chain disappeared, what percentage of the total volume would need to be paid in fees in order to replace them?”.

The answer to this calculation is simply the Miner Revenue divided by the Transaction Volume, a metric called the Fee Ratio. One can use this to make assumptions about the security of a blockchain once block rewards disappear. In general, a low FR is desirable. However, a chain’s Fee Ratio can be extended to provide more insights into how the security of the chain will perform as block rewards tend to zero. The Fee Ratio Multiple is a measure of what multiple of the existing revenue from transaction fees would be necessary to reach the Fee Ratio. In other words, at the current stage in the chain’s lifecycle, by what factor do fees have to increase to match the security budget (Total revenue paid to miners)?

Use Cases

One can use FRM to predict the movements in transaction fees for a chain as block rewards diminish to 0. If a protocol has a high FRM, say, 100, that means that in order to keep the security of a network at its current level, transaction fee revenue will eventually have to go up by 100x once block rewards are phased out. On the other hand, a low FRM should imply that the transaction fee revenue of a chain won’t have to increase that much to maintain security levels. Note that FRM should be expected to have a strong inverse correlation to volume: Higher volume → More assets are being moved to be traded → More transactions → More fees being generated → Higher transaction fee revenue → lower FRM.

In examining the long term value of an investment into a protocol with deflationary practices, one can use FRM to predict that tokens with consistently high FRM must either:

  1. Drastically increase transaction fee revenue (whether that be increasing fees or increasing transactions)
  2. Reduce the security budget, risking that the security of the network is compromised
  3. Limit deflationary actions

All of these scenarios carry heavy for risk for a protocol, and so an investor looking to save for retirement should look before they leap.

Formula and Calculation

Code

def calc_frm(block_rewards: float, transaction_fee_rev: float):
return (block_rewards + transaction_fee_rev) / transaction_fee_rev
>>> print(calc_frm(3.4, 0.1))
35.0
>>> print(calc_frm(57, 0.34))
168.64705882352942

Example

James is looking for a coin he can put some his savings into, leave for 10 years, and then come back to with a healthy return. He looks around for projects, and narrows it down to 2: ABCchain and XYZchain, with tokens $ABC and $XYZ, respectively. They have similar metrics (price, supply, volume, e.t.c.), and both use Proof of Work consensus protocols alongside deflationary tactics (halving every 3 years). So, to decide, James looks at the tokenomics of both. He notices that they both pay out the same amount of tokens to their miners. However, he notices that for ABCchain, the payout is 99.99% block rewards, and 0.01% transaction fee revenue, while for XYZchain, the payout is 95% block rewards, and 5% transaction fee revenue. He calculates their respective Fee Ratio Multiples as 10000 and 20, and so chooses XYZchain as he believes it to be more stable in the long term.

References

https://medium.com/coinmonks/introducing-fee-ratio-multiple-frm-1eada9ac9bec

https://medium.com/coinmonks/bitcoins-fee-ratio-multiple-explained-and-why-bitcoin-wins-in-the-end-f62c4d1f0e59

11. Issuance

Hence we can look at the issuance over a daily window, 3-day window, 5-day window etc.

Although the concept of issuance stays the same across all assets which can be minted, the way to calculate issuance depends on how the minting process works. For instance, Bitcoin’s issuance is done purely through mining and distributed to miners, while some governance tokens are distributed based on gradual issuance, airdrops, or staking rewards.

Use Case

Issuance has a wide variety of applications as it provides insights into the tokenomic mechanisms of cryptocurrencies and tokens.

A developer responsible for the tokenomics for a protocol can monitor the issuance of the token over time to validate their smart contract’s implementation. Given an expected issuance curve under many scenarios, the developer can look at how much the actual issuance deviates from what they expected. The debugging process can be significantly sped up by looking at the magnitude and direction of the issuance error.

Portfolio managers can use the issuance for a particular asset to calculate the expected inflation rate when evaluating whether or not to hold the token long term. By extension, issuance can be used in economic and risk analysis to assess the network’s token health and sustainability.

Formula and Calculation

The most efficient way to calculate issuance differs on a case-by-case basis depending on how the cryptocurrency is issued. In a general case, the issuance can be calculated by taking the total token supply at a particular point in time and taking the difference of that from the token supply in the future.

The issuance between two points in time A and B where time B is later than time A is

where T_A and T_B are the total token supplies at time A and B respectively.

A and B can be any two points in time, so there are an unlimited number of time windows for which issuance can be calculated for.

Example

John is a smart contract developer assigned with implementing the tokenomics for a token ABC. The requirement is that there will be 10000 tokens initially minted with exactly 95% of the total expected supply issued in one years time.

To achieve this, he bases the daily issuance policy on an exponentially decaying curve with an initial minting of 10000 coins. He calculates that the correct minting rate to achieve the requirements is a decay constant of 0.05.

He implements the smart contract but accidentally sets the decay constant at 0.04 instead. This means that more than 95% of the supply would be issued after one year. He graphs the projected issuance resulting from the incorrect implementation, and finds that more tokens are minted than expected. He then goes back to his code and fixes the bug accordingly.

Code

def issuance(Ta, Tb):
"""Calculates the issuance for the time between A and B
Parameters
----------
Ta: Total token supply at time A.
Tb: Total token supply at time B.
"""
return Tb - Ta

References

https://docs.ethhub.io/ethereum-basics/monetary-policy/

https://study.com/academy/lesson/common-stock-definition-issuance-formula.html

https://academy.binance.com/en/glossary/issuance

12. Puell Multiple

Abstract

The Puell Multiple is calculated by taking the daily issuance of Bitcoin in USD and dividing it by the 365 days moving average of issuance in USD. It compares the value generated by miners in the previous day to how much USD value of Bitcoin was generated on average per day in the past year.

The indicator measures the profitability of Bitcoin mining over time by examining the supply side of Bitcoin’s economy. Rises and falls in the Puell Multiple are indicative of the changes in incentive are for current miners compared to over a long period of time. The Puell Multiple was designed for Bitcoin and cryptocurrencies with a similar minting mechanism to Bitcoin, so caution needs to be taken when using it as an indicator for tokens which use other algorithms for validation such as PoS, BFT, and Pol.

Use Case

A high Puell Multiple value indicates that short term mining revenue is increasing significantly relative to the average long term revenue. Likewise, mining pools are relatively less profitable when the Puell Multiple is low. If the Puell Multiple has a value of 2, it means that the USD value of Bitcoin revenue earned today is twice as much as the daily USD value of Bitcoin earned averaged daily over the past year.

As an econometric indicator, the Puell Multiple explores market cycles from a mining revenue perspective. By examining cyclic patterns in the Puell Multiple’s value, we can easier understand how current revenue entering the ecosystem compares to historical norms.

To understand the state of the current market cycle, it is good to look at both the trend in the indicator and the present value. Quants sometimes use the value as a trade signal:

  • Value over 4 = Short Signal: A high Puell Multiple indicates that mining revenue is significantly higher relative to the revenue in the long term. Since miners run hardware and incur an upkeep cost to run their validation nodes, it can be inferred that the profit that they accumulate in the present is much higher than what they have received in the recent past. Since this also implies that the real price of Bitcoin has significantly increased, it could indicate that Bitcoin is overpriced since there is a great incentive for miners to sell their reserves.
  • Value under 0.5 = Long Signal: A lower Puell Multiple indicates that mining revenue has decreased significantly relative to their long term revenue. Bitcoin prices may have dropped below the levels where mining would create enough profit for miners to continue running their nodes. Supply-side producers may leave the ecosystem, hence increasing the concentration of Bitcoin among the miners who are left. Remaining miners are incentivised to hold their profits to sell Bitcoin at a higher price. Hence, a lower Puell Mutliple could imply that Bitcoin is undervalued.

Formula and Calculation

The Puell Multiple was designed for Bitcoin, so users looking to apply this indicator to other cryptocurrencies for generating trade signals must do so with caution.

Example

Abby is a quant trader who is looking at incorporating more indicators into her BTC trading strategy. Since she already utilises a variety of price based trading signals in her algorithm, using an indicator which focuses on another aspect of the Bitcoin ecosystem.

Seeing that the Puell Multiple describes Bitcoin’s supply-side economy, Abby uses the present value as a signal to supplement her current trading strategy. By looking at the long-term trends in the indicator’s value, she identifies that values of 3 and 0.5 are roughly indicative of where the Puell Multiple is “high” and “low”. She sets the parameters so that her algorithm favours selling when the Puell Multiple is greater than 3, and favours buying when it is lower than 0.5.

Abby backtests her algorithm and adjusts her parameters to optimise her returns. She now deploys her strategy, newly equipped to also take the supply side dynamics of Bitcoin’s economy into account.

Code

import pandas as pd
import numpy as np
def puell_multiple(mining_revenue):
"""Returns an array of the Puell Multiple on each day
given an array of the daily mining revenue of Bitcoin.

Parameters
----------
mining_revenue: 1D array of daily mining revenues for
at least the past 365 days.
"""
revenue = pd.DataFrame(mining_revenue)
revenue['avg'] = revenue.rolling(365).mean()
revenue['puell_multiple'] = revenue[0]/revenue['avg']
return np.array(revenue['puell_multiple'])

References

https://medium.com/unconfiscatable/the-puell-multiple-bed755cfe358

https://www.lookintobitcoin.com/charts/puell-multiple/

https://stats.buybitcoinworldwide.com/puell-multiple/

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
GDA Fund

GDA Fund

222 Followers

GDA is developing the decentralized financial application development environment and rapid financial engineering protocol built on Ethereum.