Volatility as risk proxy
This page explains some of the details of measuring volatility and sheds light on the type of analysis Marginly performs for measuring protocol risks.
Last updated
This page explains some of the details of measuring volatility and sheds light on the type of analysis Marginly performs for measuring protocol risks.
Last updated
There are several ways to handle volatility on-chain:
Approach | Pros | Cons |
---|---|---|
Marginly v1 will initially follow the first approach while aiming to use the same AMM pools to calculate volatility directly on liquidity that the Marginly pool will be trading against.
Marginly tracks the close-to-close estimator as the most commonly used volatility measure. The standard definition of volatility is the square root of the variance, and variance is defined as:
where each x_i are logarithmic return and x dashed is a mean return.
When looking at asset time series, it is tough to distinguish mean returns (the drift or trend of the price) from variance, and estimates of the mean return are notoriously noisy, especially for small samples. So we generally set the mean return in the equation of sample variance above to zero. This increases the accuracy of measurement by removing a source of noise. Note that we are not claiming that assets have zero drift. We merely state that simultaneous estimation of mean returns and variance leads to noisy results.
The one big problem with a close-to-close estimator is that it converges slowly to actual volatility (population variance) with the growth of the number of samples N. Volatility measurements have significant uncertainty associated with them, and for very small sample sizes, this can overwhelm any information completely. So we have to choose a sample size that achieves a balance between including data from periods that are no longer relevant and using too little data so that sampling error dominates.
To mitigate the problem, we can use intraday frequency to calculate volatility. We sample 4-hour closing prices for the past 30 days to calculate an actual volatility measure, resulting in a total of 180 data points which is enough to reduce sampling error significantly.
Now that we know how to calculate volatility let's put it into context: we have a dataset of daily closing prices of WETH/USDC starting from 1 Jan 2020. Based on this data, we calculate log returns and then volatilities over non-overlapping periods of 20, 30, 60, 90, 120, 150, and 180 days.
To gain the most information from a given price series, it would generally be necessary to use overlapping data. This will induce an artificial degree of correlation in the estimates of volatility and will bias our results somewhat. If we use 30-day volatility and roll this forward by one day, we will still have 29 data points in common with the first data set. The two volatilities will be highly correlated because they are almost the same. Variance from overlapping return series needs to be adjusted by a factor given by a fancy formula, which we won’t show here, but definitely take into account when calculating volatilities.
The cone shows the tendency for short-term volatilities to fluctuate more widely than longer-dated volatilities. This is due to the effects of increased sampling errors for short-term estimates and the fact that big moves will be averaged away in the longer term. The chart shows that the long-term average volatility is around 5% a day. Armed with this knowledge you can gauge the typical asset move you might expect given its current price, volatility level, and time period you're considering:
So for example, given the ETH price of ~2000 USDC, 5% daily volatility, and 5 days period, we can expect it to move it ~ 223 USDC in either direction or in relative terms around 11%.
Looking at intraday data in the same format (here, we use one-hour samples for the past 30 days and the close-to-close estimator), we see the following picture: average volatility has a wider possible range and is skewed to the upside. The median value of 3% tells us that past 30 days, there hasn't been much price action in the ETH-USD price pair. Note that it's common to see values up to 8% (these are the numbers we observed during the 2022 bear market).
Further looking at the historical volatility distribution, we can confirm the above picture.
The diagram clearly shows what actual close-to-close volatility has been in the past over the sample period we examine. We can see several distinct volatility peaks: a Gaussian blob centered around 4-5% daily volatility (the long-term average volatility we estimated earlier) and a fat proper tale with several distinct peaks around 8%, 10%, and 12%, respectively. The regime shift (low volatility vs. high volatility) is around 7%. We will deploy Marginly v1 contracts with this initial volatility parameter value.
Setup a risk framework to periodically set the volatility parameter via governance.
Easy to implement.
Doesn’t require on-chain computation.
Changing volatility parameter takes considerable time.
Calculate volatility on-chain using oracle and / or on-chain AMM prices.
Flexibility. Many ways to do calculations.
Fully decentralized approach.
Costly computations.
High variance, high bias models.
Fetch volatility from oracle or 3rd party protocols.
Outsource of computation.
Limited or no available options at the moment.
Requires trust in a 3rd party oracle provider.