New Customer Offer: Pay 0% interest for up to six months on $5K USD when you join Questrade with code 0MARGIN. Open a new margin account.

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

Allows to (re)place or estimate impact of a multi-leg strategy order against a certain account.

Sample Request

PropertyidTypeStringDescriptionAccount number against which order is being submitted. Can occur in the 'Location' header only.
PropertysymbolIdTypeIntegerDescriptionInternal symbol identifier. Always an underlying symbol Id.
PropertylimitPriceTypeDoubleDescriptionLimit price
PropertyorderTypeTypeEnumerationDescriptionOrder type (e.g., "Market"). See Order Type section for all allowed values.
PropertytimeInForceTypeEnumerationDescriptionOrder duration (e.g., "DAY"). See Order Duration section for all allowed values.
PropertyprimaryRouteTypeEnumerationDescriptionPrimary order route (e.g., "AUTO").
PropertysecondaryRouteTypeEnumerationDescriptionSecondary order route (e.g., "NYSE").
PropertylegsTypeComplexDescriptionLegs data
PropertystrategyTypeEnumerationDescriptionStrategy type (e.g. "CoveredCall") See Strategy Types section for all allowed values.

InsertOrderLegData

NamesymbolIdTypeIntegerDefaultDescriptionInternal symbol identifier.
NameactionTypeEnumerationDefaultDescriptionLeg action (e.g. "Buy") See Order Action section for all allowed values.
NamelegQuantityTypeIntegerDefaultDescriptionLeg 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.

HTTP
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:

JSON
{
    "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:

JSON
{
    "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
        }
        ...
    ]
}

Already a Questrade client?

Create your first application using your Questrade account.

Integrate your application with Questrade API

Support

Report an issue

Have questions about Questrade's API? Tell us how we can help, send us an email.

Request a feature

We want your ideas on how we can improve our API. If you have a suggestion for a minor tweak, a major overhaul, or something brand new, please share it with us.

If you are using an api app developed by a third party, you are required to read, understand and accept the end-user license agreement for application program interface. If you are utilizing api access for an api-enabled app you built, you are required to read, understand and accept the Questrade personal application program interface ("api") license agreement ("license agreement"). This agreement can be found below. You may be bound by both agreements.

See All

POST accounts/:id/orders/strategy[/impact]