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

Anyone using Backtrader with IBController



  • Hi, All

    I am new for backtrader. I am running 2 IBGateways( 1 live & 1 paper account) through IBController in a remote server, I would like to know can I run the ibtest.py to connect that IBGateway default port, 4001? I have added my desktop in the trusted ip in the configuration API. My question is can I using backtrader connect to a remote IBGateway? or it must connect to TWS?

    Command:
    ./ibtest.py --host '192.168.0.21' --port 4001 --data0 EUR.USD-CASH-IDEALPRO --resample --timeframe Seconds --compression 1

    Result :
    Strategy Created
    Datetime, Open, High, Low, Close, Volume, OpenInterest, SMA
    ***** STORE NOTIF: <error id=-1, errorCode=502, errorMsg=Couldn't connect to TWS. Confirm that "Enable ActiveX and Socket Clients" is enabled on the TWS "Configure->API" menu.>
    ***** STORE NOTIF: <error id=-1, errorCode=502, errorMsg=Couldn't connect to TWS. Confirm that "Enable ActiveX and Socket Clients" is enabled on the TWS "Configure->API" menu.>
    ***** STORE NOTIF: <error id=-1, errorCode=502, errorMsg=Couldn't connect to TWS. Confirm that "Enable ActiveX and Socket Clients" is enabled on the TWS "Configure->API" menu.>
    ***** STORE NOTIF: <error id=-1, errorCode=502, errorMsg=Couldn't connect to TWS. Confirm that "Enable ActiveX and Socket Clients" is enabled on the TWS "Configure->API" menu.>

    Thanks a million.


  • administrators

    @bc323 said in Anyone using Backtrader with IBController:

    ***** STORE NOTIF: <error id=-1, errorCode=502, errorMsg=Couldn't connect to TWS.  Confirm that "Enable ActiveX and Socket Clients" is enabled on the TWS "Configure->API" menu.>
    

    The message is not generated by backtrader, it is simply passed on to you.

    @bc323 said in Anyone using Backtrader with IBController:

    My question is can I using backtrader connect to a remote IBGateway?

    backtrader relies on IbPy which is the library making the connection. But as far as I know (and have seen) there is no difference. And in this case the problem seems to be opening a TCP/IP connection.

    The best way to see if you can actually open a connection to the target machine would be to use telnet.

    telnet 192.168.0.21 4001
    

    If telnet cannot open a connection, then it is something related to your networking/firewalling support.



  • Thanks, for your quick reply,

    I have made a few more tests, it seems that is the ibgateway's configuration which hasn't the option "Enable ActiveX and Socket Clients" and the ibpy return this error. There has no any connection problem to TWS after tick the checkbox "Enable ActiveX and Socket Clients" in the TWS global configuration. Thanks for your help.



  • Hi,

    That is my mistake, I find that I should passing the host ip without any single quotes. Thanks for your help.

    incorrect:
    ./ibtest.py --host '192.168.0.21' --port 4001 --data0 EUR.USD-CASH-IDEALPRO --resample --timeframe Seconds --compression 1

    correct
    ./ibtest.py --host 192.168.0.21 --port 4001 --data0 EUR.USD-CASH-IDEALPRO --resample --timeframe Seconds --compression 1

    Best Regards
    Barry