How do you connect multiple apps to IB's TWS?

Discussion in 'Trading Software' started by snackly, Sep 6, 2008.

  1. snackly

    snackly

    When I add multiple apps I get an error. Perhaps each app has to communicate on a different port with TWS? The address is 127.0.0.1, should perhaps there be multiple addresses setup?
     
  2. Tums

    Tums

    What is the error?
     
  3. rwk

    rwk

    Trusted IP address should be set to "127.0.0.1". "Enable ActiveX and Socket Clients" should be checked (also "Enable DDE Clients, if you are using DDE).

    If you have two or more accounts, you will have one iteration of the TWS for each. In that case, you should set each to a different Socket Port. If you have only one account, keep the Socket Port default of 7496.

    If you have two or more apps (per account), each app should communicate with it's iteration of the TWS via the proper port. In addition, each app should use a unique ClientId. None of the apps should use ClientId=0 unless you want that app to be able to control all orders for that account.

    SUMMARY: Port controls which TWS your app connects to (and which account). ClientId keeps the various apps for the same TWS/account from stepping on each other.