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

Expected behavior for Resample with gaps?



  • My data is of 1-min timeframe and I'm resampling it to 5-min.
    but sometimes the 1-min data have gaps (let's say up to 10 min gaps)

    what is backtrader expected behavior for resampling if gap is <5-min?
    and what if gap>5-min?


  • administrators

    Easy: no data no bar. Why should it be otherwise?



  • Then it is quite a surprise.
    lets say only 1 min is missing out of 5 needed (most likely cause no trade was actually made in that time, which happens very frequently)

    I don't understand why a resample won't happen with 4 out of the 5 minute?
    for me, it make more sense to work with the missing values (first price available is open, last for close, min-max for high and low, and sum for volume) instead of disregarding them completely

    for the case when we are missing the whole 5 min, I agree 'no data no bar'

    I would have expected that if i have at least one bar available I can resample to higher time frame

    say we have the following data:
    min |

    the smaller the timeframe the higher the chance of gaps in the data


  • administrators

    @jacob said in Expected behavior for Resample with gaps?:

    Then it is quite a surprise.

    You should probably read your own question and re-read the answer.

    @jacob said in Expected behavior for Resample with gaps?:

    I don't understand why a resample won't happen with 4 out of the 5 minute?

    You understand it wrong. "No data no bar" means that. In this case there is data.


Log in to reply
 

});