Saxo connect
Opens the streaming WebSocket. It is an HTTP GET that upgrades to a WebSocket, carrying a context id you choose and an access token. Data for every subscription made with that context id then arrives on this one connection.
Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.
This is a message of the Saxo OpenAPI streaming connection, not an HTTP endpoint. It has no method and no path: it travels over an open WebSocket connection.
The page says a context id must not be reused except to reconnect to an existing WebSocket, that the server buffers messages so subscriptions can be created while the connection is being opened, and that sending a WebSocket close frame disconnects and cleans up the subscriptions on the server. To keep a connection open past the life of its token, the page describes a PUT to /streaming/ws/authorize with the context id and a new token, answered with 202 Accepted.
The message
- Name
- connect
- Direction
- Request, sent by the client
- Carried by
- WebSocket. Saxo's page says the connection is a plain WebSocket carrying data in binary frames. Subscriptions are not made on it: each is created with an HTTP POST that names the same context id, and those calls are recorded on this site as endpoints.
- Simulation, as the page's example prints it
- https://sim-streaming.saxobank.com/sim/oapi/streaming/ws/connect
Fields
| Name | Type | Description |
|---|---|---|
| contextIdrequired | Not stated | The id of this streaming connection, sent in the query string. At most 50 characters from a to z, A to Z, 0 to 9 and the hyphen. Two connections of one session must not share one. |
| Authorizationrequired | Not stated | The access token, as the word BEARER, a space and the token. Sent as the Authorization header, which the page prefers, or as a query string parameter named authorization where the client platform cannot set headers. |
| messageid | Not stated | On reconnecting only: the id of the last message received, in the query string. The server then starts from the message after it, out of a small buffer of recent messages it keeps. |
What arrives
HTTP status 101 Switching Protocols where the connection is made. Otherwise another status: 400 where the context id is missing or badly formed, 401 where the token is missing, badly formed or expired, 409 where the session already has a connection with that context id, 426 where the WebSocket version is not 13, and 429 where the session already has as many connections as its throttling profile allows.
Limits that apply at Saxo OpenAPI
| Limit | Value | Scope | Source |
|---|---|---|---|
| Headline limit | 120/min per session, per service group | session | developer.saxochecked |