Orderbook Incremental Updates
wss://ws.btse.com/ws/oss/spotTestnetwss://testws.btse.io/ws/oss/spotSubscribe to orderbook incremental updates through the update topic.
Topic format: update:<symbol>_<grouping> (e.g. update:BTC-USD_0)
The _grouping suffix represents the granularity of price-level aggregation.
Valid values are 0 to 8. If the suffix is omitted (e.g. update:BTC-USD),
_0 is used by default. Different grouping values produce independent topic
subscriptions and caches.
The first response received will be a snapshot of the current orderbook
(indicated by the type field) with up to 50 levels. Incremental updates
will be sent in subsequent packets with type delta.
Bids and asks will be sent in price and size tuples. The size sent will
be the new updated size for the price. If a value of "0" is sent, the price
should be removed from the local copy of the orderbook.
To ensure that the updates are received in sequence, seqNum indicates the
current sequence and prevSeqNum refers to the packet before. seqNum will
always be one after the prevSeqNum. If the sequence is out of order,
unsubscribe and re-subscribe to the topic again.
Also, if a crossed orderbook ever occurs (best bid is higher than or equal to best ask), unsubscribe and re-subscribe to the topic again.
Response Contentβ
| Name | Type | Required | Description |
|---|---|---|---|
| topic | String | Yes | WebSocket topic |
| data | Object | Yes | Data object |
Data Object:
| Name | Type | Required | Description |
|---|---|---|---|
| bids | String[][] | Yes | Bid quotes |
| asks | String[][] | Yes | Ask quotes |
| seqNum | Integer | Yes | Current sequence number |
| prevSeqNum | Integer | Yes | Previous sequence number |
| type | String | Yes | snapshot β Snapshot of the orderbook with a maximum of 50 levels; delta β Updates of the orderbook |
| timestamp | Long | Yes | Timestamp of the orderbook |
| symbol | String | Yes | Orderbook symbol |
Request
{
"op": "subscribe",
"args": [
"update:BTC-USD_0"
]
}
Request
{
"op": "unsubscribe",
"args": [
"update:BTC-USD_0"
]
}
Response
{
"topic": "update:BTC-USD_0",
"data": {
"bids": [
[
"59252.5",
"0.06865"
],
[
"59249.0",
"0.24000"
],
[
"59235.5",
"0.16073"
],
[
"59235.0",
"0.26626"
],
[
"59233.0",
"0.50000"
]
],
"asks": [
[
"59292.0",
"0.50000"
],
[
"59285.5",
"0.24000"
],
[
"59285.0",
"0.15598"
],
[
"59282.5",
"0.06829"
],
[
"59278.5",
"0.01472"
]
],
"seqNum": 628282,
"prevSeqNum": 628281,
"type": "snapshot",
"timestamp": 1565135165600,
"symbol": "BTC-USD"
}
}
Response
{
"topic": "update:BTC-USD_0",
"data": {
"bids": [],
"asks": [
[
"59367.5",
"2.15622"
],
[
"59325.5",
"0"
]
],
"seqNum": 628283,
"prevSeqNum": 628282,
"type": "delta",
"timestamp": 1565135165600,
"symbol": "BTC-USD"
}
}