• C#
  • Java
  • VB
  • C++
  • Python
Contact us
Legacy DDE API

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.

Requirements for the legacy DDE API

  • Windows OS
  • 32 bit version of TWS or IB Gateway
  • Microsoft Excel
  • TWS API installed to the C: drive
  • Excel must be set to the US settings for commas and periods. That is, commas denote thousands and periods denote decimals.

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.

You can get started by following the Tutorial and learn how to use DDE to communicate with TWS.

Limitations specific to the legacy DDE API

  • DDE does not have the full range of tick types available to the socket-based APIs
  • DDE requires live market data in TWS to receive either streaming or historical market data. It is not compatible with delayed data.
  • Other applications running DDE in the background can interfere with Excel DDE and cannot be used simultaneously.
  • A DDE command string can be at most 255 characters. For that reason very lengthy commands such as those involving four-legged spreads are not available.

Troubleshooting Excel DDE

  • Error: "Remote Data Not Accessible..." causes

When this error is encountered in using a DDE formula in an Excel spreadsheet it indicates a general problem in the DDE connection between Excel and TWS. This can have any of the following causes:

  • 1) TWS is not 32 bit. By default 64 bit TWS is installed on modern computers. It is necessary to select the 32 bit version when downloading to use the DDE API.
  • 2) The API is not installed to the C: drive. The API can be downloaded from http://interactivebrokers.github.io/ . After installation, there should be a folder "TWS API" on the C: drive. If the API installs to any other drive this can cause issues.
  • 3) "Enable DDE" is not checked in the TWS (or IB Gateway Global Configuration). In TWS this setting is at Global Configuration -> API -> Settings -> "Enable DDE".
  • 4) The incorrect username is input into a formula in Excel. The username in the spreadsheet must match the username used to login to TWS. For paper accounts, it must be the paper account username and not the live username (every paper account has its own username distinct from the live username).

(5) In rare cases it is necessary to run Excel as Administrator to use DDE.

Note: Other programs running on the same computer which use DDE can interfere with the communication between Excel and TWS and cause Excel to 'hang' or 'freeze' after making the initial request. The only solution to this problem is to close other programs using DDE one-by-one to find the culprit. Programs which are known to cause this issue include Google Chrome, Microsoft OneNote, Skype and Adobe Creative Cloud.

  • This DDE API is now considered completed and will not have additional functionality that is added to socket-based APIs.