Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. tjmille2
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    T
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Groups 0

    tjmille2

    @tjmille2

    0
    Reputation
    241
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    tjmille2 Unfollow Follow

    Latest posts made by tjmille2

    • Historical testing with IB

      I attempted to connect to an Interactive Brokers data feed to backtest a strategy of mine.

      My code is below:

      ibstore = bt.stores.IBStore(host='127.0.0.1', port=7497, clientId=3921)
      data = ibstore.getdata(dataname=ticker_name, historical=True, fromdate=datetime(2000, 1, 1), todate=datetime(2016, 12, 31), timeframe=bt.TimeFrame.Seconds, compression=5)
      cerebro.adddata(data)
      
      print("---- Starting Backtest ----")
      cerebro.run()
      print("---- Plotting Results ----")
      cerebro.plot()
      

      When I run, I get the following error:

      Traceback (most recent call last):
      File "<PATH_TO>/Backtest.py", line 62, in 
      cerebro.plot()
      File "/Users/Tim/miniconda3/lib/python3.5/site-packages/backtrader/cerebro.py", line 665, in plot
      plotter.show()
      File "/Users/Tim/miniconda3/lib/python3.5/site-packages/backtrader/plot/plot.py", line 707, in show
      self.mpyplot.show()
      AttributeError: 'Plot_OldSync' object has no attribute 'mpyplot'
      

      Is backtesting with IB officially supported? If so, where is my code incorrect?

      posted in General Code/Help
      T
      tjmille2