alpaca-backtrader-api icon indicating copy to clipboard operation
alpaca-backtrader-api copied to clipboard

minute timeframe plotting market open at 13:30 but ending the day at 16:00

Open mkaicher opened this issue 3 years ago • 1 comments

Hello all. I've been working with the example code and for some reason when using Minutes granularity, I'm getting plots with market open data at 13:30, and a premature end a 16:00. This happens even if I extend my fromdate/todate datetime parameters to include hours, minutes, tzinfo, etc. I've also tried swapping trading_calendars for exchange_calendars. What am I missing?? Thanks.

Update: I should acknowledge up front that I'm a complete noob, however, I've managed to get charts with the full expected data by doing the following:

  1. Rolled back alpaca-backtrader-api to version 0.13.0
  2. In /anaconda3/envs/backtrader/lib/python3.8/site-packages/trading_calendars/calendar_helpers.py #NP_NAT = np.array([pd.NaT], dtype=np.int64)[0] NP_NAT = pd.NaT.value
  3. When calling alpaca_backtrader_api.AlpacaData, to get a full regular session of 1 minute data, I had to specify 9:30 for fromdate (UTC-4) and 20:00 for todate (UTC).

Clearly there's something amiss with the timezones.

mkaicher avatar Jul 27 '21 04:07 mkaicher

@mkaicher Thanks for posting the issue, when you say 'Rolled back alpaca-backtrader-api to version 0.13.0` can you explain that process or thinking. Version control is something I need to learn more on and I'm digging into alpaca to help debug issues like this one.

datatalking avatar Jun 27 '22 09:06 datatalking