TWS BasketTrader Webinar Notes


The TWS BasketTrader lets professional traders and investors trade a basket of individual underlying components as a package. Use this advanced TWS component to:

  • Customize a basket of individual securities or commodities orders for submission as a package execution.
  • Create a basket simply by selecting the index you want to replicate. Choose between the true index composition, and its statistical representation. TWS maintains the index composition based on your defined criteria.
  • You can also cancel any unexecuted portion of your basket or reverse the basket's original order instructions with a single command.

With the TWS Basket Trader you can retrieve custom basket files, update order prices, monitor pending orders, view executions and updates in your portfolio from this optimized trading tool.

Access BasketTrader

  • Mosaic:
    • New Window Button > Advanced Tools > Basket Trader
    • File menu > Open Layout Library > Basket Trader
  • Classic TWS:
    • Trading Tools > BasketTrader
    • Right click on Quote Monitor “+” tab > BasketTrader
Access BasketTrader

Create a Basket File

To get started, you will first need to create and save the basket file.

Create a Basket in Classic TWS

First, create the orders to include in your custom basket file by saving non-transmitted orders from a single Classic TWS trading page.
When saving the basket file, you can only include orders from the same Classic TWS tab.

  • Modify order parameters Time in Force, Action, Quantity, Price, Order Type, or Destination, where needed.
    DO NOT TRANSMIT – you are creating a file to submit as a package in the BasketTrader.
  • On the Trade menu, select Save Orders as Basket. If not visible, expand the menu with the arrowhead at the bottom.
  • The basket name defaults to the same as the Quote Monitor tab used. You can also edit the .csv filename and click OK. The .csv file will be saved in your local JTS settings folder.
  • Cancel pending orders you created from the Trade menu: select Cancel > Cancel All Orders on Page.

Create a Basket in Excel

You can also construct and edit a basket file manually in an application such as Excel. You may find the easiest way to begin creating a basket file is to start with a sample, formatted set of orders that you create through TWS. Then when you save the basket file, you have a sample layout for adding your own header fields, order rows and basket components.

First create a TWS basket file from a trading page to use as a sample. Save to the default JTS settings folder. Then open the sample file in Excel from the JTS folder on your local drive to use as your starting point to edit the fields and/or create new order rows. TWS creates a basket file from orders on a single trading page.

  • Basket files should be saved as a .csv file. (The legacy .bsk file extension is still supported in the new basket layout but not recommended for new files.)
  • Valid Header Row fields include all TWS fields. See the Basket Fields topic for a starter list of basic order fields.
  • You can combine orders from multiple basket files into one using Excel. Just open the.csv file and copy and paste the desired rows to combine separate basket files into one.

Create a Basket File based on an Index

The Index Panel can be expanded to define a traditional basket of stock trades based on an index. To create and save a reusable Index based Basket, use the standalone TWS IndexTrader window. Trading Tools > Multi Contract > Index Trader. Once defined and saved, the index-based basket can be opened in the BasketTrader.

First, expand the Index Panel for selections to fine-tune your criteria. If you choose to base your basket on the index composition, the system automatically keeps the basket in line with the index composition as it changes.

  • Begin by selecting an index from the drop down list
  • Next, customize the composition of the basket by filtering out components such as those based on price, symbol, index weight, market cap, or beta factor to fine tune your index basket.
  • Enter the total number of shares or currency amount for this basket of trades and select order type and time in force.
  • To update order criteria for the basket, go to the TWS Trade menu you can select Trade > Modify Multiple Orders.
  • The number of orders, total shares and estimated value of the orders will be displayed in the Orders panel.
  • Select the "Hide Index Panel" button to collapse the Index panel set-up to view the Orders panel with your basket of orders displayed.

Load a Basket File

To load a Basket file:

  • The Basket File field drop down arrow will show the recently loaded Basket File list.
  • Click Browse button to open your JTS settings folder and locate your custom designed basket file.
  • Modify the Multiplier if necessary. This value multiplies the quantity of each order in the basket.
  • Click the Load button to populate the Order panel with the selected basket file.
  • You can modify a basket order criteria before transmitting by using TWS Trade menu > Modify Multiple Orders to adjust the basket’s order criteria
  • View the total shares and estimated basket order value.
  • You can transmit individual orders within the basket using the Orders tab.

Before the basket of orders is populated, a window opens up asking for you to specify how odd lot sizes should be handled. Keep in mind that applying rounding rules may result in an investment amount that is significantly higher than your original amount. You can instruct TWS to remember your decision.

Next, you also need to indicate if this will be a Program Index Arbitrage Trade or not.

index arbitrage trade box

The basket of trades will then load in the Order panel.

Order Panel

The Orders panel shows individual ticker rows with current market quotes and order criteria on each row, plus real-time summary information about the basket, including the number of orders, total shares, and the estimated total value of the orders in your basket.

When you send a basket order, each order in the basket is cleared individually. If your account does not meet margin requirements, it is possible that only a portion of the basket order will execute.

basket click to execute

Above the order rows, you can verify the number of orders, total shares and real-time estimated value of the basket.

You can modify a basket order before you transmit it by adding or removing assets, changing quantities, and reversing the order action, etc.

Use the buttons along the bottom of the panel to make global changes to all orders, or modify parameters for specific orders directly in the order line.

  • Configure - add additional columns or re-order the column layout
  • Insert - add a new row
  • Delete - remove a row
  • Clear - clear the order panel
  • Reverse - reverse the Buy/Sell action for each order

Update Order Prices

Before transmitting, you can automatically update the order prices for the basket to coincide with the current ask, bid, midpoint, closing or last price.
Click Update Orders from the Edit menu to alter order attributes for the basket:

update orders
  • Select which orders to update
  • Set the order type and time-in-force or check Convert Limit to Market
  • Choose the current market data field (ask, bid, midpoint, closing or last price) to use as the order price with an optional offset in amount or percentage terms.
  • If some of the order attributes are not applicable to certain orders, specify how you want to proceed: proceed, skipping invalid orders, ask before proceeding or just abort the operation.
  • To set your selections as a default, choose to use these settings next time dialogue opens.

Note: when using BasketTrader as a trading page, use the TWS Trade menu to select Modify Multiple Orders.

Transmit the Basket

In the Execute Basket panel, click Transmit to send the entire basket order.

The Execute panel lets you set allocation criteria to control the quantity submitted.

execute basket panel
  • Use the Quantity field before transmitting, to adjust the total basket quantity by percentage or amount.
    • Specify a percentage, which will be applied to each order quantity, for example 50% means the quantity of each order in the basket is halved
    • Or define an amount that is divided by the number of orders and allocated equally among all orders.
  • Transmit button sends your defined basket of trades to the markets, order status colors will update so you know at a glance the status of each order. You can also transmit individual orders within the basket by clicking the "T" (Transmit) button on the individual order rows.
  • Cancel All button - sends a cancel request for all orders on the page and clears pending orders in the Orders Panel.

    Note: Marketable orders may be immediately filled upon submission and therefore may not be able to be cancelled.

  • Cancel & Reverse button - sends a cancel request for all orders and creates reverse orders to re-transmit.

    Note: Orders that have child orders associated with them, such as brackets, cannot have the order side flipped so the Reverse and Cancel and Reverse features will be disabled.

  • When you send a basket order, each order in the basket is cleared individually. If your account does not meet margin requirements, it is possible that only a portion of the basket order will execute.

You can save the executed portion of any basket as a new, reversed basket file. On File menu select Save Executed Portion as Reverse Basket and enter a name for the new file.

Note: When using BasketTrader as a trading page, use the TWS Trade menu to select Modify Multiple Orders.

Summary Section

BasketTrader Executions are listed on the Summary panel at bottom of the screen which also displays across all areas of the order, including overall totals, and percent of basket filled by orders, shares and currency. It also includes tabs with data taken directly from the Trades and Account window.

Trades tab displays orders filled using BasketTrader. All order executions can also be viewed, using the Trades icon on the main Trading window.

Portfolio tab displays the same information as in the Account window with positions, average price and P&L information.