Sunday, August 30, 2015

high frequency - How to calculate historical intraday volatility?


Sorry for what must be a beginner question, but when I went to write code I realized I didn't understand exactly how historical volatility, or statistical volatility, is defined. Wikipedia tells me "volatility is the standard deviation of the instrument's logarithmic returns", and logarithmic return is defined as $\ln\left(\frac{V_f}{V_i}\right)$, where $V_f$ is closing price and $V_i$ is opening price.


If I want to calculate the volatility of a minute bar, from the raw ticks, do I just use the first and last tick in that minute? If I use first and last ticks in the minute (i.e. bar open/close), I will have a single logarithmic return, so s.d. of that one value will be 0. In an answer to this question, the intraday volatility chart is described as U-shaped. Exactly what sums do I need to do to generate that intraday volatility chart from the day's ticks?


In R terms, is logarithmic return:



#x is xts object containing ticks
r = na.omit( lag(x)/x )
lnr = log(r)

Background: I have a stream of ticks, and as I turn them into minute (and higher period) bars (using R's xts module) I also calculate the mean and s.d. Is the standard financial measure of volatility different from standard deviation? If not, can one be derived from the other?


If the above definition of volatility is correct, my answer (based on eyeballing the plots, and on running cor) seems to be that they are really quite different; I'm still chewing over how that gels with the answers here.



Answer



The expression you have is fine. But more generally, for the intraday volatility, I don't think there "the correct definition". More like, whatever works in the given context. I found the following notes by Almgren pretty useful:


http://cims.nyu.edu/~almgren/timeseries/notes7.pdf


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...