Gemini Crypto Exchange Logo
Version 1

Change Event

Elements of type change have the following fields:

Fields

Field

Type

Description

price

decimal

The price of this order book entry.

side

string

Either bid or ask.

reason

string

Either place, trade, cancel, or initial, to indicate why the change has occurred. initial is for the initial response message, which will show the entire existing state of the order book.

remaining

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.

delta

decimal

The quantity changed. May be negative, if an order is filled or canceled. For initial messages, delta will equal remaining.

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

{
  "type": "update",
  "eventId": 5375504382,
  "timestamp": 1547759967,
  "timestampms": 1547759967559,
  "socket_sequence": 66,
  "events": [
    {
      "type": "change",
      "side": "bid",
      "price": "3626.73",
      "remaining": "1.6",
      "delta": "0.8",
      "reason": "place"
    }
  ]
}
json

When an order is canceled

{
  "type": "update",
  "eventId": 5375503736,
  "timestamp": 1547759964,
  "timestampms": 1547759964051,
  "socket_sequence": 2,
  "events": [
    {
      "type": "change",
      "side": "bid",
      "price": "3628.01",
      "remaining": "0",
      "delta": "-2",
      "reason": "cancel"
    }
  ]
}
json