In this lesson we will walk through how to create a basket of orders for multiple instruments in the TWS BasketTrader and submit them. The TWS BasketTrader is a powerful tool that is useful when the user wants to submit multiple orders at one time and monitor the progress of those orders. BasketTrader can be accessed in both Classic TWS and Mosaic as well as being on a preconfigured page in the Layout Library.
To access BasketTrader from Mosaic click on the New Window Area in the top left corner, scroll down to the Other Tools section and highlight “More Advanced Tools” and choose BasketTrader. The BasketTrader will appear as a separate window. You can configure the settings and data column layout of the BasketTrader by clicking on the configure wrench icon in the top right-hand corner of the screen. Click on settings on the left-hand side to choose whether to:
- Instantly remove basket orders from pending page
- Show statistics for main and attached orders separately
- Ignore loading zero quantity orders
- And adjust the font size
Click on the BasketTrader layout section to choose which data columns to be shown in the BasketTrader.
In this case Financial Instrument, Bid, Ask, and Last are shown. You can add any of the columns in the Available Columns area by clicking on the plus sign to expand a bucket to view its contents, or type into the search bar. Let’s type Change and add Change % by highlighting it and clicking the “Add” button. Click Apply and OK.
The BasketTrader consists of five areas: At the top you can choose a file to upload to use as the basket. We will go into how to create basket files and upload them in the next lesson. Directly below is the Order Panel, followed by the Execute Basket buttons, Summary panel, and Trade log. You can create multiple baskets by clicking on the plus tab in the upper left-hand corner.
For this lesson we will manually create a basket. BasketTrader supports orders for multiple instruments and asset classes. In the Orders area click on a box in the Financial Instrument column and enter a symbol. We will type AAPL and select stock. You can select whether to round up to 100 shares or leave as an odd lot. We will choose to round up to 100 and click ok. We can edit the Action and Quantity by clicking on the Total Quantity, Time in Force, Order Type, and destination. For our next order we will enter a sell Limit order for 500 shares in ticker SPY. Type SPY in the box under AAPL, change the Action from buy to sell and click on the Total Quantity. Scroll down and select 500 shares. We can also adjust the price by clicking on the value in the Limit Price column, let’s select bid -200% of the spread.
Now we will enter an option order for IBKR. Type IBKR underneath SPY and select option, the option chain will appear. Select the expiration, the right, and the month. Once the option is selected it will appear in the order window. Close out the Option Chain and we will change this to a 10 lot and a market order. For our last order type in ES, scroll down to Futures and select December. Let’s change this to a Sell order, change the quantity to 5, and enter a limit price. You can add in as many orders as you like and export the file as a csv by clicking on File in the upper left-hand corner and Save basket as, name the file and pick the directory you’d like to save it in.
At the bottom of the Order section there are 5 buttons. Configure allows you to configure the Settings and Layout. Insert will insert a row into the Order area. Delete will Delete a row from the Order Area. Clear will clear out the order page. And reverse will change the Action from buy to sell or sell to buy. You can also convert all Limit orders to market if you like.
Underneath the Order section is the Execute Basket area in which, with a press of a single button you can Transmit the basket, pause the basket execution, cancel all outstanding orders in the basket, or cancel all outstanding orders and reverse the action. You can also transmit a percentage of the basket if you do not want to send 100% of the basket at once by changing the percentage. When ready to send the basket click submit and the Summary area will populate showing the progress of the Buy and Sell orders. You can see the progress in Orders, Contracts, and Dollar amount filled. The trade log below will show completed orders.
The TWS BasketTrader is a powerful tool that allows you to submit multiple orders at once in multiple instruments and asset classes. Please see the lesson on uploading and creating basket files for more information.
I am struggling to generate a csv file with stop loss orders that maps the AuxPrice field once loaded in Basket trader. The fields for the csv file do not appear to be formatted in the same way as those in the TWS basket trader.
Hello Edward, thank you for reaching out. Please view this FAQ with instructions to upload a CSV Basket file to BasketTrader:
https://www.ibkr.com/faq?id=64159770
We hope this helps!
For some reason the TRAIL Stp function does not work properly when I upload a CSV Basket file to basket trader. I usually enter bracket orders with a Profit target and a Trail Stp – No issues with parent order and profit target but Trail Stops always remains AT market level and does not move along the corresponding trailing amount. These are all the fields I use in my CSV and corresponding values (i use a $0.90 trailing amount in below example) What do I do wrong? Any field missing? Action = SELL Symbol = AAPL Quantity = 200 SecType = STK Exchange = SMART Currency = USD TimeInForce = DAY OrderType = TRAIL LmtPrice = (blank) AuxPrice = 0.90 StopPrice = (blank) Account = xxxxxxxx AutoCancelDate = xxxxx Rth = TRUE OrderId = (blank) ParentOrderId = (same as parentID) Thanks!
Hi Ron, thank you for reaching out. It is not possible to create a bracket order as described. If you have further questions on this issue, please create a web ticket for this inquiry; we have a category specifically for “API.” One of our API experts will be happy to guide you! http://spr.ly/IBKR_ClientServicesCampus
After I create a basket of Stop Loss Orders in the Basket Trader, how do I attach Bracket Orders to each Stop Loss Order ?
Thank you for reaching out. This is possible in the individual line for the Order. However, it is not possible using Basket Trader. You can right-click the order to add the bracket. We hope this helps!
May I ask this function allow bulk orsers?? example: I have few clients to place the same stock at the same time?
Thank you for asking. Yes, you can use the BasketTrader to trade for multiple clients at the same time. We hope this answers your question!
How do you create disambiguation between securities using the same ticker symbol on different exchanges? My uploaded basket picks the wrong security in multiple cases.
The “Exchange” and “Currency” columns help ensure the right security is selected, and is available by default.
Hello, thank you for reaching out. When you search the ticker in BasketTrader, TWS automatically pulls up all of the exchanges that the product is offered on at IBKR. Please reach back out with any additional questions. We are here to help!
Is it possible to load full fields for the accumulate/distribute order type (including conditions) from a basket CSV file?
Hello, thank you for asking. Yes, this should be possible. Please view this course for more details: https://www.interactivebrokers.com/campus/trading-lessons/tws-baskettrader-part-2-upload-a-basket/
We hope this helps!
I don’t see this option for BasketTrader in the menu as shown and nothing shows up if I search for Basket either.
Hello, thank you for reaching out. We cannot replicate your issue. You can open the BasketTrader from the New Window button in Mosaic or the Trading Tools menu in Classic TWS. Please view this FAQ for additional information: https://www.interactivebrokers.com/faq?id=64159767
Please ensure that you are using an updated version of TWS. If you continue to experience difficulties, please reach back out. We are here to help!
I don’t have an option for BasketTrader. Could this be because I’m on the paper account?
Hello, thank you for reaching out. Please view this FAQ for instructions to open BasketTrader: https://www.interactivebrokers.com/faq?id=64159767
If you continue to experience issues, please contact Client Services: http://spr.ly/IBKR_ClientServicesCampus