Portfolio Boss Documentation

Interactive Brokers Tab

 

 

This Tab allows Portfolio Boss to connect to Trader Workstation (a trading platform by Interactive Brokers) and use its price data.

The integrated price data can only be seen from the Instrument Tab. During market open, any instrument you loaded on that Tab will show its latest candle continually changing, according to your IB market-data subscription (it may update in real-time or delayed). Note that index instruments, like SPX and NDX, don't have this integrated data.

 

 

The latest candle (as long as the instrument is still listed on the exchange) will be contained within a yellow rectangle, along with a red annotation showing the latest price (it will say “delayed” if you don't have a subscription).

Do understand, that connecting your IB market data to PB does not mean the strategy uses this data for its backtest (and daily notifications). Portfolio Boss still uses the main data sources for that (like CSI and Yahoo). This is simply a visual aid to satisfy your curiosity; the latest candle does not even have volume data shown, and any indicator lines are not plotted for it. After the market closes the candle may still update reflecting after-hour price; but after a few hours, PB will download the usual end-of-day data from the main sources. Then the latest candle returns to the usual state.

In a future update, this integration between PB and IB won't just serve a visual purpose, but allows your strategy to automatically execute the trading signals using Interactive Brokers. This will be especially useful once the intra-day trading feature is implemented in PB.

 


 

Connecting Portfolio Boss to Trader Workstation

 

 

To connect the price data, first make sure Trader Workstation is running on your computer. PB can't access the market data unless TWS is open. Then turn on the toggle “Enable IB Trader Workstation integration” as shown in the screenshot above.

The first time you connect PB to TWS, you'll need to follow these steps so it will accept incoming connections:

 

1.  In Trader Workstation, open the Global Configuration dialog by clicking the gear icon at the top right corner of TWS interface:

 

 

You can also go to the File menu ⇒ Global Configuration (if you use Mosaic TWS):

 

 

Or the Edit menu ⇒ Global Configuration (if you use Classic TWS):

 

 

The Global Configuration dialog opens. From there, go to API ⇒ Settings:

 

 

2.  Make sure the checkbox “Enable ActiveX and Socket Clients” is ticked (as shown above).

 

3.  Still in that dialog, copy the “Socket port” number (as shown above) and paste it to the “Socket port” field in Portfolio Boss. You just want to make sure the socket port numbers are exactly the same between TWS and PB.

 

 

4.  Click OK on the TWS Global Configuration dialog.

 

 

Your operating system may throw a Windows Firewall dialog. Just choose “allow” for the public and/or private networks.

Now press the “Connect” button from Portfolio Boss. Wait a while and you'll be using price data from Trader Workstation.

 

 

5.  If there's trouble connecting to Trader Workstation, click the “Reset Connection” button. It will attempt to connect again. If the problem persists, please contact our Customer Service or Interactive Broker's.

 

 

Once connected, there's a button at the top-right area of PB interface. The button is green if connection is good; gray if connection is severed; and red if connection attempt has failed.

 

 

This button will show up if you have the toggle “Enable IB…” turned on, and that you have connected to TWS at least once. Clicking the button will take you to this Interactive Brokers Tab to resolve the connection problem. Usually it's caused by TWS not currently running. But sometimes you need to check its API Settings again.

 

 

In rare cases you may need to install the latest TWS version.

You may need to press the “Connect” button again if connection attempt had failed.

 


 

If TWS is Running from Another Computer:

 

Now, if TWS happened to be installed on a machine different from PB, there are some additional steps. A side note, if it's running on a virtual machine within the same computer, it's still considered running on a different machine.

 

1.  Click the “?” section of this Tab, and take note of this computer's IP (where PB is installed):

 

 

2.  Then go to the other computer, and open the same TWS Global Configuration dialog (API ⇒ Settings). Make sure the checkbox “Allow connections from localhost only” (near the bottom) is unticked:

 

 

Now add the PB computer's IP to the list of “Trusted IPs” (click the “Create” button, and write the IP on the ensuing dialog):

 

 

Then press “OK” on that Global Configuration dialog.

 

3.  Now before we go back to the PB computer, we must know the “name” of this TWS computer (host name). Do that by typing “view your PC name” on the Windows's Start Menu search; then click the corresponding result:

 

 

4.  Back to Portfolio Boss, enter the name (or IP address) of the TWS computer, into the “Host” field here:

 

 

5.  Finally click “Connect” from Portfolio Boss:

 

 


 

Changing the Active IB Account

 

At the bottom of this Tab there's a section called “IB Account”:

 

 

As of now, this section serves no purpose and doesn't interfere with the displaying of IB market data. However in a future update, it will let you choose the Interactive Brokers account that you'll use for auto-trading. Most IB clients have at least two accounts: one for the paper-trade (simulated trading), and one is the live (real) account. Let's say you want to further test a strategy with the paper-trading account (to see its forward performance) and once you're satisfied, you switch to the live account; such account switching can be done here.

To change the account, first log-in to your preferred IB account in TWS. Then open Portfolio Boss (this Interactive Brokers Tab); you may see a warning that the previous account you used is no longer relevant. Simply select the active account from the dropdown below (orange rectangle), then press the button “Change Account”.

 

 

That dropdown simply lists the account that's currently active in TWS.

Note, the top-right button also shows an orange warning if there's such account mismatch:

 

 

But this mismatch does not interfere with the market data display.

 


 

Notes:

 

  • You can't simply open two instances of TWS, each with a different account, to switch the account back-and-forth in PB. TWS will throw an API Socket warning.
  • Taking a price snapshot from TWS is not the same as having a stream of market data; therefore the price update from snapshot won't be reflected in PB.
  • Interactive Brokers apparently delay the market data for instruments you currently hold in your IB portfolio (if you don't have a subscription). If you want to see a real-time candle in action, load any instrument (at the Instrument Tab) that's not part of your IB portfolio.
  • If you switch from IB's paper-trading account to a live one, you may need to re-configure the TWS API Settings again (the socket port number could be different).
  • As long as the toggle “Enable IB…” is on, Portfolio Boss will try to connect to TWS it last connected to.

 

 

 

 

 

Back to Top