# Calculating Daily Realized Variance with Non-Constant Sampling

I was able to obtain some tick data on a particular asset and I wanted to calculate the daily realized variance of the asset. After browsing through a few threads here, it seems the formula to calculate daily realized variance is simply (assuming you have constant time intervals):

Where R^2 is the squared log returns from the constant time interval t, with a total of m time intervals during the day. If I had minute to minute tick data, I would ideally sample every minute and the calculation would be straightforward.

However, my tick data is slightly sporadic ranging from 30 second intervals to 2-3 hours over the course of a trading day. Can I still use the same formula to calculate daily realized variance and just take the sum of squared log returns? Or will I have to account for the varying time differences?

If by "daily realized variance" you mean variance of daily returns, then you can sum all returns for each given day (because they are log returns, you can sum them) and compute the average of their squares (which is daily variance computed with the assumption of 0 mean, very often made in practice):

$$DailyVariance = \frac{1}{N}\sum_n^N{(DailyReturn_n)^2}$$

Otherwise if you don't want to lose information by summing all returns for each day, you can re-scale each of your return to get its equivalent daily return. A basic assumption is that variance scales linearly with time. So volatility (and returns) scale with $$\sqrt{T}$$.

Example: if you have a 1-hour return, it is 24 times smaller than a day. So you would scale it by $$\sqrt{24}$$ to get an "equivalent daily return". For a 30-min return you would scale it by $$\sqrt{48}$$ etc. And then you can use the $$DailyVariance$$ formula, with the squares of these "equivalent daily returns".

Once again that assumes that variance is distributed linearly with time. That is a strong assumption that is likely not true. Equity markets are typically more volatile intraday than overnight. So if you want to get more sophisticated, instead of scaling variance (i.e. square returns) by $$T$$ (i.e. returns by $$\sqrt{T}$$), you can scale them by a more sophisticated function of the time period of your return: you define a distribution for your variance intraday, and use it to scale your returns.

Further Example In Response to Comments:

• To clarify, I just want to measure realized variance from intraday prices. For evenly spaced intraday prices, it becomes clear on what to do: I just take the sum of squared log returns for that day which I will denote RealizedVariance_d. If i want to convert that to an annualized volatility term it would be: SQRT(RealizedVariance_d * 252). My question is can I still take the sum of squared log returns for the realized variance measurement if the intraday prices were not evenly spaced (e.g. first half of the day would be every minute, second half of the day would be every 30 minutes)? – gyoza419 Dec 16 '20 at 19:55
• Short answer is no. Example. If you take a one-hour return of 1%, and two half-an-hour returns of 0.5%, they will have a very different variance if you do as you say. But the move over 1 hour would be the same. So you need to re-scale to account for time difference. If you re-scale by $\sqrt{T}$ as I said, you would get the same variance for both cases in my example. But this $\sqrt{T}$ is an assumption you make on the distribution of the variance throughout time. – Soumirai Dec 16 '20 at 20:02
• I agree comparatively, they are different, but I am only trying to measure the total variance in the day. I guess for the extreme example for the asset, if the market is closed from 5:00 PM to 5:15 PM with close price of 100 and reopen price of 101, the variance between 5:00 to 5:15 pm would simply be ln(101/100)^2. Now if we wanted to take 5 min minute returns between 5:00 to 5:15 wouldn't we get the same answer? Assuming we know nothing about the price changes when the market is closed (so the price for 5:00, 5:05, 5:10 are all 100 and the price at 5:15 is 101). – gyoza419 Dec 16 '20 at 20:17
• Your example is a particular car that does not disprove what I said, nor the example I gave of 1% and two times 0,5%. You can't just sum square returns, or you're missing the time dimension. If you sum square returns where your returns are computed every nanosecond, you will get 0.0000000... variance over the whole day. But that's not because variance is 0, just because you didn't re-scale to account for the frequency of your sampling. – Soumirai Dec 16 '20 at 20:29
• I see, but I am still slightly confused. I guess how would you calculate the daily realized variance in the example I added to the original post above? – gyoza419 Dec 16 '20 at 21:01