The modifications below are in build 9.72 of the TWS API.
For clarification on any of the items listed, send us an email at API Support.
Enhancements
Fields Renamed from "Expiry" to "LastTradingDay" or “LastTradingDayorContractMonth”
Within TWS, we use the last trading day and not the actual expiration date for futures, options and futures options contracts. To more accurately reflect this data, we have changed all of the “expiry” fields throughout the API to either “LastTradingDay” or “LastTradingDayorContractMonth” as noted below.
For TWS messages being sent to the API client, the values is always Last Trading Day, and so the "Expiry" field has been changed to "LastTradingDay":
OPEN_ORDER = 5;
PORTFOLIO_VALUE = 7;
CONTRACT_DATA = 10;
EXECUTION_DATA = 11;
SCANNER_DATA = 20;
TICK_EFP = 47;
POSITION = 61;
For messages sent from the API to TWS, if the value length is 8, TWS understand it as the Last Trading Day. If the value length is 6, TWS understand it as the Contract Month. For these, the “Expiry” field has been renamed to “LastTradingDayorContractMonth”:
REQ_MKT_DATA = 1;
PLACE_ORDER = 3;
REQ_CONTRACT_DATA = 9;
REQ_MKT_DEPTH = 10;
REQ_HISTORICAL_DATA = 20;
EXERCISE_OPTIONS = 21;
REQ_REAL_TIME_BARS = 50;
REQ_CALC_IMPLIED_VOLAT = 54;
REQ_CALC_OPTION_PRICE = 55;
For the above, the expiry field is wrapped in the Contract class. We have renamed Contract.expiry to Contract.lastTradingDayOrContractMonth.
Read-Only Mode for API
Effective in TWS 950 and above, API users have the option to set the API to Read-Only mode. This mode allows viewing of market data and account information, but blocks any type of trading activity Additionally, users can elect to limit access only to
connections made from the same computer. To set API parameters, from within TWS Global Configuration select API.
Clients and Sample Applications
Beginning with this release, we have made the following changes to our API clients and sample applications:
- The C++ MFC-based client and sample applications have been deprecated.
- The ActiveX Control is now written in C#.
- PosixClient has been renamed to CppClient, and is located in the source directory of your API installation folder.
- In the Java client, the AnyWrapper interface has been removed. Its methods have been incorporated into the EWrapper interface.
- The ApiController-specific classes (e.g. NewOrder) have been merged into the main Java client.
Connection Enhancements
We have added the following new connection features:
- useV100Plus and connectionOptions - These fields are used together to implement two-way versioning for connections to TWS 947+.
When enabled via setUseV100Plus, the client will report a range of supported API versions to TWS. TWS will respond with highest supported API version in the range specified by the client. From that moment on, both client and server are expected to send messages formatted according to the negotiated version. Currently only version 100 is supported. This version adds 4-byte network-byte-order length prefixes to all messages.
connectionOptions is a field reserved for future extensions. For now, API clients should specify an empty string when connecting to TWS.
- startApi: optionalCapabilities - This field is reserved for future extensions. For now, API clients should specify an empty string.
Solicited Flag
We have added a new Order attribute, Solicited to the Order object. Solicited is a boolean attribute with the following values:
- True = solicited (orders initiated by a broker through the brokers research and design).
- False = unsolicited (those instigated by a broker's customer either through their actions or by the broker at their direction).
New Error Codes
The following new error codes have been added to the Java client:
- 506 - Unsupported Version
- 507 - Bad Message Length
- 508 - Bad Message
primaryExchange Field
Beginning with this release, we have made the following changes to the primaryExchange field:
- TWS serverVersion=75 and above supports the new dedicated field primaryExchange.
- TWS builds 939, 942 and above (note that this corresponds to a subset of serverVerion=69 and above; not all serverVersion=69 support this) support this new behavior:
- The exchange field is formatted as follows:
exchange= SMART:LSEIOB1
In this example, the colon ( : ) is a default separator that is configurable in TWS.
- For new builds, you can set primaryExchange either in the new dedicated field or by using the separator, but not both. If primaryExchange is set in both places, the request will be rejected.
API Order End Marker Bug Fixed
We have fixed a bug with API orders that sent an end marker prematurely. Beginning with TWS beta release 948, the end marker will be sent to the API only after all of the orders have been delivered to TWS.
Any trading symbols displayed are for illustrative purposes only and are not intended to portray a recommendation.
Interactive Brokers LLC is a member of NYSE, FINRA, SIPC