# Calculating 6-minute, 20-minute, 45-minute, and 3-hour volatility

I am looking to measure the volatility from the open of the market until a trade takes place and use that volatility in post-trade regressions to help explain transaction costs. A simple regression would be $Cost_{trade} = \beta_0 + \beta_1\cdot(Volatility_{FromOpenUntilTrade})$

To calculate the $Volatility_{FromOpenUntilTrade}$ I was going to use 5-minute Realized Variance (RV) which is defined as the sum of the 5-minute squared log returns. Since I am using 5 minute RV, I will not calculate an RV for any trade that takes place within the first 5 minutes. For all other trades there will be at least one 5-minute bucket and I will scale it up using the square root of time.

For example if a trade takes place in the 6th minute:

1. I take the first 5-minute RV. Suppose for example that it's $.0000129$.
2. Then take the square root to get the volatility $.0035$.
3. Then scale this up to get a scaled daily volatility $.0035\cdot\sqrt{\frac{78}{1}}\approx 3.1\%$ daily vol. I am using $78$ because there are $78$ 5-minute buckets in a trading day.
4. Then scale this "daily" value to an annualized number: $\sqrt{252}\cdot3.1\% = 50\%$ annualized vol
5. Then I can use this annualized volatility as a explanatory variable in the regression above.

Similarly if a trade takes place in the last minute I would use $77$ of the $78$ 5-minute buckets to calculate the RV and the daily scaling factor would be $\sqrt{\frac{78}{77}}$. So for each trade the "daily" scaling factor depends on the bucket in which the trade took place.

My question is this: Does calculating an annualized number only using one bucket have too much error associated with it since the sample size is small or is it acceptable to use one 5-minute bucket as the RV? If it is not acceptable can you offer any suggestions?

• I'm missing something here. Are you using every trade from the day in your regression, or just the first trade? If you're only using the first trade, then how can you ever have more than on observation in your realised volatility? Even if the first trade occurs 60 minutes into the day, this means that every 5-minute return from 0 to 55 minutes will (if you're following the usual rules) be set equal to zero... Aug 5, 2015 at 22:44
• Let's say you have 100 trades on a 100 different days. Each trade will have a cost and each trade will have a volatility from the time the market opens to the time of the trade. For example let's say trade 1 on day 1 occurs in the 6th minute so there is 1 5-minute bucket available to calculate RV. Trade 2 on day 2 occurs in the 16th minute so there are 2 5-minute buckets to calculate RV. And let's say trade 3 occurs in the 301st minute so there are 60 5-minute buckets to calculate RV from. The cost of each trade and the RV (annualized) would go into the regression. *(continued) Aug 6, 2015 at 0:22
• So there'd be 100 RVs and 100 costs used to run the regression. Does that help? I am asking if for some trades there can be only 1 or 2 buckets to calculate an RV. In the case of a trade that takes place in the 6th minute there is only 1 bucket and I am asking is that acceptable. Aug 6, 2015 at 0:22
• Nearly there. Do you also use trade 2 on day 1 in your regression? What about trade 3 on day 1? Or is it always trade 1 on day $t$, $t = 1, ..., T$? Aug 6, 2015 at 5:14
• Wait, hang on. When you say "trade" do you mean a trade that you personally perform, or do you mean any old trade on the exchange? Aug 6, 2015 at 5:15

Quick summary: Your model should still be well specified, as long as:

1) You do the analysis on a heavily traded asset, e.g. IBM on NYSE, and

2) You use heteroskedasticity-consistent standard errors in your estimation framework, e.g. White's standard errors.

I'm going to start the long answer by re-stating the question to make sure I've got it right.

Let $v_{t_n}$ denote true volatility on day $t$ of a return that spans $[t_0, t_n]$, where $n$ is also stochastic, and is the time of the first trade that you make. Let $c_t$ be the cost associated with your first trade on day $t$. Then you want to estimate the model:

\begin{equation} c_t = \alpha + \beta v_{t_n} + e_t \end{equation}

where we make the usual assumptions on our residual $e_t$, e.g. $\mathbb{E} e_t | v_{t_n} = 0$, e.t.c. $c_t$ is observable (I'm assuming), but $v_{t_n}$ is obviously not observable. Thus instead you replace $v_{t_n}$ with the estimator $\hat{v}_{t_n}$ which is realised volatility, estimated using all available 5-minute returns on day $t$ from time $t_0$ to $t_n$, where these returns are constructed from looking at all transactions that are publicly available on day $t$.

Let's assume (to make life easier) that $t_n$ falls on an exact multiple of $5$ minutes after $t_0$, and that similarly you are able to observe other transactions on each exact multiple of $5$ minutes in order to construct your realised vol. If the above assumptions are not satisfied, it is just a matter of scaling things by the appropriately small increments of time.

We can always write our estimator as follows:

\begin{equation} v_{t_n} = \hat{v}_{t_n} + u_t \end{equation}

that is, true vol is equal to realised vol plus an estimation error term. Subbing the equation into your original regression gives:

\begin{equation} c_t = \alpha + \beta (\hat{v}_{t_n} + u_t) + e_t \end{equation}

or rather:

\begin{equation} c_t = \alpha + \beta \hat{v}_{t_n} + \epsilon_t \end{equation}

where $\epsilon_t = \beta u_t + e_t$. We need at least $\mathbb{E} \epsilon_t | \hat{v}_{t_n} = 0$ to estimate the model in its present form. I would be reasonably willing to make this assumption for a heavily traded asset. Roughly speaking, we are assuming that our realised vol error is centred on zero and that whether it takes a positive or negative value on any given day is not related to the magnitude of realised vol. Note that for a thinly traded asset, this assumption would be a bit dodgy, since we might expect realised vol to exhibit a larger positive bias on days when true vol is small (since the vol from microstructure noise will be larger relative to true vol). So there is our first constraint: make sure you do the analysis on a heavily traded stock, like IBM on NYSE for example.

What other intuition can we get from the model? Well, assuming $cov(e_t, e_s) = 0, t \neq s$ seems reasonable, and similarly I can't see any reason why $cov(u_t, u_s)$ wouldn't be zero, so we can safely assume $cov(\epsilon_t, \epsilon_s) = 0$.

Finally, we get the the heart of your question: We would definitely expect that $\mathbb{V} u_t \neq \mathbb{V} u_s, t \neq s$, since, as you point out, some realised vols will be calculated using 1 return, and others might use 70 returns (I don't want to go into the exact relationship in too much detail as the analysis is not necessarily straightforward - standard realised vol theory uses infill asymptotics, but the situation we have here is more akin to regular asymptotics, and the true parameter of interest spans a different time interval on different days...).

But I don't think we need to worry about that. All that matters is that we can be fairly sure that $\mathbb{V} \epsilon_t \neq \mathbb{V} \epsilon_s, t \neq s$. In other words, our regression will exhibit heteroskedasticity. So do not use OLS. Instead, use heteroskedasticity consistent standard errors, e.g. White's standard errors. Any decent statistical software will provide standard routines for this. Note, you shouldn't need to worry about getting full HAC-consistent standard errors, since there is no reason to believe the residuals will exhibit autocorrelation (although maybe test for it just to be safe).

Note, of course your estimates of the parameters of your model will not be as good because you are using realised vol insted of true vol. There isn't really anything you can do about this except use as many observations as you can possibly get your hands on. However, your primary concern which is the statistical effects from the noise in your RV estimators has hopefully been dealt with by my analysis above.

One other thing: If you start using your second, third, and fourth, e.t.c. trade from a given day, then you will need to revisit this analysis as I'm fairly sure that will introduce some non-trivial dependence into the residuals of your regression.

Cheers,

Colin

ps if you feel I have answered the question, please click the tick mark and consider upvoting (the up arrow).