Diff-Orders Channel
This article explains the subscription and server messages produced in the Diff-Orders channel.
Subscription Messages
Subscription messages have the following formats:
websocket.send (JSON.stringify(
{ action: 'subscribe',
book: 'btc_mxn',
type: 'diff-orders' }))
{
"action": "subscribe",
"response": "ok",
"time": 1455831538047,
"type": "diff-orders"
}
Server JSON Messages
The server's returned payload contains an array with one or more orders of the following form:
Field Name | Description | Type | Units |
---|---|---|---|
a | The amount | String | Major |
d | Unix timestamp | Number | Milliseconds |
o | Order ID | String | - |
r | The rate | String | Minor |
s | Order status Valid values: open, cancelled, and completed. The definitions of each state are below the table. | String | - |
t | Possible values: - 0 indicates buy - 1 indicates sell | Number | - |
v | The value | String | Minor |
z | Timestamp of the last update (excluding Open orders) | Number | Milliseconds |
An order can be in one of three possible states:
- OPEN: An order appears as open when the service adds it to the book, and remains in this state while it is partially matched.
- COMPLETED: An order appears as completed when the service has matched the order for its whole amount or value and removed it from the book.
- CANCELLED: The order was cancelled and removed from the book.
Example of Server Messages
Messages on the Diff-Orders channel for open and cancelled orders look like this:
{
"type": "diff-orders",
"book": "btc_mxn",
"sequence": 2734,
"payload": [
{
"o": "laasdqw1ywYgfYI2",
"d": 1675555546102,
"r": "22222",
"t": 0,
"a": "0.25",
"v": "5312.25",
"s": "open"
}
],
"sent": 1675555546102
}
{
"type": "diff-orders",
"book": "btc_mxn",
"sequence": 2222,
"payload": [
{
"o": "laasdqw1ywYgfYI2",
"d": 1677784699999,
"r": "444444",
"t": 1,
"s": "cancelled",
"z": 1912784699999
}
],
"sent": 1675555546102
}
Updated 4 months ago