I have a timeseries that has irregularly spaced time indices as below

Timestamp             price
2017-08-18 15:52:54   762.45
2017-08-18 15:59:27   762.98
2017-08-18 16:00:02   763.04

Usually a simple return (percent change in price) from regularly spaced (hourly, daily) prices can be calculated as

$$ \frac{P_t}{P_{t-1}} - 1 $$

But that assumes that $\Delta t = const$ for all time.

How do we calculate a daily return given prices and timestamps spaced out irregularly (in this case down to seconds), where $\Delta t \neq const$?

  • $\begingroup$ What do you think about my answer? If it is helpful and clear, you may accept it by clicking on the tick mark to the left. Otherwise, you may ask for further clarification. This is how Cross Validated works. $\endgroup$ Jan 12 at 15:52

1 Answer 1


Take the closing price of each day and treat these as daily prices. From there on, the usual formulas such as $\frac{P_t-P_{t-1}}{P_{t-1}}$ or $\log(P_t)-\log(P_{t-1})$ apply.

  • $\begingroup$ What if the prices represent prices that trades were executed at and we want to find daily returns? We can’t ignore the intraday returns $\endgroup$
    – PyRsquared
    Oct 21, 2021 at 20:44
  • $\begingroup$ Why not? The prices that you widely find reported as daily prices usually are the closing prices. A closing price is the last price of the day (though it can be more nuanced than that depending on how the exchange defines the closing price). Take that, and then returns follow from the usual formulas. $\endgroup$ Oct 22, 2021 at 5:18
  • $\begingroup$ I'm sorry, but I still don't understand how that can be the case. Imagine you had a crystal ball and made only winning trades intraday, but day over day, the price is going down. So if you only look at close to close (end of day) price, your daily returns are negative - however that isn't the case, because you've made winning (positive return) trades intra day. $\endgroup$
    – PyRsquared
    Oct 22, 2021 at 10:08
  • $\begingroup$ OK, so you mean there is a specific intraday trading strategy and you want its daily returns? In such a case, the strategy's daily returns depend on what exactly the strategy is (what triggers a buy or a sell). $\endgroup$ Oct 22, 2021 at 10:34
  • 1
    $\begingroup$ What about summing the log returns of anything that happened due to the strategy over the day? $\endgroup$ Oct 22, 2021 at 11:23

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.