old excel basket
You can use Excel to create a basket file which you can easily open as a basket order in TWS.
Create a basket file with Excel
Open a blank Excel worksheet.
Create the orders you want to include in your basket, one per line. Enter a parameter in each successive cell. You must follow the guidelines below for creating an Excel basket file:
You must allow one cell for each REQUIRED field regardless of whether the field requires a value. Include one value, when required or when appropriate for the instrument type, for each field described in the table below.
Here is an example of a two-line Excel-formatted basket order. The first line shows a Day market order for stock XYZ routed to Smart (if you'd used LMT as the order type instead of MKT, you'd have been required to enter a limit price in cell "G," and the remaining required fields would have been pushed one cell to the right). The second line is to sell 2 Aug06 XYZ 20 call options. Note that the required fields are different for different instrument types, and fall in different cells.
List field values in the order in which they appear in the table below. Here is an example of a two-line basket order for a stock market order and an options limit order.
Table 1 - Required Basket File Fields (in order) |
||||
Field |
Data Type |
Possible Values or Example |
Req. Field? |
Req. Value? |
action |
constant |
BUY or SELL |
Yes |
Yes |
quantity |
integer |
e.g. 100 |
Yes |
Yes |
underlying symbol |
string |
e.g. XYZ |
Yes |
Yes |
security type |
constant |
stk, opt, war, fop, fut |
Yes |
Yes |
expiry |
date/time |
YYYYMM e.g. 200610 (for Oct. 2006 expiry) |
For futures and options. |
Yes |
strike |
number |
e.g. 42.5 or 37.0 |
For options. |
Yes |
put-or-call |
character |
P or C |
For options. |
Yes |
exchange |
string |
Any valid destination, e.g. Smart, or NYSE or PHLX or VWAP. NOTE: To clarify any ambiguity for Smart routed contracts, include the primary exchange along with Smart for the destination, for example: Smart/NYSE. |
Yes |
Yes |
order type |
constant |
LMT or MKT or REL, STP STPLMT TRAIL or VWAP (a VWAP order type must also have a destination value of VWAP and the price field must be left blank). For at the open orders, including MOO and LOO, you must enter MKT (for MOO) or LMT (for LOO) and use the OPG value as the time in force. |
Yes |
Yes |
limit price |
number |
e.g. 96.47 or 85 1/2 (fraction or decimal value) Leave blank for a VWAP |
For Limit, Relative and Stop Limit orders only. |
Yes |
aux. price |
number |
e.g. .15, 1/8
(fraction or decimal value) |
For Relative, Stop and Stop Limit orders only. |
Yes. Value may be 0. |
number |
Any decimal value between 0 and 1, e.g. .05 |
Relative orders |
No |
|
currency |
constant |
USD, GBP, etc. |
Yes |
Yes |
basket tag |
string |
Any unique string of alpha or numeric characters used to identify the basket order. This tag appears in the Order Reference field of the Execution report. |
Yes |
No |
time-in-force |
constant |
day, gtc, gtd, ioc, fok, opg, auc |
Yes |
Yes |
goodTilTime |
date/time |
YYYYMMDD hh:mm:ss [zzz] where zzz is an optional time zone. If you do not designate a time zone, TWS uses the time zone from which the order originated. |
Yes |
No |
goodAfterTime |
date/time |
YYYYMMDD hh:mm:ss [zzz] where zzz is an optional time zone. If you do not designate a time zone, TWS uses the time zone from which the order originated. |
Yes |
No |
The fields below are optional in the sense that they are not required for a basic order. However, if you want to use any fields, you must also allow a cell for any preceding fields regardless of whether you enter a value in the fields.
Table 2 - Optional Basket File Fields (in order, continued from Table 1 above) |
||||
Field |
Data Type |
Possible Values or Example |
Req. Field? |
Required Value? |
group |
string |
existing group name |
for Advisors only |
No |
method |
string |
PctChange |
AvailableEquity
NetLiq
EqualQuantity
PctOfPortfolio
for Advisors only |
only if group is specified |
|||
percent |
percent |
number in range 1-100, i.e. 100 |
for Advisors only |
only if method is PctChange |
profile |
string |
existing profile name |
for Advisors only |
no |
account |
string |
existing account name |
for Advisors only |
no |
account |
string |
free text |
for non-cleared customers only |
|
openClose |
string |
open, close |
for non-cleared customers only |
yes |
settlingFirm |
string |
free text |
for non-cleared customers only |
|
shortSaleSlot |
number |
-1 (cust. has shares) -2 (shares are with 3rd party) |
for non-cleared customers only |
|
shortSaleLocation |
string |
MPID of third party |
for non-cleared customers only |
|
origin |
character |
c, f |
for non-cleared customers only |
|
auctionStrategy |
number |
-1 (match) -2 (improvement) -3 (transparent) |
only if exchange is BOX |
|
startingPrice |
number |
i.e. 3.00 |
only if exchange is BOX |
no |
stockRefPrice |
number |
i.e. 25.00 |
only if exchange is BOX |
no |
delta |
percent |
number in range 1-100 |
only if exchange is BOX |
yes |
stockRangeLower |
number |
i.e. 20.00 |
only if exchange is BOX |
no |
stockRangeUpper |
number |
i.e. 30.00 |
only if exchange is BOX |
no |
discretionaryAmt |
number |
i.e. 0.25 |
yes |
no |
displaySize |
integer |
i.e. 100 |
yes |
no |
RTHOnly |
boolean |
true, false |
yes |
no |
blockOrder |
boolean |
true, false |
yes |
no |
sweepToFill |
boolean |
true, false |
yes |
no |
hidden |
boolean |
true, false |
yes |
no |
allOrNone |
boolean |
true, false |
yes |
no |
minQty |
number |
integer, i.e. 100 |
yes |
no |
orderGroup |
string |
free text, i.e. group1 |
yes |
no |
Save the file with a .csv file extension, for example excelBasket.csv. You can save the file to any directory.
You may get several messages when you save, the first saying that the selected file type does not support workbooks with multiple sheets. Click OK at this message. The second tells you your file may contain features not compatible with CSV. Click Yes at this message.
For example, a 2-order basket with the first order a limit order to buy 100 shares of IBM at $91.95 using SMART as the destination, and the second a limit order to sell 1 IBM July05 95.00 call option for $2.00 would look like this:
To transmit this order, open the file from your Basket orders pages.
Copyrights and Trademarks
Copyrights and Trademarks