alpacahq/pylivetrader

DataPortal._get_realtime_bars

weiguang-zz opened this issue · 5 comments

why the param:end_dt is dropped?

def _get_realtime_bars(self, assets, frequency, bar_count, end_dt):

Not passed to self.backend.get_bars

Hi @weiguang-zz
pylivetrader is a live trading package. so end_dt is always now.
that is why it is not used.
you cannot backtest with this package.

In my opinion, the end_dt should be generated by the RealTimeClock.

what do you mean? why should it be generated by the clock?

forgot about the clock, I did not express clearly.

the reason is: If you don't pass end_dt to the method:get_bars, you should generated by yourself, the logic is not simply get the current time. the logic should be: Determine whether the current time is trading time. If yes, take the minute of the current time. If not, just take the minute of the last transaction time.

you can check the current logic of generation start time and end time, it is very time consuming.

# temp workaround for less bars after masking by