API
Instructions
Configure your API settings by taking the steps outlined below.
-
For Mosaic - Click the File menu in the top left corner.
For Classic TWS- Click the Edit menu in the top left corner.
-
Click Global Configuration.
-
Click API in the left pane.
-
Click one of the following to configure the settings

General
-
Enable Active X and Socket Clients - Check to enable integration with TWS using ActiveX or socket clients including Java and C++. Download sample programs from the Software page on the IBKR website.
-
Enable DDE clients - Check to enable integration with TWS through DDE. Download sample files from the TWS Software page on the website.
-
Download open orders on connection - uncheck if you do not want to download all open orders when you connect to your API.
-
Include FX positions when sending portfolio - If you have the Include FX Positions feature activated, all FX positions will be included when portfolio updates are sent the to API client. Uncheck this box if you don't want FX positions sent to the API client when the portfolio updates are sent.
-
Send status updates for Volatility orders with "Continuous Update" flag - If you have Continuous Update activated for Volatility orders, all updates are sent to the API client by default. Uncheck if you don't want these updates sent from TWS to the API client.
-
Use negative numbers to bind automatic orders - if checked, all orders that are automatically bound to an API client via the reqOpenOrders or reqAutoOpenOrders calls or via system-generated orders (i.e. volatility hedging orders) will be assigned negative API order IDs. Otherwise, these orders will be assigned incremental API order IDs. Volatility hedging orders will have the order ID “parent API order ID + 1” when possible.
-
Create API message log file - check to create a message log file. Use the Logging Level selector to define the level of detail in the log.
-
Include market data in API message - shows market data in the API log file.
-
Socket port - Enter a socket port number which allows you to sync up multiple versions of TWS in your ActiveX spreadsheet.
-
Logging Level - Set the level of log detail for the API text log. System gives the most general level of logging; Detail gives the most detailed level.
-
Master API client ID - The API client with the specified client ID will receive all orders, even those placed by other API clients. This differs from the Client ID of “0” which will receive all orders sent from the TWS GUI.
-
Timeout to send bulk data to API - define the time in seconds that TWS will wait before disconnecting the API client if data cannot be sent quickly enough.
Trusted IP Addresses
If you connect to the API through a trusted IP address, the connection is not questioned. Otherwise, you will get a verification message asking if you are sure you want to make the connection.
-
Click Create to add a new trusted IP address to the list.
-
Click Edit to modify the selected address.
-
Click Delete to remove the selected address.

Specify whether or not to bypass precautionary warnings for API orders that trigger a red flag.
-
Bypass Order Precautions for API Orders - check to allow orders that fall outside the size or value limits to be submitted without a warning.
-
Bypass Bond warning for API Orders - check to allow bond orders that fall outside the specified face value and other limits to be submitted without a warning.
-
Bypass negative yield to worst confirmation for API Orders - check to bypass any warning that your API order will result in a negative yield to worst excluding commissions.
-
Suppress market cap - check to suppress the existing market cap for API stock and warrant orders.

Specify the API Advisor Presets.
For Groups using the NetLiq, Available Equity, Equal method:
-
When Opening Positions: this setting controls logic which calculates the desired allocation quantities for the order. This setting does not apply to mutual funds.
-
When Closing Positions: this setting controls logic which calculates the desired allocation quantities the order.
For Groups using User-Specified method:
-
When Opening Positions: this setting controls logic which calculates the desired allocation quantities for the order. This setting does not apply to mutual funds.
-
When Closing Positions: this setting controls logic which calculates the desired allocation quantities the order.
Additional Resources
Learn About Global Configuration in Trader Workstation at IBKR Campus