Updates of first 10 / 50 / 100 orders from orderbook. If one of order will be deleted - the push with existing order will be send to keep constant limit of orders on user's side.
{
"action": "subscribe-public",
"module": "trading",
"path": "orderbook-limited/{market_code}/{limit}"
}
{
"topic": "trading/orderbook-limited/game-pln/10",
"message": {
"changes": [
{
"marketCode": "GAME-PLN",
"entryType": "Buy",
"rate": "10",
"action": "update",
"state": {
"ra": "10",
"ca": "6",
"sa": "6",
"pa": "6",
"co": 2
}
}
],
"timestamp": "1563280204658"
},
"timestamp": "1563280204658",
"seqNo": 5
}
{
"requestId": "78539fe0-e9b0-4e4e-8c86-70b36aa93d4f",
"action": "proxy",
"module": "trading",
"path": "orderbook-limited/{market_code}/{limit}"
}
{
"requestId": "78539fe0-e9b0-4e4e-8c86-70b36aa93d4f",
"statusCode": 200,
"body": {
"status": "Ok",
"sell": [
{
"ra": "39500",
"ca": "0.55345108",
"sa": "0.55345108",
"pa": "0.55345108",
"co": 1
}
],
"buy": [
{
"ra": "39256.01",
"ca": "0.3468",
"sa": "0.3468",
"pa": "0.3468",
"co": 1
}
],
"timestamp": "1566468343707",
"seqNo": "1978936"
}
}
Implementation example
To keep the order of receiving pushes and data consistency should be implemented the following mechanism:
- Connect to the channel and save every push on temporary list.
- Get the current snapshot of previous connected channel and save whole response to the target structure.
- Update structure with temporary list, starting with 1 value greater of seqNo than downloaded snapshot.
- For each update - check if seqNo is 1 more greater than previous message and clear temporary list after each successful update on structure.
- If temporary list will not be clearing it will be the fault of lost push and need to repeat the whole process from the beginning.
Values of the seqNo are individual for each limits: 10 / 50 / 100 and are consistent for snapshot and websocket channel.
Response details
Key | Type | Description |
---|---|---|
changes | array | |
mmarketCode | string | Symbol of the market. |
entryType | string | Order type: buy / sell. |
rate | decimal | Price of the order. |
action | string | Type of change: remove / update. If update will occur you are going to get additional array of state. |
state | array | Optional array for active orders. |
* ra | decimal | Price of the order. |
* ca | decimal | Current amount of cryptocurrency in the order. |
* sa | decimal | Starting amount of cryptocurrency in the order. |
* pa | decimal | Amount of cryptocurrency before the last change. |
* co | decimal | Amount of orders in the order. |
timestamp | Unix Timestamp | Time of execute on server. For this time all above values are actual. |