- To allow the automation of manual activities normally done in TWS.
- To allow subscription to market data and market depth information, extraction
of historical data, and processing of large volumes of that information.
- To allow the execution of algorithms and trading strategies that require
automation.
- To allow automated access to account and portfolio information.
- To allow automated access to currently open orders, order statuses, and
executions.
- DDE: via the TwsDde.xls Excel spreadsheet.
- ActiveX: via any technology that can access it, including Visual Basic,
Visual C++, and the .NET framework.
- Socket library: via Visual C++ or .NET.
- Java: via provided socket client object.
- In all cases, TWS’s market data, extended order, combo order, bond
and derivatives trading, and financial advisor capabilities are fully supported.
- Must first configure TWS to allow the type of connection you want. This
is done in the TWS Configure->API menu, or in Global Configuration.
- DDE via Excel: via entry of user name into the appropriate cell, and then
creating formulas that refer to DDE links. Such formulas are created for you
by various buttons and macros.
- Socket and ActiveX: via a call to a function that creates the connection,
and acceptance of that connection in TWS. Each connection has a client number.
Client number 0 has special privileges.
- DDE: via the TwsDde.xls Excel spreadsheet’s Tickers page.
- All others: market data is requested via calling a function and receiving
real-time update messages.
- Market data for stocks, combos, futures, options, foreign exchange, and
bonds is available
- Options market data includes implied volatility and delta ticks for the
last trade and the NBBO.
- Market data subscriptions can be cancelled when watching a particular ticker
is no longer desired.
- DDE: via the TwsDde.xls Excel spreadsheet’s ContractDetails page.
- All others: contract details requests are done via calling a function and
receiving a message back.
- Contract details messages include the contract’s possible exchanges
and order types.
- Contract details requests give an application access to the entire database
of contracts that can be traded in TWS.
- DDE: via the TwsDde.xls Excel spreadsheet’s Market Depth page.
- All others: market depth is requested via calling a function and receiving
messages back.
- In both cases, as market depth changes, real-time update messages are sent.
- In both cases, market depth subscriptions can be cancelled when no longer
desired.
- DDE: via the TwsDde.xls Excel spreadsheet’s Orders page. Requests
to modify or cancel an order can be sent on that same page.
- All others: orders are placed via calling a function, and are identified
by an integer ID. Requests to modify or cancel an order are made by referring
to them with that same ID.
- In both cases, TWS’s extended order types are fully supported, and
an account’s open orders and executions can be requested.
- Placing and Modifying Orders
- DDE: via the TwsDde.xls Excel spreadsheet’s Orders page. Requests
to modify or cancel an order can be sent on that same page.
- All others: orders are placed via calling a function, and are identified
by an integer ID. Requests to modify or cancel an order are made by referring
to them with that same ID.
- In both cases, TWS’s extended order types are fully supported, and
an account’s open orders and executions can be requested.
- DDE: via the TwsDde.xls Excel spreadsheet’s Executions page.
- All others: executions are requested via calling a function and receiving
messages back.
- In both cases, the executions reported will match those displayed in the
TWS executions panel.
- DDE: via the TwsDde.xls Excel spreadsheet’s Account page.
- All others: account and portfolio updates are requested via calling a function
and receiving messages back
- In each case, account and portfolio update subscriptions can be cancelled
once no longer needed.
- The TWS API allows your software to access the same data that is used in
TWS charting and the TWS Market Scanner.
- The Contracts for which historical data is available are the same ones
as are covered by TWS, and the results are in bar form.
- DDE: Starting with API 8.90, via the TwsDde.xls Excel spreadsheet’s
Historical Data and Scanner pages.
- All others: via sending historical data and scanner subscription requests,
and receiving messages back.
- API Scanner subscriptions update every 30 seconds, just as they do in TWS.
- API historical data requests have recently been extended to allow the entire
previous calendar year to be extracted.
- The “Request Scanner Parameters” function can be used to receive
all possible API market scans and their parameters.
- Algorithmic trading is possible via proprietary technology built by the
customer and customized to his needs and goals.
- Subscription via the API to 100 simultaneous market data tickers is allowed.
De-subscription followed by subscribing to new ones allows many more to be
looked at over a trading day than just 100. That 100 limit can be increased
if commission volume justifies it.
- Order placement or modification can be done for any order accepted by TWS
except for baskets and conditional orders.
- Execution reports and portfolio updates give the customer the composition
of his portfolio and changes to it as they occur.
- Account and portfolio updates give the customer his account’s financial
status and portfolio composition as trading occurs, and allows maintenance
of automated books and records.
Any symbols displayed are for illustrative purposes only and do not portray a recommendation.