Say I have time-series data that is unevenly spaced, with anything between 4-50 hours of spacing in between. The data comes from a trading account history, which has captured the balance of the portfolio after each trade.

I'd like to calculate the annualised daily volatility of this account in order to compute a sensible Sharpe ratio. As such, I am assuming volatility does not vary with time.

I've read How do you estimate the volatility of a sample when points are irregularly spaced? but do not have access to the knowledge, experience or computational power required to solve for the maximum in the formula proposed.

What would be a reasonably good way to approximate the daily volatility of this time series? I can think of a few solutions and would be interested to hear if you have comments on them or if you had other ideas.

  • Solution #1: Pretend my data is, in fact, regularly spaced
  • Solution #2: Cut all but the last data point of each day
  • Solution #3: As #2 but fill any gaps with some short EMA estimate (perhaps making use of Eckner, 2015)
  • Solution #4: Use a method akin to that oulined in pp.38 of Eckner, 2014, (if I've understood it correctly) and approximating the vol to the ATR scaled by $ \sqrt{ \frac{ \pi }{ 8 \rho } } $
  • 4
    $\begingroup$ The realized variance $v=\sum_i (x_{i+1}-x_i)^2$ generalizes to $v=\sum_i (\frac{x_{i+1}-x_i}{t_{i+1}-t_i})^2$ when the time intervals are unequal, but deterministic. (Assuming a zero mean for simplicity). $\endgroup$
    – Alex C
    Oct 27, 2018 at 21:43
  • $\begingroup$ @AlexC Indeed my intervals are deterministic as I am looking at historical returns. If I've understood you correctly: assuming zero mean (happy to do this, as this is already the convention I would use to calculate volatility normally), I can simply scale each return by the inverse of the time taken to realise that return, and then calculate the standard deviation (as per usual) on these scaled returns? $\endgroup$
    – Doggie52
    Oct 28, 2018 at 21:41
  • $\begingroup$ Yes. But let's first see if someone upvotes my comment... $\endgroup$
    – Alex C
    Oct 28, 2018 at 22:53
  • $\begingroup$ @AlexC what do you mean by when the time intervals are "deterministic"? As in when they don't depend on the realisation of the underlying stock process? Also, shouldn't it be $v = \sum_i \frac{(x_{i+1}-x_i)^2}{t_{i+1} - t_i}$ $\endgroup$
    – Marses
    Apr 29, 2021 at 12:43

1 Answer 1


A simple estimate of the volatility $\sigma$ of an asset given $N$ samples of asset prices $S_i$ at times $t_i$ is:

$$ \sigma^2 = \frac{1}{N} \sum_{i=1}^{N} \frac{\log(S_i / S_{i-1})^2}{t_i - t_{i-1}} $$

This is the maximum likelihood estimate of $\sigma$ when the asset price is assumed to be a Wiener process with no drift. In this case, the transition probability of observing $x_i=\log(S_i/S_{i-1})$ is given by:

$$ P(x_i) = \frac{1}{\sigma \sqrt{2\pi(t_i - t_{i-1})}} \exp({\frac{-{x_i}^2}{2 \sigma^2 (t_i-t_{i-1})}}) $$

The estimate maximizes $\prod_{i=1}^{N} P(x_i)$. It can be derived by differentiating the logarithm of this product with respect to $\sigma$ and setting this to zero.

A more complicated model may include drift (e.g. this answer), but maximizing the log likelihood may require an optimization algorithm like BFGS if an analytical solution can't be found. In this case, giving the gradient and a good initial guess to the solver will massively speed up the solution time.

  • $\begingroup$ If I understand the first equation correctly, you're taking care of the uneven spacing by normalizing the returns with respect to time? $\endgroup$
    – Doggie52
    Jun 19 at 13:33
  • $\begingroup$ @Doggie52 Yes, but this form is rigorous as it follows from this transition probability model. There are plenty of other incorrect/unjustified guesses for how to normalize properly. Also for other readers, note the units for volatility are log-return per square root time, and also note this provides an intuitive single-sample estimate when N=1. $\endgroup$
    – JoseOrtiz3
    Jun 29 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.