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

I set bt.TimeFrame.Days, with interactive brokers, but getting ticks?



  • Next called every tick, and
    inside
    self.dnames['GOLDLONGD'].close[0] is real time value, but self.dnames['GOLDLONGD'].close[-1] previus tick, not Yestarday as i expect.

        def next(self):
            print("NEXT ") 
            print("{}".format(self.data.datetime.datetime(0).isoformat()))
            print("MKT(len={}) [0]{} [-1]{}".format(len(self.dnames['MKTD']),
                     self.dnames['MKTD'].close[0],
                     self.dnames['MKTD'].close[-1]))
    
         spygd = store.getdata(dataname='SPYG-STK-ARCA-USD',timeframe=bt.TimeFrame.Days)
         tltd = store.getdata(dataname='TLT-STK-ARCA-USD',timeframe=bt.TimeFrame.Days)
        gldd = store.getdata(dataname='IAU-STK-ARCA-USD',timeframe=bt.TimeFrame.Days)
        cerebro.addcalendar("NYSE")
        cerebro.adddata(spygd, name='MKTD')
        cerebro.adddata(tltd, name='BONDLONGD')
        cerebro.adddata(gldd, name='GOLDLONGD')
        
    
    

    It's started ok, but later become very strange - i marked it BOLD

    NEXT
    2019-04-15T23:59:59.999986
    MKT(len=249) [0]38.1 [-1]38.05
    NEXT
    2019-04-16T23:59:59.999986
    MKT(len=250) [0]38.0 [-1]38.1
    NEXT
    2019-04-17T23:59:59.999986
    MKT(len=251) [0]37.85 [-1]38.0
    ***** DATA NOTIF: MKTD LIVE
    NEXT
    2019-04-17T23:59:59.999986
    MKT(len=251) [0]37.85 [-1]38.0
    .
    .
    .
    NEXT
    2019-04-17T23:59:59.999986
    MKT(len=251) [0]37.85 [-1]38.0
    ***** DATA NOTIF: BONDLONGD LIVE
    NEXT
    2019-04-17T23:59:59.999986
    MKT(len=251) [0]37.85 [-1]38.0
    NEXT
    2019-04-18T13:18:29.462995
    MKT(len=252) [0]37.89 [-1]37.85
    NEXT
    2019-04-18T13:18:29.462995
    MKT(len=252) [0]37.89 [-1]37.85
    NEXT
    2019-04-18T13:18:29.462995
    MKT(len=252) [0]37.89 [-1]37.85


  • administrators



  • @backtrader thank you for reference, i took your referenced sample, and alter to make my own code.
    i replaced resampledata to cerebro.adddata i use Days instead of ticks.
    when i use resampledata - cerebro crashed, i open issue, but found by adddata it's run stable (without crashes)

    Could you please point me what i doing wrong??



  • @backtrader could you please advice why resampledata not working stable with IB ?


  • administrators

    That's a huge statement. You faced a problem, which doesn't mean it doesn't work in a stable manner.

    In any case, there is not much advice I can offer, except for things like decreasing the number of symbols you request from IB simultaneously (that seems to work like a charm for everyone who doesn't know about the limitations placed by IB)


Log in to reply
 

});