This tutorial builds on the previous one and further expands the functionality of the bulk trader by introducing timed durations ("GoodTillDate") and related orders. The goal is to cover a use case where the user is looking to place more than a simple market, limit, or stop order. Instead, we can now:
- Precisely control for how long our orders will stay active
- Add risk controls in the form of related stop loss orders
- Automatically take profit on a position if the market moves in our favor
To use this sheet, follow these steps:
- Refresh the account overview and clear the order list by clicking "Reset & Load Accounts". The top account will be used to place these trades on.
- Enter order details as per instructions below. All fields are mandatory except for the price fields.
- Make sure to enter the data according to the specifications. Click "Send Orders" to start bulk placement.
Criteria for each order:
- Enter the UIC, Symbol, and AssetType of the instrument you are looking to place.
- Buy/Sell: Use only exact values "Buy" and "Sell".
- Duration: "GoodTillCancel", "DayOrder", or a date in the format "2019-08-30" (expires at end of day). Other formats will not work.
- Take Profit: Enter price level similar to "Price" column (duration will be GTC)
- Stop Loss: Enter price level similar to "Price" column (duration will be GTC)
The final result looks as below:
Constructing a valid order body to be posted to the trade/v1/orders endpoint is by far the most challenging part of this tutorial. Because of the number of different combinations, the structure of this body changes. This is the VBA that generates the correct orders depending on user input: