WebSocket Market Data API

Below document describes requests and responses for market data using websocket API. The three major categories of data including orderbook data, recent trade data and candle data
All requests must be sent after autorization.

Book

Subscribe Book Request

Request to subscribe to order book information.
     {
       "operation": "SUBSCRIBE_BOOK",
       "data":[                    // List of symbols
         "BTCUSD.P",
         "BCHUSD.P"
       ]
     }

Unsubscribe Book Request

Request to unsubscribe to order book information.
     {
       "operation": "UNSUBSCRIBE_BOOK",
       "data":[                     // List of symbols
         "BTCUSD.P",
         "BCHUSD.P"
       ]
     }

Book Snapshot Message

Sample messages for orderbook information
     {
        "e":"bookSnapshots",       // Event type
        "data":[                   // list of snapshots
           {
              "s":"BTCUSD.P",      // symbol
              "b":[                // bids
                 [
                    9185.74,       // price
                    48             // cumulative quantity per price level
                 ],
                 [  9184.23, 32  ],
                 [  9184,    78  ],
                 ...
                 [  9154.52, 19  ]
              ],
              "a":[                // asks
                 [
                    9205.05,       // price
                    9              // cumulative quantity per price level
                 ],
                 [  9206.3,   6  ],
                 ...
                 [  9243.34, 79  ]
              ]
           },
           {
              "s":"BCHUSD.P",      // symbol
              "b":[                // bids
                 [
                    290.22,        // price
                    7              // cumulative quantity per price level
                 ],
                 [  290.12,  94  ],
                 ...
              ],
              "a":[               // asks
                 [
                    290.48,       // price
                    14            // cumulative quantity per price level
                 ],
                 ...
              ]
           }
        ]
     }

Book Update Message

Sample messages for orderbook updates
     {
        "e":"bookUpdates",         // Event type
        "data":[                   // list of updates
           {
              "s":"BCHUSD.P",      // symbol
              "b":[                // bid updates
                 [
                    289.49,        // price with changed quantity
                    0              // new quantity, 0 means that this level was removed
                 ],
                 [  289.3,   47  ]
              ],
              "a":[                // ask updates
                 [  291.44,  0   ],
                 [  290.98,  49  ]
              ]
           },
           {
              "s":"BTCUSD.P",
              "b":[
                 [  9156.92,  0  ],
                 [  9182.12,  82 ],
                 [  9165.76,  0  ],
                 [  9167.44,  23 ],
                 [  9176,     0  ],
                 [  9169.49,  58 ]
              ],
              "a":[
                 [  9243.86,  0  ],
                 [  9240.94,  9  ]
              ]
           }
        ]
     }

Trades

Subscribe Trades Request

Request to subscribe recent trade data
     { 
        "operation":"SUBSCRIBE_TRADES",
        "data":[ // List of symbols
           "BTCUSD.P",
           "BCHUSD.P"
        ]
     }

Unsubscribe Trades Request

Request to unsubscribe trade data
     {
        "operation":"UNSUBSCRIBE_TRADES",
        "data":[                // List of symbols
           "BTCUSD.P",
           "BCHUSD.P"
        ]
     }

Trades Message

Sample messages for recent trades
     {
        "e":"trades",           // Event type
        "data":[
           {
              "I":3391860487,   // trade id
              "s":"BCHUSD.P",   // symbol
              "P":290.94,       // price
              "S":3,            // executed quantity
              "T":1573134339936 // trade time in ms
           },
           {
              "I":3391860491,
              "s":"BCHUSD.P",
              "P":291.06,
              "S":25,
              "T":1573134339936
           },
           {
              "I":3391860107,
              "s":"BTCUSD.P",
              "P":9217.84,
              "S":67,
              "T":1573134339812
           },
           {
              "I":3391859905,
              "s":"BTCUSD.P",
              "P":9211.75,
              "S":95,
              "T":1573134339750
           }
        ]
     }

Last Candles

Subscribe Candles Request

Request to subscribe to candle data (open/high/low/close)
     {
        "operation":"SUBSCRIBE_CANDLES",
        "data":[               // List of symbols with periods
           "BTCUSD.P#1m",      // format: symbol#period
           "BCHUSD.P#30m"      // allowed periods: 1m, 5m, 10m, 15m, 30m, 1h, 1d, 1w, 1M
        ]
     }

Unsubscribe Candles Request

Request to unsubscribe to candle data
     {
        "operation":"UNSUBSCRIBE_CANDLES",
        "data":[               // List of symbols with periods
           "BTCUSD.P#1m",      // format: symbol#period
           "BCHUSD.P#30m"      // allowed periods: 1m, 5m, 10m, 15m, 30m, 1h, 1d, 1w, 1M
        ]
     }

Candles Message

Sample candle messages
     {
        "e":"candles",          // event type
        "data":[
           {
              "I":3350002407,   // candle Id
              "s":"BTCUSD.P",   // symbol
              "o":9169.48,      // open price
              "h":9222.71,      // high price
              "l":9144.49,      // low price
              "c":9162.96,      // close price
              "v":22241,        // volume
              "p":"5m",         // candle period
              "T":1573135800000 // close candle time in ms
           },
           {
              "I":3350002329,
              "s":"BCHUSD.P",
              "o":289.58,
              "h":291.13,
              "l":288.08,
              "c":289.22,
              "v":60595,
              "p":"10m",
              "T":1573135800000
           }
        ]
     }