Documentation
The Questrade API allows developers to create their own fully featured trading and analytical applications through their brokerage account.
POST accounts/:id/orders/strategy[/impact]
Allows to (re)place or estimate impact of a multi-leg strategy order against a certain account.
Sample Request
Property | Type | Description |
---|---|---|
id | String | Account number against which order is being submitted.
Can occur in the ‘Location’ header only. |
symbolId | Integer | Internal symbol identifier.
Always an underlying symbol Id. |
limitPrice | Double | Limit price |
orderType | Enumeration | |
timeInForce | Enumeration | |
primaryRoute | Enumeration | Primary order route (e.g., "AUTO"). |
secondaryRoute | Enumeration | Secondary order route (e.g., "NYSE"). |
legs | Complex | Legs data |
strategy | Enumeration |
InsertOrderLegData
Order Leg Data coming from client
Name | Type | Default | Description |
---|---|---|---|
symbolId | Integer | Internal symbol identifier. | |
action | Enumeration | Leg action (e.g. “Buy”) See Order Action section for all allowed values. | |
legQuantity | Integer | Leg quantity |
Maximum of 4 legs is allowed.
If the Strategy Type is set as not Custom, then it will be verified to the mentioned strategy.
NOTE: Leg quantities will be factorized. For example, if you place quantities of 10 and 1000, then they will be sent as an order quantity of 10 and leg ratio quantities of 1 and 100. Price also uses a factorized strategy. Refer to the strategy quote call to be sure which price to use.
New Strategy
Data is the same but URLs for insertion and impact are slightly different.
POST https://api01.iq.questrade.com/v1/accounts/90000004/orders/strategy/impact POST https://api01.iq.questrade.com/v1/accounts/90000004/orders/strategy { "symbolId": 27426, "quantity": 1, "limitPrice": -1.23, "orderType": "Limit", "timeInForce": "Day", "primaryRoute": "MNGD", "secondaryRoute": "AUTO", "legs": [ { "symbolId": 10550014, "action": "Sell", "legRatioQty": 10 }, { "symbolId": 27426, "action": "Buy", "legRatioQty": 1000 } ], "strategy": "Custom" }
Sample JSON response for impact:
{ "estimatedCommissions": 30.830048, "buyingPowerEffect": -14161.660096, "buyingPowerResult": 1957395.027392, "maintExcessEffect": -7080.830048, "maintExcessResult": 978697.513696, "tradeValueCalculation":"10 x (-1.23) x 100 = CR 1,230.00 USD", "legs": [ { "legId": 0, "symbol": "MSFT", "symbolId": 27426, "legRatioQuantity": 100, "side": "Buy", "avgExecPrice": null, "lastExecPrice": null }, { "legId": 1, "symbol": "MSFT20Jan17C70.00", "symbolId":" 7413503, "legRatioQuantity": 1, "side": "STO", "avgExecPrice": null, "lastExecPrice": null } ], "side": "Buy", "effect": "Credit", "price": -1.23, "strategy": "CoveredCall" }
Sample JSON response for insertion:
{ "orderId": 330711306 , "orders": [ { "id": 330711306 , "symbol": "MSFT", "symbolId": 27426, "totalQuantity": 10, "openQuantity": 10, "filledQuantity": 0, "canceledQuantity": 0, "side": "Buy", "orderType": "Limit", "limitPrice": -1.23, "stopPrice": null, "isAllOrNone": false, "isAnonymous": false, "icebergQuantity": null, "minQuantity": null, "avgExecPrice": 0, "lastExecPrice": null, "source": "TradingAPI", "timeInForce": "Day", "gtdDate": null, "state": "Pending", "rejectionReason": "", "chainId": 330711306, "creationTime": "2015-08-24T15:48:58.476000-04:00", "updateTime": "2015-08-24T15:48:58.594000-04:00", "notes": "", "primaryRoute": "MNGD", "secondaryRoute": "AUTO", "orderRoute": "MNGD", "venueHoldingOrder": "", "comissionCharged": 0, "exchangeOrderId": "", "isSignificantShareHolder": false, "isInsider": false, "isLimitOffsetInDollar": false, "userId": 90040, "placementCommission": null, "legs": [ { "legId": 0, "symbol": "MSFT", "symbolId": 27426, "legRatioQuantity": 100, "side": "Buy", "avgExecPrice": 0, "lastExecPrice": null }, { "legId":1, "symbol": "MSFT20Jan17C70.00", "symbolId": 7413503, "legRatioQuantity": 1, "side": "STO", "avgExecPrice": 0, "lastExecPrice": null } ], "strategyType": "CoveredCall", "triggerStopPrice": null, "orderGroupId": 0, "orderClass": null, "isCrossZero": false } ... ] }