Public order book
Subscribe
Request
{
"t": "ACETO/USD@depth@100ms",
"e": "tdx:subscribe"
}
Replies
Field | Description |
---|---|
u | Lower bound sequence. |
U | Upper bound sequence. |
b | Bids as an array of book entries. |
a | Asks as an array of book entries. |
bookEntry .0 | Price of the entry. |
bookEntry .1 | Quantity of the entry. |
Initialization
{
"t": "ACETO/USD@depth@100ms",
"e": "tdx:subscription_received"
}
{
"t": "ACETO/USD@depth@100ms",
"e": "orderbook",
"d": {
"u": 42,
"b": [["120", "2"], ["121", "1"]],
"a": [["125", "1"]]
}
}
The order book can be maintained locally by following the updates. For instance, the order book after the replies above is constituted of:
Bid quantity | Bid price | Ask price | Ask quantity |
---|---|---|---|
2 | 120 | 125 | 1 |
1 | 121 |
Updates
{
"t": "ACETO/USD@depth@100ms",
"e": "orderbook",
"d": {
"u": 43,
"U": 45,
"b": [["120", "0"], ["121", "3"]],
"a": []
}
}
An update can either change the quantity of the price when the quantity is positive, or it removes the price when the quantity is zero. After apply the update above, the order book is constituted of:
Bid quantity | Bid price | Ask price | Ask quantity |
---|---|---|---|
3 | 121 | 125 | 1 |
When an update with an upper bound sequence (U
) above the latest lower bound sequence (u
), it should be ignored.
Updated 16 days ago