Manually Create a Basket File

Instructions

A valid basket file will have a clean relationship between the header row and order rows. The header fields can occur in any order as long as the values in the order rows correspond to the Header field.

Format the basket file as shown below, where the top row is the Header row, and subsequent rows are order rows. The Header Row includes field titles for each order value. The Order Row includes order values that correspond with the appropriate Header Row field title for that order type.

Field 1 Field 2 Field 3 Field 4 Field 5 Field 6 Field 7 Field 8
value value value   value value   value
value value value value value   value value
value value value value value value value value

For example:

Notes About Creating Basket Files:

  • For derivatives, if you use the format YYYYMM, we understand you are using the last trading day. If you use the format YYYYMM we understand you are identifying the contract month. Both formats are accepted in column E LastTradingDayorContractMonth.

  • Valid Header Row fields include all TWS fields. For a starter list of some basic fields, see the Basket Fields topic.

  • Child values in the order row fields must match the fields in the parent Header Row in content. For example, if your Header Row field is Symbol and you enter the value STK in that field of the order row, your file will not be readable.

  • Basket files created in a text editor must be saved as a .csv (preferred) or .bsk file.

Although not recommended for new files, the .bsk file extension is still supported in the new basket layout.

  • For basket files created in a text editor, do not leave a space between a value and its comma, or TWS will not be able to read the file.

  • If you create your basket file in Excel, enter only one value (or no value) per cell and DO NOT use commas.

  • Save your Excel basket file as a .csv file.

  • Fields in the Header Row need not be in any specific order as long as they have a corresponding correct value in the order row field.

  • If the order does not require a field value, that field can be left blank.

The major differences between the original and improved basket file formats include:

Old Basket File New Basket File
Old version supported only limited number of pre-defined fields. New version supports all TWS fields.
Old version required you to enter order values in a specific sequence. New version does not require any specific order sequence for fields.
Old version required only order values (since the "header" fields were hard-coded into TWS). New version requires a header row with order-specific field titles. Use multiple header rows in a single basket for order types that require different field values.
Old version required blank placeholders for values that were not required. New version requires an exact one-to-one relationship between a header field and an order value; you cannot leave an order field blank if there is a header field defined.
Old version was saved as .bsk (TWS-specific) file. New version uses .csv (generic) file extension.

 

Additional Resources

Learn About BasketTrader in Trader Workstation at IBKR Campus

Visit the Trader Workstation Website