2
$\begingroup$

Stock prices are not stationary processes during all week or all day. For example EURGBP has low variability at night in Europe but during working hours is changing much more dynamic because of market liquidity.

I want to collect history data (15 minutes interval), calculate ARIMA coefficients and get prediction in R. But it is sensless to include data from night hours if I trade only during day.

So, is it possible to create ARIMA model based on discontinous data series (like 10:00 - 16:00 Monday, 10:00 - 16:00 Tuesday, 10:00 - 16:00 Wednesday, etc.)? How to merge this data minimizing the error (price from Tuesday 10:00 de facto is not next price after Monday 16:00)?

$\endgroup$
0

4 Answers 4

2
$\begingroup$

But it is sensless to include data from night hours if I trade only during day.

This kind of thinking seems to be a common beginners' fallacy in econometrics and related fields (nothing personal). You have to distinguish two elements of your problem:

  1. understanding how a time series develops (e.g. by building a model for it);
  2. utilizing your understanding to find out a function of this development (e.g. a forecast for a specific time period).

Think of an analogy: if the true model is $$ y=\beta_0+\beta_1 x_1 + \beta_2 x_2 + u $$ and you are only interested in $\beta_0$ and $\beta_1$ but not $\beta_2$, you are still better off estimating $\beta_0$ and $\beta_1$ from the true model rather than the submodel $$ y=\beta_0 + \beta_1 x_1 + v. $$ Your estimates from the full model will be more accurate, and considerably so if $x_1$ is (highly) correlated with $x_2$.

Now back to your original problem: if the time series development at night were totally unrelated to its development at daytime, you could just ignore the night hours. But in all likelihood the relation is there, so better account for it. In other words, I would address the two core elements of your problem in turn without taking shortcuts.

$\endgroup$
3
  • $\begingroup$ Would not just including a dummy for "night" and "day" solve some of his problem? R's arima() function allows for exogenous variables. $\endgroup$
    – confused
    Commented Jul 27, 2020 at 8:46
  • 1
    $\begingroup$ @confused, possibly but unlikely. Such a model would imply the only difference between night and day is a level change, i.e. the stock price is systematically higher or lower at night. I doubt this is a good approximation of the reality. $\endgroup$ Commented Jul 27, 2020 at 9:09
  • $\begingroup$ Ah right, it doesn't affect change in variance which is what he was interested in. $\endgroup$
    – confused
    Commented Jul 27, 2020 at 9:10
1
$\begingroup$

When you say discontinuous, you are referring to the clock time. So depending on your assumptions, it may not be discontinuous in trading time.

For some securities that are not trading over night and are relatively stable during off hours, you might as well safely ignore the off hours and make the time series continuous. While for others that trade continuously, in case you have NA's in your data after aggregation, you might need to interpolate the time series, although various interpolation method introduces different biases.

$\endgroup$
2
  • $\begingroup$ It is the easiest way to ignore off hours. But if I want to trade e.g on specyfic hours like 11:00-14:00 on Mondays I need create model based on previous Mondays 11:00-14:00. Time beetween Monday 14:00 and next Monday 11:00 is not off-hour so I cannot just ignore it. Or I can? $\endgroup$ Commented Oct 3, 2016 at 7:14
  • $\begingroup$ @MateuszZaborski I just realized that you mentioned "it is sensless to include data from night hours if I trade only during day". I personally wouldn't agree with this opinion. It seems arguable that previous day's prices have larger impact on current day's prices than that of the overnight's. So depend on your model, you may be safe using the returns series without overnight information. But for ARIMA, which is essentially some filter, the intrinsic delay would probably undermine some useful recent information, and not including night prices would make it worse for sure. $\endgroup$
    – Will Gu
    Commented Oct 3, 2016 at 15:52
0
$\begingroup$

I would recommend you to use the whole information (to include data from night hours) : firstly adjust your data for the intra-day periodicity with a deterministic function, secondly you can fit your arima on the periodicity adjusted series. You'll be able to recover the original non-adjusted series by post-multiplying your mean estimates by the deterministic factor.

See also here : Is that a good way to work with the ARMA model?

$\endgroup$
2
  • $\begingroup$ Don't include nightly data and, when you do the estimation in R, break the data ( use the split function in R and take the calendar day part of the date time object ( probably chron ) using the as.Date function ) by day. In this way, the data starting on tuesday is not connected to data at the end of monday. $\endgroup$
    – mark leeds
    Commented Jul 26, 2020 at 2:47
  • 1
    $\begingroup$ Notte that, even though I suggested not including it, WIll Gu ( and others I'm sure also ) makes a good point. Whether to include the night data or not probably depends on your model. If you think that the morning predictions are related to last night's activity, then you should include it. In my case, I don't, but everyone is doing something different. $\endgroup$
    – mark leeds
    Commented Jul 26, 2020 at 2:51
0
$\begingroup$

Have you thought about mirroring the data? So you would have in the missing data period the replication of what happened during the day, but in an inverse way.

$\endgroup$
1
  • $\begingroup$ I've never heard of this. What would be the benefits of doing so? $\endgroup$
    – confused
    Commented Jul 27, 2020 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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