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

cannot find right symbol for Interactive Brokers

  • Hello,

    I have been trying my code on the symbol EUR.USD-CASH-IDEALPRO successfully so far. The problem raises when I want to use another symbol with IBStore.

    Following is my code:

        cerebro = bt.Cerebro(stdstats=False)
        ibstore = bt.stores.IBStore(host='', port=7496, clientId=35)
        # data = ibstore.getdata(dataname='EUR.USD-CASH-IDEALPRO', fromdate=datetime.datetime(
        data = ibstore.getdata(dataname='ES.USD-FUT-GLOBEX-201806', fromdate=datetime.datetime(
            2018, 4, 1), todate=datetime.datetime(2018, 5, 1), timeframe=bt.TimeFrame.Days, reverse=False)
        print('Starting portfolio: %f' %
        strats =
        ss = strats[0]
        for each in ss.analyzers:
        cerebro.plot(volume=False, style='candle')
        print('Final portfolio: %f' %

    And I get the error:

    Starting portfolio: 10000.000000
    Server Version: 76
    TWS Time at connection:20180514 15:17:36 Eastern European Time
    IndexError                                Traceback (most recent call last)
    ~/Documents/Devel/trade/ in <module>()
        157     print('Starting portfolio: %f' %
    --> 158     strats =
        160     ss = strats[0]
    ~/.virtualenvs/trade-7uGUPCDQ/lib/python3.6/site-packages/backtrader/ in run(self, **kwargs)
       1125             # let's skip process "spawning"
       1126             for iterstrat in iterstrats:
    -> 1127                 runstrat = self.runstrategies(iterstrat)
       1128                 self.runstrats.append(runstrat)
       1129                 if self._dooptimize:
    ~/.virtualenvs/trade-7uGUPCDQ/lib/python3.6/site-packages/backtrader/ in runstrategies(self, iterstrat, predata)
       1300             for strat in runstrats:
    -> 1301                 strat._stop()
       1303         self._broker.stop()
    ~/.virtualenvs/trade-7uGUPCDQ/lib/python3.6/site-packages/backtrader/ in _stop(self)
        460     def _stop(self):
    --> 461         self.stop()
        463         for analyzer in itertools.chain(self.analyzers, self._slave_analyzers):
    ~/Documents/Devel/trade/ in stop(self)
         85     def stop(self):
    ---> 86         self.log('(MA Period %2d) Ending Value %.2f' % (self.params.maperiod,, doprint=True)
         88     def notify_order(self, order):
    ~/Documents/Devel/trade/ in log(self, txt, dt, doprint)
         21     def log(self, txt, dt=None, doprint=False):
         22         if self.params.printlog or doprint:
    ---> 23             dt = dt or self.datas[0]
         24             print('%s, %s' % (dt.isoformat(), txt))
    ~/.virtualenvs/trade-7uGUPCDQ/lib/python3.6/site-packages/backtrader/ in date(self, ago, tz, naive)
        390     def date(self, ago=0, tz=None, naive=True):
    --> 391         return num2date(self.array[self.idx + ago],
        392                         tz=tz or self._tz, naive=naive).date()
    IndexError: array index out of range

    How can I resolve this issue?

  • administrators

    @eduedix said in cannot find right symbol for Interactive Brokers:


    This is for FOREX where the pair is EUR.USD

    @eduedix said in cannot find right symbol for Interactive Brokers:


    A future is not a forex pair and the currency is specified later, right after the exchange and before the expiration date.. See the reference here: Docs - Interactive Brokers

  • Thank you very much for the quick response!

    I fixed the symbol name now and the dataname looks like this:
    ES-FUT-GLOBEX-USD-201806. I do not receive any error anymore. However, the system stays in the DELAYED status forever. Do you have any idea what might be the problem here?

  • administrators

    That's usually due to lack of permissions to download real-time data.

  • I am doing paper trading only. The delay occurs for EURUSD for only 1-2 seconds though. I also have this problem when I want to work on historical data only (limited with fromdate and todate as parameters to getdata. Do you think this is a permission related issue?