Events
Each subscription stream has a corresponding event that will be broadcasted over websocket.
Last updated
Each subscription stream has a corresponding event that will be broadcasted over websocket.
Last updated
Update speed: real-time
Let's assume your initial order amount is 100 units and each match occurs for an amount of 10 units.
Note: The following events only include amount
and reason
for simplicity.
Your limit order matches against existing orders in the book.
You will receive the following events over websocket, each with the same timestamp but in sequential order:
Event 1: (90, "filled")
โ 10 units of your order are filled.
Event 2: (80, "filled")
โ Another 10 units are filled.
Event 3: (80, "placed")
โ The remaining 80 units are placed on the book.
Your IOC order matches against existing orders but is not completely filled.
The events you will receive are as follows:
Event 1: (90, "filled")
โ 10 units are filled.
Event 2: (80, "filled")
โ Another 10 units are filled.
Event 3: (0, "cancelled")
โ The remaining order is cancelled. Note: If your IOC order is fully filled, the last event you will receive is (0, "filled")
.
Your existing, or "resting," limit order matches against an incoming order.
You will receive the following event: (90, "filled")
โ 10 units of your resting limit order are filled.
Your resting limit order could be cancelled for various reasons, such as manual cancellation, expiration, failing health checks, or self-trade prevention.
In any of these cases, you will receive: (0, "cancelled")
In any of these cases, you will receive: (0, "cancelled")
Update speed: real-time
Update speed: real-time
Update speed: real-time
Update speed: real-time
Note: that it is possible that back to back position_change
events have the same fields except for timestamp
. Additionally, position_change
events are not sent on interest and funding payments, and also are not sent on actions done through slow mode (except deposits). The full list of actions that will trigger a PositionChange
event are:
Minting or burning LP tokens
Liquidating a subaccount
Matching orders
Depositing or withdrawing spot
Settling PNL
Update speed: once every 50ms
Note: To keep an updated local orderbook, do the following:
Subscribe to the book_depth
stream and queue up events.
Apply events with max_timestamp
> snapshot timestamp
.
When you receive an event where its last_max_timestamp
is not equal to the last event you've received, it means some events were lost and you should repeat 1-3 again.
Get a market data snapshot by calling . The snapshot contains a timestamp
in the response.