For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Impact of a data feed's boundary time convention (rightedge)



  • Hello

    I noticed most of the downloaded historical data from various of data sources (Bloomberg, IB_Insync) seem to have a convention of "rightedge=False", i.e. a minute bar as of timestamp "21:23:00" is actually forward looking in the period of 21:23:00-21:23:59 for open/high/low/close. On the other hand, by default backtrader has a convention of "rightedge=True" in resampling, i.e. it is actually backward looking in the period of 21:22:00-21:22:59 for the minute timestamp "21:23:00".

    Understand backtrader's convention makes sense since in actual world you can only look backward as of a timestamp and see what has happened. Just wonder whether this is taken into consideration in design? Specifically, if I have a minute bar data or 30 seconds feed that is using forward looking convention or "rightedge=False", is there proper parameter settings in cerebro to make sure when data is loaded into the system, everything will be converted properly to backward looking/rightedge? Or do I have to manually convert the data feed to backward looking/rightedge convention?

    I've tried multiple settings but looks like manually converting the datafeed's convention is the only option, and I've found multiple related discussions but there seems to be no direct discussion regarding the data feed's "rightedge" convention.

    Related discussions:
    Backtest vs live bars "off-by-1" discrepancy?


  • administrators

    There is no provision in place for an automatic conversion. You may try applying a filter and replacing the timestamp.



  • Thanks for the response. I will try it.