IndexError: deque index out of range



  • I was running sample program ibtest.py with these parameters and got
    a 'Index Error: deque index out of range' error after received ~1100 ticks and ~180 ticks for the two data feed.... this error can be re-produced very often but not every time... wonder if anyone has seen this before...

    >> python ibtest.py --port 4001 --data0 AUD.USD-CASH-IDEALPRO --timeframe Seconds --compression 10 --data1 AUD.USD-CASH-IDEALPRO --timeframe1 Seconds --compression1 60 --replay --usestore --trade --notifyall --debug
    
    :~/dev/t1-p3.5/src/myalgo$ Traceback (most recent call last):
      File "ibtestorg.py", line 467, in <module>
        runstrategy()
      File "ibtestorg.py", line 275, in runstrategy
        cerebro.run(exactbars=args.exactbars)
      File "/home/x/dev/t1-p3.5/lib/python3.5/site-packages/backtrader/cerebro.py", line 810, in run
        runstrat = self.runstrategies(iterstrat)
      File "/home/x/dev/t1-p3.5/lib/python3.5/site-packages/backtrader/cerebro.py", line 940, in runstrategies
        self._runnext(runstrats)
      File "/home/x/dev/t1-p3.5/lib/python3.5/site-packages/backtrader/cerebro.py", line 1256, in _runnext
        strat._next()
      File "/home/x/dev/t1-p3.5/lib/python3.5/site-packages/backtrader/strategy.py", line 296, in _next
        super(Strategy, self)._next()
      File "/home/x/dev/t1-p3.5/lib/python3.5/site-packages/backtrader/lineiterator.py", line 236, in _next
        clock_len = self._clk_update()
      File "/home/x/dev/t1-p3.5/lib/python3.5/site-packages/backtrader/strategy.py", line 290, in _clk_update
        for d in self.datas if len(d))
      File "/home/x/dev/t1-p3.5/lib/python3.5/site-packages/backtrader/strategy.py", line 290, in <genexpr>
        for d in self.datas if len(d))
      File "/home/x/dev/t1-p3.5/lib/python3.5/site-packages/backtrader/linebuffer.py", line 163, in __getitem__
        return self.array[self.idx + ago]
    IndexError: deque index out of range
    

  • administrators

    You are using replay and mixing several data feeds. The current core is known (@RandyT has been the driving force) to have some weaknesses with replay.

    The suggestion for such a mix would be to use resample


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.