Establish Connection

Subscription Endpoint Details

The structure of the URL is:

  • wss://<root>/ws/v4?subscribe=<instruments>
  • Each price subscription is of the format orderBook: e.g. orderBook:BTCUSD
  • Multiple subscriptions can be created on one connection by using a comma separated list of subscriptions e.g. orderBook:BTCUSD,orderBook:LTCUSD

Below shows an example subscription for BTC/USD and LTC/USD on a single connection:

wss://trade-sg.oslsandbox.com/ws/v4?subscribe=orderBook:BTCUSD,orderBook:LTCUSD

📘

The publication frequency and depth are set by OSL and are currently set to 2 updates per second at a maximum depth of 50 levels per side.

If subscription is submitted for an instrument that does not exist the subscription will be rejected with HTTP code 404, if multiple instruments are subscribed to all subscriptions are rejected if one of the instrument does not exist.

Market Data Message Details

All messages are published in JSON format. Each message contains a field called action which determines how the message should be processed by the client. A message may contain multiple price data elements that always contain a price, a side and conditionally a size.

The combination of price and side is guaranteed unique and in a naive implementation of unordered books this pair could be used as the key to a hash based map.