0

For my analysis I need a measure of volatility for government bonds. On Bloomberg I could not find any good measure of volatility - they offer some measures which are based on the close prices of each day (that is, from each day only one number is used), which is not precise enough, since I would like to have a measure of volatility for every day (fluctuations during the day).

However, from Bloomberg I can get open price, close price, high price and low price. The difference between high price and low price could be a simple measure which I could use to distinguish between days with large and small fluctuations. But are there some other ways to use these four numbers to get an estimation of volatility for every day? Thanks!

UPDATE: I can see in the comments that I can use Garman Klass volatility. I have tried to use in the package TTR, but a few things do not make sense to me. If I use the example in the help file:

library(TTR)
data(ttrc)
ohlc <- ttrc[,c("Open","High","Low","Close")]
MyVolatility=volatility(ohlc, calc="garman.klass")

Then MyVolatility will have an estimate for each day. But

  1. How does it know which variables are which? I have tried to change the name of "Close" to another name, and it still gives the calculations. So, should the variables have this exact ordering?

  2. Does it automatically take the right parameters, like N or is there something I need to specify?

  3. In this example the first 9 estimates in the MyVolatility are NA. Does that mean that each day's volatility is based on 9 days and not on single day? I mean, would it make sense to use this estimate to determine whether day t is different from day t+1 in terms of fluctuations?

  4. Finally, is there a way for it to stop giving error if one of the numbers is missing? Like, in other functions one can use na.rm=T.

To sum up, I would like to know the following. Suppose I have a dataframe MyData with many variables including Date, High_Price, Low_Price, Open_Price, Close_Price, and I would like to mutate the volatility estimate for each day like in dplyr. What do I have to write in my code?
And what if I have different bonds in my dataset, is it possible to use dplyr with a group_by?

Thanks a lot!

Avocado
  • 45
  • 4
  • Google Garman Klass volatility. But note that for a good estimate you need OHLC for more than one day, from one day only the estimate will be quite inaccurate. – nbbo2 Apr 14 '23 at 12:10
  • 1
    Check my answer for more on Garman Klass and a link to the TTR package which has a number of estimators. – Bob Jansen Apr 14 '23 at 15:34
  • @BobJansen Thanks a lot! Nice to know that it is already a part of a package. However, a few things still do not make sense to me. I have updated the question - could you please clarify (1-4) and tell me me which code I need to write? Thanks a lot in advance! – Avocado Apr 15 '23 at 16:45
  • @nbbo2 Same comment :-) – Avocado Apr 15 '23 at 16:46

0 Answers0