TWS Setup

  1. Make sure that Interactive Broker's (IB) Trader Workstation (TWS) is installed. You can download it directly from IB:
    (We recommend the latest stable version)

    Note that it is possible to use IB Gateway instead of TWS for connection with IB. However, we recommend TWS if you're going to be sending trade orders, because you won't be able to transmit them through IB Gateway without logging out and logging in to TWS. If you do prefer to use IB Gateway anyway, click here for a setup tutorial.
  2. Note that TWS must be running and logged in on your local machine, while PTF is running, in order to use IB as a data source or send trade orders through TWS.
  3. Once you have TWS started, there are some configuration settings that must be set.
    • Click on File, then Global Configuration

    • Navigate to API and click on Settings (in the left pane).
    • "Enable ActiveX and Socket Clients" should be checked.
    • "Read-only API" should be UN-checked (if you intend to send trade orders from PairTradeFinder to TWS; otherwise you can leave it checked).
    • The value for "Socket Port" should match the IB Port Number setting in PTF.
    • "Allow connections from localhost only" should be checked.
    • Click the "OK" or "Apply" button.

    • Make sure that the port selected in IB settings, matches the IB port selected in PTF settings (System Preferences / IB API Settings tab)

    • Don't forget to keep TWS on and logged in while you run PTF.

In case of further questions or issues, please contact
cabapp cabapp