DDE Syntax for Excel

The table below defines possible cell values for DDE-supported functionality. The basic syntax, which appears in the Excel formula bar (the "=" enterable field at the top of the spreadsheet) when you put your cursor in a cell, is:

=server|topic!id?reqType?field2

or

=server|error!error (for an optional tag that will display errors)

where:

·          server = the username

·          topic = the function category, such as orders (ord) or tickers (tik)

·          id = idn, where n is some integer. For orders, n must always increase, even from session to session.

·          reqType = the request type, such as place or cancel

·          field2 = additional information as noted below

 

Description

Server

Topic

id

reqType

field2

Place an order

server

ord

idn

place

orderDescription

Modify an order

server

ord

idn

modify

orderModification

Cancel an order

server

ord

idn

cancel

 

Check order status

server

ord

idn

status

 

Request open orders

server

ord

idn

open

 

Request executions

server

ord

idn

executed

 

Check shares filled in order

server

ord

idn

sharesFilled

 

Check shares remaining in order

server

ord

idn

sharesRemaining

 

Execution (average) price

server

ord

idn

price

 

Underlying

server

ord

idn

symbol

 

Security type

server

ord

idn

secType

Refer to Note 6

Expiry

server

ord

idn

expiry

Refer to Note 7

Strike

server

ord

idn

strike

Refer to Note 8

Right

server

ord

idn

right

Refer to Note 8

Specify contract multiplier for options and futures

server

ord

idn

multiplier

Refer to Note 8

Order destination

server

ord

idn

exchange

 

Currency

server

ord

idn

currency

 

Order side

server

ord

idn

side

 

Order quantity

server

ord

idn

size

 

Order type

server

ord

idn

orderType

 

Limit price

server

ord

idn

limitPrice

 

Auxiliary price

server

ord

idn

auxPrice

 

Local symbol

server

ord

idn

localSymbol

 

Last fill price

server

ord

idn

lastFillPrice

 

Create ticker

server

tik

idn

req

 

Bid implied volatility

server

tik

idn

bidImpliedVol

 

Bid delta

server

tik

idn

bidDelta

 

Request bid size

server

tik

idn

bidSize

 

Request bid price

server

tik

idn

bid

 

Request ask price

server

tik

idn

ask

 

Request ask size

server

tik

idn

askSize

 

Ask implied volatility

server

tik

idn

askImpliedVol

 

Ask delta

server

tik

idn

askDelta

 

Request last price

server

tik

idn

last

 

Request last size

server

tik

idn

lastSize

 

Last implied volatility

server

tik

idn

lastImpliedVol

 

Last delta

server

tik

idn

lastDelta

 

Request today's high price

server

tik

idn

high

 

Request today's low price

server

tik

idn

low

 

Request today's volume size

server

tik

idn

volume

 

Request last close price

server

tik

idn

close

 

Request implied volatility calculated by the TWS option modeler

server

tik

idn

modelVolatility

 

Request option delta calculated by the TWS option modeler

server

tik

idn

modelDelta

 

Request the model price

server

tik

idn

modelPrice

 

Request present value of dividends expected on the options underlier

server

tik

idn

pvDividend

 

Request number of hold days until the expiry of the EFP

server

tik

idn

holdDays

 

Request expiration date of the single stock future

server

tik

idn

futureExpiry

 

Request dividends expected until the expiration of the single stock future

server

tik

idn

dividendsToExpiry

 

Request annualized basis points

server

tik

idn

basisPoints

 

Request annualized basis points in percentage form

server

tik

idn

formattedBasis
Points

 

Request implied futures price

server

tik

idn

impliedFuture

 

Request the dividend impact on the annualized basis points interest rate

server

tik

idn

dividendImpact

 

Account statement control key

server

acct

idn

acctv

Account code (for Advisor-managed accounts only)

Request one account value string

server

acct

idn

key

 

Account value

server

acct

idn

value

 

Account currency

server

acct

idn

keyCurrency

 

Account portfolio control key

server

acct

idn

acctp

Account code (for Advisor-managed accounts only)

Account portfolio underlying symbol

server

acct

idn

symbol

 

Account portfolio security type

server

acct

idn

secType

 

Account portfolio expiry

server

acct

idn

expiry

 

Account portfolio strike price

server

acct

idn

strike

 

Account portfolio right

server

acct

idn

right

 

Account portfolio currency

server

acct

idn

currency

 

Account portfolio local symbol

server

acct

idn

localSymbol

 

Account portfolio market price

server

acct

idn

marketPrice

 

Account portfolio market value

server

acct

idn

marketValue

 

Account portfolio average cost

server

acct

idn

avgCost

 

Account portfolio realized PNL

server

acct

idn

realizedPNL

 

Account portfolio unrealized PNL

server

acct

idn

unrealizedPNL

 

Request contract details

server

contract

idn

req

contractDescription

Valid order types

server

contract

idn

orderTypes

 

Valid exchanges

server

contract

idn

validExchanges

 

Contract identifier

server

contract

idn

conid

 

Minimum tick

server

contract

idn

minTick

 

Order multiplier

server

contract

idn

multiplier

 

Market name

server

contract

idn

marketName

 

Trading class

server

contract

idn

tradingClass

 

Execution order id

server

exec

idn

orderId

 

Underlying

server

exec

idn

symbol

 

Security type

server

exec

idn

secType

 

Expiry

server

exec

idn

expiry

 

Strike

server

exec

idn

strike

 

Right

server

exec

idn

right

 

Order destination

server

exec

idn

exchange

 

Currency

server

exec

idn

currency

 

Local symbol

server

exec

idn

localSymbol

 

Execution id

server

exec

idn

execId

 

Execution time

server

exec

idn

time

 

Account number

server

exec

idn

acctnNumber

 

Exchange where executed

server

exec

idn

eExchange

 

Side

server

exec

idn

side

 

Number of shares filled in order

server

exec

idn

shares

 

Execution (average) price

server

exec

idn

price

 

Order ID

server

exec

idn

permId

 

Identifies position as one to be liquidated last

server

exec

idn

liquidation

 

Request execution details

server

exec

idn

Req

executionFilter

Request list of Advisor-managed accounts

server

FAaccts

idn

Req

 

List of Advisor-managed accounts

server

FAaccts

idn

Value

 

Request market depth

server

mktDepth

idn

req

contractDescripton?  num_display_rows

Refer to note (1) below.

Market maker

server

mktDepth

idn

mktMaker

rowId_side

Refer to note (2) below.

Order price

server

mktDepth

idn

price

rowId_side

Refer to note (2) below.

Order size

server

mktDepth

idn

size

rowId_side

Refer to note (2) below.

Market data refresh rate

server

refreshRate

idn

millisec

Number of milliseconds

Subscribe to news bulletins

server

news

sub

0

Refer to note 3 below

News bulletin message ID

server

news

newsID

 

 

News bulletin message type

server

news

newsType

 

Refer to note 4 below

News bulletin message text

server

news

msg

 

 

Exchange from which news bulletins originated

server

news

exchange

 

 

Set the server log level

server

logLevel

<log_level>

 

Refer to note 5 below.

Where:

    orderDescription = side_quantity_symbol_secType_exp_strike_right_exchange_orderType_lmtPrice_auxPrice
{_timeInForce_ocaGroup_account_open/close_origin_orderRef_transmit_parentId_blockOrder
_sweepToFill_displaySize_triggerMethod_ignoreRth_hidden_clientId_accountCode_goodAfterTime_
goodTillDate_faGroup_faMethod_faPercentage_faProfile_shortSaleSlot_
PRIMARYEXCHANGE
_shortSaleLocation_ocaType_rthOnly_rule80A_settlingFirm_allOrNone_minimumQty_percentOffset_
electronicTradeOnly_firmQuoteOnly_nbboPriceCap_auctionStrategy_startingPrice_stockRefPrice_
delta_stockRangeLower_stockRangeUpper_volatility_volatilityType_referencePriceType_hedgeDelta_
continuousUpdate}

Note:    Attributes in brackets are extended order attributes and are described in the topic Extended Order Attributes.

    contractDescription - symbol_secType_exp_strike_right_exchange

    tickerDescription = symbol_secType_exp_strike_right_exchange

    ExecutionFilter = clientId_accountCode_date_time_symbol_secType_exchange_side

Note 1:    When requesting market depth you can specify the number of rows to display. If not supplied, the default number of rows is five (5) rows. This parameter can be used to optimize performance, as a low number of display rows requires less CPU overhead.
For example: =edemo|mktDepth!id0?req?MSFT_STK_SMART?10 will request 10 rows of market depth orders.

Note 2:    Field 2 of the market depth 'price' and 'size' reqTypes contain additional information to specify the order row and side that the data applies to. Market depth orders are divided into two sides, BID and ASK, and order entries start from the offset 0.

For example:
=edemo|mktDepth!id0?price?0_ASK will request the ASK price for the order entry 0.

=edemo|mktDepth!id0?size?2_BID will request the BID size for the order entry 2.

Note 3:    When subscribing to news bulletins, the request should look like this:

=edemo|news!sub?0 

where the request type is a zero. To unsubscribe simply clear the subscription cell.

Note 4:    The valid news bulletin types are:

1 = Regular news bulletin
2 = Exchange no longer available for trading
3 = Exchange available for trading

Note 5:    The valid log levels are:

1 = SYSTEM (least detailed)
2 = ERROR (default, if no level is specified)
3 = WARNING
4 = INFORMATION
5 = DETAIL (most detailed)

Note 6:    If the order is a combo, combo legs are inserted after the aux price.  Here is a three-legged IBM combo description:

CMBLGS_3_8314_100_BUY_SMART_0_36930759_1_BUY_SMART_0_36930816_1_SELL_SMART_0_CMBLGS.

Each leg contains : contract ID, number of contracts, side, exchange, and open/close (0 or 1).  Retail can always specify 0, institutional need to specify a 1 if the order being executed would close a position.

Note 7:    If the order is an option or a future, the expiry is inserted after the sec type.

Note 8:    If the order is an option, the strike and right (put or call) are inserted after the expiry. If the multiplier is specified, it follows the strike and right.