Requests in DDE
Understanding DDE Requests
Requests made through the Excel DDE are handled through two primary methods: An Excel Formula Structure or a DDEPoke method call.
Requests with the TWS API that do not take any arguments, such as EClient.reqCurrentTime, EClient.reqOpenOrders, or EClient.reqPositions are all made using an Excel Formula request using the DDERequest Method call. Please note there is a known restriction in Excel that the DDERequest method can only send 255 symbols in its request.
For requests that contain at least one or more argument, such as EClient.reqMktData, EClient.reqContractDetails, or EClient.placeOrder, must be made using the Visual Basic DDEPoke Method Call.
Please be sure to review the underlying TWS API functions to understand which requests have arguments and which do not.
Excel Formula Structure
Requests with the TWS API that do not take any arguments, such as EClient.reqCurrentTime, EClient.reqOpenOrders, or EClient.reqPositions are all made using an Excel Formula request using the DDERequest Method call.
There is a known restriction in Excel that the DDERequest method can only send 255 symbols in its request.
The Excel DDE formula is comprised of several separate components. As a baseline there is the Server, also known as the Service Name from your DDE Socket Bridge. This is followed by your Request Type, and finally the Request String.
We will use this formula to elaborate on this structure: =@Stwsserver|reqCurrentTime!id4?time
- ’=@Stwsserver’: This first part indicates the Service Name set for our socket bridge connection. The ’=@S’ indicates the start of a formula, and that the next value will be our Service Name.
- ’|’: The pipe, the character typically above the Enter/Return key, is used to divide our service name from the rest of the request.
- ‘reqCurrentTime’ immediately after the pipe is used to state the Request Type we would like to make. These request types are based on the TWS API EClient request types documented in the TWS API Documentation.* ”!’”: The exclamation, (!) indicates the start of the request with the request ID. This is formatted as id1 or whichever number is pertinent.
- After the ID we should indicate a question mark (?), to denote which parameter to receive. In the example above, we are both requesting the current time and then printing the time value to the cell using “?time”.
DDE Poke Requests
For requests that contain at least one or more argument, the request must be made using the Visual Basic DDEPoke Method Call.
The DDEPoke request method call will send Excel table values in binary format to the DdeSocketBridge.
The VBA code below is an example of how DDE Poke requests are sent from Excel to the DDE Socket Bridge. Please be aware that this function call uses the sendPoke function of the TwsDde Sample’s “util.bas” file located at “C:\TWS API\samples\Excel\TwsDde\util.bas”.

