kernc / backtesting.py

:mag_right: :chart_with_upwards_trend: :snake: :moneybag: Backtest trading strategies in Python.
https://kernc.github.io/backtesting.py/
GNU Affero General Public License v3.0
5.06k stars 990 forks source link

How to define a session for instruments like MNQ? #1041

Open ck0099 opened 11 months ago

ck0099 commented 11 months ago

In the tutorial, there is example to resample from daily to weekly data such as:

self.weekly_rsi = resample_apply("W-FRI", talib.RSI, self.data.Close, self.rsi_window).

However for future contract such as MNQ, its session opening time is not exactly in the same day (using Eastern Time as base). For example MNQ's monday session starts trading from Sunday 6PM ET until Monday 5PM ET.

Than for the above case, how do you define "session", "daily" and "weekly" resample?

Thank you so much!