OpenAPI supports trading industry standard and custom option strategies, such as Straddles, Condor and Butterfly strategies. These are orders are a form of basket orders, where one order is place to open multiple positions simultaneously. Each order is referred to as a "leg", and to maintain the desired risk and exposure the exchange guarantees symmetrical filling of all legs.
Currently the pre-defined strategies are:
BackRatio - Consists of two options, of same type and expiry, but with different amounts and strike prices.
Butterfly - Non directional strategy that combines legs of same expiry, but with varying amounts and strike prices.
CalendarSpread - A calendar spread is a long-short position is two calls or two puts. Both options have the same strike, but they have different expiration.
Condor - A condor strategy leverages four options with same expiry. A buy and a sell in the money, and a buy and a sell out of the money. Can also be characterized as two call spreads.
Diagonal - A diagonal spread is two options of the same type, one buy and one sell, but with different expiry times and different strike prices. Essentially a combination of a Vertical and Calendar spread.
IronButterfly - Two overlapping vertical spreads. One of the verticals is on the call side and one is on the put side.
IronCondor - A combined put and call spread with same expiration but varying different strikes.
RiskReversal - One leg is an out-of-the-money put, the other leg is an out-of-the-money call.
Straddle - A call and a put with the same underling strike price and maturity expiration date
Strangle - A call and put with different strike prices but with the same expiry.
Vertical - A vertical spread has two legs. One is buy and one is sell with same expiration date, but with different strike prices.
All other combination of individual legs are considered user-defined "custom" strategies.
Only option instruments are accepted as legs, so strategies that combine AssetTypes, such as Covered Calls and Married Puts are not supported yet.
Multi-leg orders are only supported on the trade/v2/orders endpoint.
Build a new option strategy
To simplify the process of building a pre-defined strategy with the nearest strike price and expiry date, simply submit the AccountKey, OptionRootId and strategy type to the /multileg/defaults/ endpoint.This is typically used to populate defaults in a trade module when a strategy is selected.
GET https://gateway.saxobank.com/sim/trade/v2/orders/multileg/defaults/?AccountKey=zlE1Jm-x97p5WwV7-91GkA==&OptionRootId=309&OptionsStrategyType=Straddle
A response will be a list object containing up to 4 legs. StrategyName, Strike, CallPut and Expiry are added for readability purposes, a these fields are implicit to the selected instrument. In the below example. UIC 1483298 denotes the specific Call option in this chain that expires at October 25 and has a strike price of 245.
{ "Legs": [ { "Amount": 1, "AssetType": "StockOption", "BuySell": "Buy", "OptionData": { "ExpiryDate": "2019-10-25T00:00:00Z", "PutCall": "Call", "StrikePrice": 245 }, "Uic": 14803298 }, { "Amount": 1, "AssetType": "StockOption", "BuySell": "Buy", "OptionData": { "ExpiryDate": "2019-10-25T00:00:00Z", "PutCall": "Put", "StrikePrice": 245 }, "Uic": 14803338 } ], "StrategyType": "Straddle", "ManualOrder": true }
Price a option strategy
When a list of strategy options (legs) has been selected, a price for the whole strategy can be requested as a single request or as a continuous subscription. Typically this price may act as a basis for a Bid/Ask on a limit order.
POST https://gateway.saxobank.com/sim/trade/v1/prices/multileg { "AccountKey":"zlE1Jm-x97p5WwV7-wOGkA==", "Legs": [ { "Amount": 1, "AssetType": "StockOption", "BuySell": "Buy", "Uic": 14803298 }, { "Amount": 1, "AssetType": "StockOption", "BuySell": "Buy", "Uic": 14803338 } ] }
To start a subscription to a price, simply use the /subscription endpoint as with other AssetTypes and enter the legs in the arguments.
POST https://gateway.saxobank.com/sim/trade/v1/prices/multileg/subscription { "Arguments": { "AccountKey":"zlE1Jm-x97p5WwV7-wOGkA==", "Legs": [ { "Amount": 1, "AssetType": "StockOption", "BuySell": "Buy", "Uic": 14803298 }, { "Amount": 1, "AssetType": "StockOption", "BuySell": "Buy", "Uic": 14803338 } ] }, "ContextId": "123456789", "ReferenceId": "MultilegPrice01" }
The response will including prices for each individual leg as well as an overall price for the strategy:
{ "BuySell": "Buy", "InstrumentPriceDetails": { "IsMarketOpen": true, "ShortTradeDisabled": false }, "LastUpdated": "2019-11-21T14:59:08.102712Z", "Legs": [ { "Amount": 1.0, "AssetType": "StockOption", "BuySell": "Buy", "InstrumentPriceDetails": { "IsMarketOpen": true, "ShortTradeDisabled": false }, "LegId": "1", "Quote": { "Ask": 2.48, "Bid": 2.43, "DelayedByMinutes": 15, "ErrorCode": "None", "Mid": 2.455, "PriceTypeAsk": "OldIndicative", "PriceTypeBid": "OldIndicative", "RFQState": "None" }, "ToOpenClose": "Undefined", "Uic": 15266270 }, { "Amount": 1.0, "AssetType": "StockOption", "BuySell": "Buy", "InstrumentPriceDetails": { "IsMarketOpen": true, "ShortTradeDisabled": false }, "LegId": "2", "Quote": { "Ask": 1.22, "Bid": 1.21, "DelayedByMinutes": 15, "ErrorCode": "None", "Mid": 1.215, "PriceTypeAsk": "OldIndicative", "PriceTypeBid": "OldIndicative", "RFQState": "None" }, "ToOpenClose": "Undefined", "Uic": 15266321 } ], "PriceSource": "OPRA", "Quote": { "Ask": 3.7, "Bid": 3.64, "DelayedByMinutes": 15, "ErrorCode": "None", "Mid": 3.67, "PriceSource": "OPRA", "PriceSourceType": "Firm", "PriceTypeAsk": "OldIndicative", "PriceTypeBid": "OldIndicative", "ReferencePrice": 3.70118726, "RFQState": "None" }, "StrategyType": "Straddle" }
Place an order for a option strategy
To place or precheck an options strategy order, use the dedicated endpoints. When placing an order you will need to provide the desired AccountKey and the OrderType on the strategy as well as ToOpenClose on each leg.
- AccountKey - Unique key identifying the account to place the order on.
- OrderDuration - How long the order is to remain in the market. Only DayOrder is currently supported.
- OrderPrice - Total desired limit price for all the legs with given amounts.
- OrderType - Type of order. Currently only Limit is supported.
- TraderId - Required by some platforms to indicate userid of who placed the order.
- ManualOrder - Required by some platforms to indicate if order is placed automatically or manually.
- Legs - List of orders in the batch that are to be filled symmetrically. (see below)
Each leg(order) consists of:
- Amount
- AssetType
- BuySell
- ToOpenClose
- Uic
- OrderContext
For a description of these fields, please see the parent Order Placement document.
Since orders are symmetrically filled, the amounts on each leg must be wholly divisible with one another.
Example:
POST trade/v2/orders/multileg/precheck or POST trade/v2/orders/multileg { "AccountKey":"zlE1Jm-x97p5WwV7-wOGkA==", "OrderDuration": {"DurationType": "DayOrder" }, "OrderPrice": 0.8, "OrderType": "Limit", "ManualOrder": true, "Legs": [ { "Amount": 1, "AssetType": "StockOption", "BuySell": "Buy", "ToOpenClose": "ToOpen", "ManualOrder": true, "Uic": 14853018 }, { "Amount": 1, "AssetType": "StockOption", "BuySell": "Buy", "ToOpenClose": "ToOpen", "ManualOrder": true, "Uic": 14853056 } ] }
If doing a precheck, the response will include the familiar precheck properties:
{ "EstimatedCashRequired": 5.52, "EstimatedCashRequiredCurrency": "EUR", "InstrumentToAccountConversionRate": 0.9088, "PreCheckResult": "Ok" }
When placing an order, the resulting orderIds will be returned, one for each leg and a 'master' multi-leg orderid.
{ "MultiLegAmount": 1.0, "MultiLegOrderId": "88608648", "Orders": [ { "OrderId": "88608649" }, { "OrderId": "88608650" } ] }
Orders and Positions
Once an order is placed, they will be available in the portfolio/orders service. Each leg will be a separate order and all orders in same strategy will be returned with a new property MultiLegOrderDetails. This structure contains relevant common properties for the strategy. MultilegOrderId can be used to group the orders.
{ "OrderId": "88608649", "AccountKey": "zlE1Jm-x97p5WwV7-wOGkA==", ... "MultiLegOrderDetails": { "Amount": 1.0, "BuySell": "Buy", "CurrentPrice": 3.079999566, "Description": "AAPL Straddle 29X19 P267.5/C267.5:xcbf", "DistanceToMarket": 2.279999566, "LegCount": 2, "MultiLegOrderId": "88608648", "Price": 0.8, "StrategyType": "Straddle" }, ... }
Important
These tools are only for order placement, so once filled, the resulting positions loose their relation are grouped into NetPositions by instrument (uic). In other words, resulting positions are unrelated and must be closed by placing an opposite "ToClose" strategy, or by individually closing each position.
Change an order for a option strategy
Due to the nature of the symmetrical filling, only a limited number of properties may be modified on an existing open multi-leg order. The Price is the total price you are willing to accept/pay for the strategy. The Amount will be symmetrically multiplied onto the leg amounts. If each leg consists of 10 lots and Amount of the overall strategy is changed to 2, then each leg amount will be updated to 20 lots.
PATCH trade/v2/orders/multileg { "AccountKey": "zlE1Jm-z97p5WwV7-9OGkA==", "MultiLegOrderId": "88608649", "OrderPrice" : 1.12, "Amount": 2 }
Cancel an order for a option strategy
To cancel an open order, use the DELETE end point.
DELETE trade/v2/orders/multileg/88608649/?AccountKey=zlE1Jm-d97p5WwV7-9OGkA==
See also the live sample on option strategies (with source).