The resource loading... loading...

How to measure the risk of holding VaR

Author: The grass, Created: 2023-11-03 14:46:29, Updated: 2023-11-06 19:42:20

img

Managing risk is a skill that every investor needs to learn, and in the face of the ever-changing and ever-evolving digital currency market, procedural traders need to pay particular attention to risk management. This is because procedural trading often relies on historical data and statistical models to automatically execute trades, which can quickly become inaccurate in rapidly fluctuating markets. Therefore, effective risk management strategies are essential to protect investors' capital.

In many risk management tools, Value at Risk (VaR) is a widely used measure of risk that helps investors predict the maximum possible loss of a portfolio under normal market conditions. VaR is able to quantify risk into a single number, simplifying the expression of risk, allowing investors to intuitively understand potential losses.

The Role of VaR

VaR, or the Value-at-Risk Ratio, is used to quantify the maximum possible loss that can be sustained in a given time period, according to a certain level of confidence. In other words, it tells the investor or risk manager: VaR, how much money we have in normal market conditions is within the range of the VaR safe hedge, and will not be lost tomorrow.

Benefits

  1. Easy to understandFor example, a 95% VaR of a digital currency portfolio is $5,000 per day, which means that there is a 95% confidence that the portfolio will not lose more than $5,000 per day. Quantify complex risk into an intuitive number that is easy for non-professionals to understand.

  2. Comparison of standardsLet's assume that there are two portfolios A and B, A has a 95% VaR of $3,000 and B has a 95% VaR of $6,000. This means that under normal market conditions, A is less risky than B. Even if the two portfolios contain different assets, we can directly compare their levels of risk. Accordingly, we can judge the level of investment if the average and maximum return of A and B in the last month is $6,000, and A has a significantly lower VaR than B. We can conclude that strategy A is better and achieves higher returns at a lower level of risk.

  3. Decision-making toolsA trader may use VaR to decide whether to add a new asset to the portfolio. If the new asset causes a significant increase in VaR, this may mean that the risk of the new asset does not match the risk tolerance of the portfolio.

Disadvantages

  1. Ignoring the Tail Risk: If a portfolio has a one-day 99% VaR of $10,000, then the loss in the 1% extreme case could be much higher than this value. In the digital currency space, black swan events are frequent, and extreme events will exceed most people's expectations because the VaR does not take into account tail events.

  2. Supposed restrictionsThe VaR parameter usually assumes that the returns on assets are normally distributed, which is rarely established in real markets, especially in the digital currency market. For example, suppose that there is only Bitcoin in an investment portfolio, we use the VaR parameter and assume that the returns on Bitcoin are normally distributed. But in reality, Bitcoin's returns may jump significantly in certain periods, and there is a phenomenon of apparent volatility accumulation, such as the past frequency is very high, the next one is more likely to increase significantly, which leads to the underestimation of the risk of the normal distribution.

  3. Dependence on historyVaR models rely on historical data to predict future risks. However, past performance does not always predict future conditions, especially in rapidly changing markets such as the digital currency market. For example, if Bitcoin has been very stable over the past year, historical models may predict a very low VaR. However, if there is a sudden regulatory change or market crash, past data will no longer be an effective predictor of future risks.

Calculation of VaR

There are three main methods of calculating VaR: the parametric method (difference-correspondence method): assuming that the yield follows some distribution (usually an normal distribution), using the mean and standard deviation of the yield to calculate VaR. The historical simulation method: making no assumptions about the yield distribution, using historical data directly to determine the potential loss distribution. The Monte Carlo simulation: using randomly generated price paths to simulate the price of an asset and calculate VaR from it.

Historical simulation is a method that directly uses past price changes to estimate possible future losses. It does not require any assumptions about earnings distribution and is therefore applicable to assets where earnings distribution is unknown or unusual, such as digital currencies.

For example, if we want to calculate the 95% VaR of this portfolio for one day, we can do this:

  1. It collects the daily rate of return on Bitcoin over the past period of time (e.g. 100 days).
  2. Calculate the daily return on the portfolio, i.e. the return on each asset multiplied by its weight in the portfolio.
  3. The 100 day portfolio returns are sorted from small to large.
  4. Find the 5% data point (because we are calculating 95% VaR), which represents the loss rate for the worst 5 days and the best 5 days of the last 100 days.
  5. This yield is multiplied by the total value of the holdings, which is 95% VaR per day.

Below is a specific code that uses data from the last 1000 days to calculate the VaR of a Bitcoin holder at 1980 USDT.

import numpy as np
import requests

url = 'https://api.binance.com/api/v3/klines?symbol=%s&interval=%s&limit=1000'%('BTCUSDT','1d')
res = requests.get(url)
data = res.json()

confidence_level = 0.95
closing_prices = [float(day[4]) for day in data]
log_returns = np.diff(np.log(closing_prices))
VaR = np.percentile(log_returns, (1 - confidence_level) * 100)
money_at_risk = VaR * closing_prices[-1] * 1

print(f"VaR at {confidence_level*100}% confidence level is {money_at_risk}")

VaR computation considered for relevance

When calculating VaR for portfolios containing multiple assets, we must consider the correlation between the assets. If the price movements between the assets are positively correlated, the risk of the portfolio increases; if they are negatively correlated, the risk of the portfolio decreases.

When using the historical simulation method to calculate the correlational VaR, we not only collect the historical returns of each individual asset, but also consider the combined distribution of these returns. In practice, you can sort and calculate the historical returns directly from the portfolio, as these returns already imply the correlation between the assets. In the digital currency market, correlation is especially important, basically because BTC is the market leader, and the probability of other digital currencies rising increases if BTC goes up or down rapidly, because market sentiment can change rapidly, leading to a significant increase in correlation in the short term, which is especially common in extreme market events.

Using the example of holding 1 BTC multi-position and 10 ETH blank positions, the VaR for 10 ETH blank positions can be calculated as 1219 USDT. When the two asset portfolios are combined, the VaR is calculated as follows:

confidence_level = 0.95
btc_closing_prices = np.array([float(day[4]) for day in btc_data])
eth_closing_prices = np.array([float(day[4]) for day in eth_data])
btc_log_returns = np.diff(np.log(btc_closing_prices))
eth_log_returns = np.diff(np.log(eth_closing_prices))

log_returns = (1*btc_log_returns*btc_closing_prices[1:] - 10*eth_log_returns*eth_closing_prices[1:])/(1*btc_closing_prices[1:] + 10*eth_closing_prices[1:])
VaR = np.percentile(log_returns, (1 - confidence_level) * 100)
money_at_risk = VaR * (btc_closing_prices[-1] * 1 + eth_closing_prices[-1]*10)

print(f"VaR at {confidence_level*100}% confidence level is {money_at_risk}")

The result is 970 USDT, which means that the portfolio is less risky than the corresponding assets held separately, as the markets for BTC and ETH are highly correlated, and the hedging of the multi-space portfolio serves to reduce the risk.

Summary

This article introduces an adaptive risk assessment method, the application of historical simulation (Historical Simulation) to calculate VaR, and how to consider correlations between assets to optimize risk forecasting. Through specific examples of the digital currency market, it is explained how to use historical simulation to assess portfolio risk, and discusses how to calculate VaR when the asset-related returns are significant.


More