Response
Once your WebSocket session is established, you will receive:
- a subscription acknowledgement
- a list of your active orders, if you supply either
- no
eventTypeFilter
, or - an explicit
eventTypeFilter=initial
argument as part of one or moreeventTypeFilter
arguments in your WebSocket request
- no
- ongoing order events interspersed with heartbeats every five seconds
- A response is a JSON array containing one or more order event objects
- Order events will arrive in real time, in the sequence that they happened on the exchange
- Each order event pertains to a single order but a batch of order events may contain order events pertaining to multiple orders.
- Use the
order_id
field in the initial order to keep track of what's happening to each order - Heartbeats are never batched with other order events
The JSON format of the response objects maintains compatibility with the Order Status and Get Active Orders APIs.
Common Fields
These fields are common to all order events except subscription_ack
and heartbeat
.
Field | Type | Required? | Description |
---|---|---|---|
| string | Y | An order event type, e.g. |
| integer | Y | Zero-indexed monotonic increasing sequence number attached to each message sent. If there is a gap in this sequence, you have missed a message.
See Sequence Numbers for more information. |
| string | Y | The order ID that Gemini has assigned to this order, first provided in the |
| string | Y* | The event ID associated with this specific order event. |
| string | N | Returned when using a Master scoped API key. The name of the account within the subaccount group. Master API keys can get all account names using the Get Accounts endpoint. |
| string | Y* | The API session key associated with this order.
Note: orders placed by website users show |
| N | The optional client-specified order ID. | |
| string | Y | The symbol of the order. |
| string | Y | Either |
| string | N | When limit orders are placed with |
| string | Y | Description of the order. |
| string | Y | The timestamp the order was submitted. For compatibility reasons, this is returned as a string. It is recommended to use the |
| timestampms | Y | The timestamp the order was submitted in milliseconds. |
| boolean | Y |
|
| boolean | Y |
|
| boolean | Y |
|
| decimal | N | The average price at which this order has been executed so far. |
| decimal | N | The amount of the order that has been filled. |
| decimal | N | The amount of the order that has not been filled. Present for limit and market sell orders; absent for market buy orders. |
| decimal | N | For limit orders and market sells, the quantity the order was placed for. Not present for market buys. |
| decimal | N | For limit orders, the price the order was placed for. Not present for market buys and sells. |
| decimal | N | For market buys, the total spend (fee-inclusive notional value) the order was placed for. Not present for limit orders and market sells. |
Examples
Limit Order accepted
[ { "type": "accepted", "order_id": "109535951", "event_id": "109535952", "account_name": "primary", "api_session": "UI", "symbol": "btcusd", "side": "buy", "order_type": "exchange limit", "timestamp": "1547742904", "timestampms": 1547742904989, "is_live": true, "is_cancelled": false, "is_hidden": false, "original_amount": "1", "price": "3592.00", "socket_sequence": 13 } ]json
Market Buy accepted
[ { "type": "accepted", "order_id": "109964529", "event_id": "109964530", "account_name": "primary", "api_session": "UI", "symbol": "bchusd", "side": "buy", "order_type": "market buy", "timestamp": "1547756076", "timestampms": 1547756076644, "is_live": false, "is_cancelled": false, "is_hidden": false, "total_spend": "200.00", "socket_sequence": 29 } ]json
Market Sell accepted
[ { "type": "accepted", "order_id": "109964616", "event_id": "109964617", "account_name": "primary", "api_session": "UI", "symbol": "ethusd", "side": "sell", "order_type": "market sell", "timestamp": "1547756893", "timestampms": 1547756893937, "is_live": true, "is_cancelled": false, "is_hidden": false, "original_amount": "25", "socket_sequence": 26 } ]json
Maker-or-cancel limit order accepted
[ { "type": "accepted", "order_id": "109964647", "event_id": "109964648", "account_name": "primary", "api_session": "UI", "symbol": "ethusd", "side": "sell", "order_type": "exchange limit", "timestamp": "1547757139", "timestampms": 1547757139783, "is_live": true, "is_cancelled": false, "is_hidden": false, "original_amount": "5", "price": "122.30", "behavior": "maker-or-cancel", "socket_sequence": 16 } ]json
Immediate-or-cancel limit order accepted, then immediately filled and closed
[{ "type" : "accepted", "order_id" : "652164", "event_id" : "652165", "account_name": "primary", "api_session" : "UI", "symbol" : "btcusd", "side" : "buy", "order_type" : "exchange limit", "timestamp" : "1478790127", "timestampms" : 1478790127297, "is_live" : true, "is_cancelled" : false, "is_hidden" : false, "original_amount" : "2", "price" : "714.01", "behavior" : "immediate-or-cancel", "socket_sequence" : 131419 }] ... [{ "type" : "fill", "order_id" : "652164", "account_name": "primary", "api_session" : "UI", "symbol" : "btcusd", "side" : "buy", "order_type" : "exchange limit", "timestamp" : "1478790127", "timestampms" : 1478790127297, "is_live" : false, "is_cancelled" : false, "is_hidden" : false, "avg_execution_price" : "714.00", "executed_amount" : "2", "remaining_amount" : "0", "original_amount" : "2", "price" : "714.01", "fill" : { "trade_id" : "652166", "liquidity" : "Taker", "price" : "714.00", "amount" : "2", "fee" : "3.57", "fee_currency" : "USD" }, "socket_sequence" : 131420 }, { "type" : "closed", "order_id" : "652164", "event_id" : "652168", "account_name": "primary", "api_session" : "UI", "symbol" : "btcusd", "side" : "buy", "order_type" : "exchange limit", "timestamp" : "1478790127", "timestampms" : 1478790127297, "is_live" : false, "is_cancelled" : false, "is_hidden" : false, "avg_execution_price" : "714.00", "executed_amount" : "2", "remaining_amount" : "0", "original_amount" : "2", "price" : "714.01", "socket_sequence" : 131421 }]json