Change Event
Elements of type change
have the following fields:
Fields
Field | Type | Description |
---|---|---|
| decimal | The price of this order book entry. |
| string | Either |
| string | Either |
| decimal | The quantity remaining at that price level after this change occurred. May be zero if all orders at this price level have been filled or canceled. |
| decimal | The quantity changed. May be negative, if an order is filled or canceled. For |
Note: every trade will trigger a message with entries of both types trade
and change
.
Keeping order book up-to-date
To keep an up-to-date order book, just watch for any events
with {"type": "change"}
, and update the price level at price
with the amount at remaining
. The initial response message will contain all the change
events necessary to populate your order book from scratch.
Examples
When an order is placed
Code
When an order is canceled
Code