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

IBController + Backtrader, no bars being produced after connection has resumed



  • Hello, I recently started to use IBcontroller + backtrader in a Linux environment. I tested using E-mini SPX futures from CME whose market would close at 4:15PM EST and restart a few minutes later.

    I noticed that IBController would keep the connection alive as when I checked around 7:30 PM EST, the API connection was still showing as ok in IB Gateway and I could see it was still producing data in the Gateway UI. "ps -ef" also showed the backtrader's Python process was still there.

    However, backtrader seemed to have hung with three last bars showing same timestamp 4:15 PM EST. (I am using minute resampled quotes from ibstore data feeds). Clearly no new bars were being produced.

    I then killed the existing backtrader process and started a new one, and new bars would come in normally.

    Any idea of possible causes?

    Many thanks,

    Kevin



  • I've had this problem as well, the only reliable solution I've found is to restart the backtrader process and manually manage any open orders. Kinda sucks to have to do this.



  • this problem has been discussed many times here, people including me claim that such a problem exists while the author claims against. bt's ib integration is not in ideal condition for continuous automation.


  • administrators

    @bb2 said in IBController + Backtrader, no bars being produced after connection has resumed:

    while the author claims against

    This is a false statement. The author has simply stated the inability to reproduce it with his setup.

    In any case and given your persistence, please develop your own Interactive Brokers integration.



  • @nooby_mcnoob thanks for the tip. I now have experienced this same issue three days in a row. Will try the manual way and see whether it works as a workflow.



  • @backtrader I am already doing so, will also share here when I am finished. Though I am really wondering what your setup is like. ibtest was not able to solve connection issues for as it is.





  • @z_kvn I have to say the problem is still there(my tz setting is utc+8, backtrader version: '1.9.67.122')

    Data0, 2018-10-18T04:15:00.000000, 2816.75, 2817.75, 2815.5, 2816.75
    Data0, 2018-10-18T04:30:00.000000, 2816.5, 2816.75, 2816.5, 2816.75
    Data0, 2018-10-18T04:35:00.000000, 2816.75, 2817.5, 2815.5, 2815.75
    Data0, 2018-10-18T04:40:00.000000, 2815.75, 2816.0, 2815.25, 2815.25
    Data0, 2018-10-18T04:45:00.000000, 2815.25, 2816.25, 2815.25, 2815.75
    ***** STORE NOTIF: <error id=-1, errorCode=1100, errorMsg=Connectivity between IB and Trader Workstation has been lost.>
    ***** STORE NOTIF: <error id=-1, errorCode=1100, errorMsg=Connectivity between IB and Trader Workstation has been lost.>
    


  • @jmoons Thanks. I have experienced the same issue again after I added "bound off=1" to 15mins bar resampling. Not sure whether the parameter setting change is the direct cause though. Another suspicion is paper account. So far I just did testing using ib paper account and I've noticed the paper account server has different maintenance schedule from ib production server.