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

backtrader and Interactive Brokers. How to connect?

  • I am trying trying to connect backtrader to IB for live trading. I do know there is IBpy for that, but after going to their github page for enlightenment, they warn you for deprecation and send you back to the IB API Docs website - which tbh is a mess.. really unclear.

    Did anyone try and succeed in this? Would love to see a clear answer to this.

  • What is the problem exactly? IBpy, used by Backtrader, seems to be working ok so far.

  • Just wondering wether it makes still sense to use IBPy rather than TWS own python module. If IBPy works to this date, then I probably will just use that.

  • Working with IB in Backtrader, you are not exposed to IBpy API at all. Even more , the strategy code should not even know what broker it is working with or even whether or not the broker is live or simulated.

    So even if in the future, the IBBroker implementation in Backtrader will switch from IBpy to native TWS python API or IB-insync library - it should have near zero impact on your code anyway.

Log in to reply