For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
2019-10-02: The community is currently in read-only mode

Waiting a long time for IB to backfill



  • Hello,
    I using IB for live trade but the waiting time for backfill is very long(~20 minutes+),
    I need daily bars of the last year for my strategy to start so its not many bars but still, I wait a long time,
    here is my code :
    I have a list of strategies(one in the added example) the symbols are read from csv file(2 in this case), then IB is registered and operated, nothing fancy.
    '''
    def live_trade():
    feed_folder = 'quotes'
    constituents = []
    constituents.append('SPY')

    cerebro = bt.Cerebro()
    ibstore = bt.stores.IBStore(host='127.0.0.1', port=8002, clientId=33,notifyall=True)
    cerebro.broker = ibstore.getbroker()
    
    lookback = datetime.timedelta(days=200)
    strategies = [RiskPair_NN]
    for strategy in strategies:
        strats = cerebro.addstrategy(strategy=strategy, timeframe=datetime.timedelta(days=1),optimizing=False,
                                     feed_folder=feed_folder, start_date=datetime.datetime.now() - lookback,\
                                     end_date=datetime.datetime.now())
    
    symbol_list = ['SPY']
    for strategy in strategies:
        with open(strategy.get_symbol_list_filename(), 'r') as f:
            reader = csv.reader(f)
            for ticker in reader:
                if len(ticker): symbol_list.append(ticker[0])
    
    symbol_list = set(symbol_list)
    
    for ticker in symbol_list:
        ib_dataname = ticker+'-STK-SMART-USD'
        data = ibstore.getdata(dataname=ib_dataname, name=ticker, clientId=33, reverse=False)
        cerebro.adddata(data)
    
    cerebro.run()
    

    '''
    Can anyone share if they have to wait a long time too? can something be done about this?
    Please advise,
    Thank you.


  • administrators

    You probably want to activate the debug option of the store and see which messages are delivered.



  • Can you please specify how to activate the option? and how can I know from the messages what is slowing me down?
    Thank you


  • administrators

    @trade-prophet said in Waiting a long time for IB to backfill:

    Can you please specify how to activate the option?

    Docs - Interactive Brokers - See the store options

    @trade-prophet said in Waiting a long time for IB to backfill:

    and how can I know from the messages what is slowing me down?

    I don't work for IB. It is just a guess that there may be something meaningful.


Log in to reply
 

});