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

resampledata dose not work when timeframe as same as data



  • Hello,
    Is there a reason resampledata does not work when timeframe is the same as in cerebro.adddata but does work when the timeframe is higher? for ex.
    this does NOT work:

    data = btfeeds.GenericCSVData(
        dataname='mydata.csv',
        fromdate=datetime.datetime(2000, 1, 1),
        todate=datetime.datetime(2000, 12, 31),
        nullvalue=0.0,
        dtformat=('%Y-%m-%d'),
        tmformat=('%H.%M.%S'),
        datetime=0,
        time=1,
        high=2,
        low=3,
        open=4,
        close=5,
        volume=6,
        openinterest=-1
       timeframe=bt.TimeFrame.Days,
       compression=1)
    cerebro.adddata(data=data, name=ticker)
    cerebro.resampledata(dataname=data,
    		 name=ticker+'_resample',
    		 timeframe=bt.TimeFrame.Days,
    		 compression=3)
    

    but this one WORKS(the only change is timeframe in resampledata):

    data = btfeeds.GenericCSVData(
        dataname='mydata.csv',
        fromdate=datetime.datetime(2000, 1, 1),
        todate=datetime.datetime(2000, 12, 31),
        nullvalue=0.0,
        dtformat=('%Y-%m-%d'),
        tmformat=('%H.%M.%S'),
        datetime=0,
        time=1,
        high=2,
        low=3,
        open=4,
        close=5,
        volume=6,
        openinterest=-1
    	timeframe=bt.TimeFrame.Days,
    	compression=1
    )
    cerebro.adddata(data=data, name=ticker)
    cerebro.resampledata(dataname=data,
    		 name=ticker+'_resample',
    		 timeframe=bt.TimeFrame.Weeks,// ORIGINAL line is timeframe=bt.TimeFrame.Days
    		 compression=3)
    

    Can anyone help?


  • administrators

    Help is difficult without:

    • Which data is going in?
    • What's coming out (or not coming out)?

  • administrators