Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Daily historic data with IB runs into error when more than 250 records retreived

    General Code/Help
    2
    4
    810
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      llevar last edited by

      I'm using the IB broker to request daily prices on QQQ going back a couple of years using the following call:

          data = store.getdata(dataname='QQQ', timeframe=bt.TimeFrame.Days, compression=1, rtbar=False, fromdate=datetime.datetime.strptime('03/10/2015', "%d/%m/%Y"), sessionend=datetime.time(16, 0))    
          cerebro.resampledata(data, timeframe=bt.TimeFrame.Days, compression=1)
      

      This gets the first 250 values just fine but breaks down afterwards. In my understanding the data request gets split up into multiple reqHistoricalData() calls and the sessionend parameter that I supplied gets dropped on the second request and ends up being None, thus generating an error:

      09-May-18 13:40:11 ERROR     Exception in message dispatch.  Handler 'historicalData' for 'historicalData'
      Traceback (most recent call last):
        File "/usr/local/lib/python2.7/site-packages/ib/opt/dispatcher.py", line 44, in __call__
          results.append(listener(message))
        File "/usr/local/lib/python2.7/site-packages/backtrader/stores/ibstore.py", line 937, in historicalData
          dteos = datetime.combine(dt, sessionend)
      TypeError: combine() argument 2 must be datetime.time, not None
      
      1 Reply Last reply Reply Quote 0
      • L
        llevar last edited by

        Is there a way to submit a formal bug report on this? I didn't see Issues on github. I'd love to use this framework, but this is a real blocker at this point.

        1 Reply Last reply Reply Quote 0
        • B
          backtrader administrators last edited by

          You may give the development branch a try. There is correction for this.

          https://github.com/backtrader/backtrader/commit/6ebdfad5885f1f62069125be08c7b206de2e4aac

          1 Reply Last reply Reply Quote 0
          • L
            llevar last edited by

            Thanks for the patch. This looks like it is working.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors