|
|
This documentation is now deprecated. Please switch to the IBKR Campus for up-to-date information regarding IBKR's API solutions. |
The Dynamic Data Exchange protocol is a method of inter-process communication developed by Microsoft to establish communication between Windows applications running on the same computer. The DDE API is available for Windows computers to create a means of communication between Microsoft Excel and TWS or IB Gateway.
Interactive Brokers does not offer any programming assistance and therefore it is strongly advised to anyone willing to use any of the TWS DDE API to become familiar with the technologies involved such as the DDE protocol and VBA.
Beginning in API v975, a new DDE API is offered which connects to TWS via a DDE socket bridge that uses the open source Java - DDE interoperability library JDDE. The newer API has some advantages over the legacy DDE API:
The DDE socket bridge API is fully backwards compatible with spreadsheets created for the legacy DDE API.
Unlike in the legacy DDE API, the username to be used in Excel DDE spreadsheets is determined by the DDE server launched independently, and not by the username used in TWS. The default username is twsserver, but this can be changed in the runDdeSocketBridge.bat file. The folder C:\TWS API\samples\DdeSocketBridge included with the API for Windows v975+ installation contains the source code for the new DDE connections.
Requirements for the DDE Socket Bridge API
Launch TWS or IB Gateway
If using TWS with the API, the socket-based connections must be enabled at: Global Configuration -> API -> Settings -> "Enable ActiveX and Socket Clients" Enable API connections
Note the socket port setting at Global Configuration -> API -> Settings -> Socket Port. The default value for the DDESocketBridge is 7496.
There should be a popup window that shows Connected! confirming that the DDESocketBridge has connected to TWS. If not check that the API is enabled and that the socket port is set correctly.
Notes:
The Legacy DDE API is described here: Legacy DDE API