Resampling

Course Name: Deep Reinforcement Learning in Trading, Section No: 11, Unit No: 3, Unit type: Notebook

Why to resampling from 5 min to 1 hour do you multiplied by 15?

Sorry but i do not understand.

Regards

Guido Bergonzini

Hi Guido,



The window length is an arbitrarily chosen length which is greater than the lookback. The reason for this arbitrary longer window is to account for any trading holiday, weekend or any such discontinuity between consecutive trading sessions. We resample the 5 min bars to an hour and day bars, and hence this arbitrarily long window is necessary as a safety precaution.



With lookback < window length, we fetch the latest "window length" just preceding the "current time" (curr_time), and then, as per the lookback parameter, we fetch the latest N ("lkbk") observations.



The same is implemented in the code as follows:



    last5m = bars5m[curr_time-timedelta(wdw5m):curr_time].iloc[-lkbk:]

    last1h = bars1h[curr_time-timedelta(wdw1h):curr_time].iloc[-lkbk:]

    last1d = bars1d[curr_time-timedelta(wdw1d):curr_time].iloc[-lkbk:]



Hope this helps!