Young man smiling

Documentation

The Questrade API allows developers to create their own fully featured trading and analytical applications through their brokerage account.

Streaming

Streaming services in Qiestrade API allows client applications to subscribe and receive push notifications on order status changes, executions and as well as subscribe to L1 market data and receive quotes in steaming mode.

Order Notifications

Request notification port

  
  GET https://api01.iq.questrade.com/v1/notifications?mode=RawSocket
  GET https://api01.iq.questrade.com/v1/notifications?mode=WebSocket

Response:  
      {
              "streamPort": 8080  
      }  

Notifications endpoint does not accept JSON format messages. You can hardcode the mode as it’s unlikely you’ll change it within the same application.

Ports do not change on the same URL within the same day. On a different URL, however, they can be different.

You cannot connect to both RawSocket and WebSocket at the same time. When you create a second connection, it will disconnect the previous one.

  • On RawSocket, within 5 seconds after the connection is established, send the access token and then ' ' as a delimiter (a space character)
  • On WebSocket, send the access token as a message without any delimiters

Note: Do not use the word Bearer in sockets

If the token is recognized, the response message will be:

  
      {"success": true}
   

Notification response will include either:

 
      {"orders": [...], "accountNumber": XXXXXXXX}
   

Order Data structures (same as on GET orders endpoint) or

 
     {"orders" : [...], "executions" : [ ...], "accountNumber" : XXXXXXXX}   
   

Execution Data structures (same as on GET executions endpoint)

Note: Executions always update orders so there cannot be executions without orders. Keeping a socket open does not extend your session. You need to send requests at least every 30 minutes otherwise your socket will get disconnected when the session expires.

L1 Streaming

Same as for notifications, you can use either WebSocket or RawSocket Ports for L1 are separate but still remain same for the same URL within the same day.

Note: If you use L1 Streaming in Trading API, then your market data will freeze in any other IQ Platform that you are using simultaneously.

You must specify stream=true (or '"stream": true' in JSON) and then the mode you want to use

 
GET https://api01.iq.questrade.com/v1/markets/quotes?ids=9291,8049"stream=true"mode=RawSocket
POST https://api01.iq.questrade.com/v1/markets/quotes/options 
      {
            "stream": true ,
            "mode": "RawSocket" ,
            "filters": [
               {
                   "optionType": "Call" ,
                   "underlyingId": 27426 ,
                   "expiryDate": "2017-01-20T00:00:00.000000-05:00" ,
                   "minstrikePrice": 70 ,
                   "maxstrikePrice": 80 
               },
               ...
         ],
                "optionIds":
         [
             9907637 ,
             9907638 ,
                ...
         ]
     } 

 POST https://api01.iq.questrade.com/v1/markets/quotes/strategies
      {
            "stream": true ,
            "mode": "RawSocket" ,
            "variants": [
               {
                     "variantId": 1 ,
                     "strategy": "Custom",
                     "legs:  [
                         {
                              "symbolId": 27426 ,
                              "ratio": 1000 ,
                              "action": "Buy" 
                         },
                        {
                             "symbolId": 10550014 ,
                             "ratio": 10,
                             "action": "Sell" 
                           }
                       ]
                  },
                     ...
              ]
       }  

Downloads

C plus plus

C ++

Dec 18, 2015Version 1.1.0
Release notesDownload API
C sharp

C #/Active X

Dec 18, 2015Version 1.1.0
Release notesDownload API

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.

Get Started

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.

Get Started
See All