Orders Channel

This article explains the subscription and server messages produced in the Orders channel.

Subscription Messages

Subscription messages have the following formats:

websocket.send (JSON.stringify(
  { action: 'subscribe', 
    book: 'btc_mxn', 
    type: 'orders' }))
{
   "action": "subscribe",
   "response": "ok",
   "time": 1455831538048,
   "type": "orders"
}

Server JSON Messages

The server's returned payload contains a JSON object with two keys, one for the bids and the other for the asks on the order book. Both bids and asks include an array of orders of the following form:

Field Name

Description

Type

Units

a

The amount

String

Major

d

Unix timestamp

Number

Milliseconds

o

Order ID

String

r

The rate

String

Minor

s

The status. Set to undefined by default.

String

t

Possible values:

  • 0 indicates buy
  • 1 indicates sell

Number

v

The value

String

Minor

Example of Server Messages

Messages on the Orders channel look like this:

{
  "type": "orders",
  "book": "btc_mxn",
  "payload": {
    "bids": [
      {
        "o": "laasdqw1ywYgfYI2",
        "r": "5555",
        "a": "0.001343",
        "v": "9.64",
        "t": 1,
        "d": 1454445394039,
        "s": "undefined"
      },
      {
        "o": "laasdqw1ywYgfYI2",
        "r": "7777",
        "a": "0.007715",
        "v": "55.41",
        "t": 1,
        "d": 1455319938419,
        "s": "undefined"
      },
      {
        "o": "laasdqw1ywYgfYI2",
        "r": "7777",
        "a": "1.59667303",
        "v": "11468.9",
        "t": 1,
        "d": 1455314800000,
        "s": "undefined"
      }
    ],
    "asks": [
      {
        "o": "laasdqw1ywYgfYI2",
        "r": "7777",
        "a": "0.29437179",
        "v": "2134.51",
        "t": 0,
        "d": 1455314800000,
        "s": "undefined"
      },
      {
        "o": "laasdqw1ywYgfYI2",
        "r": "7777",
        "a": "1.32057812",
        "v": "9576.46",
        "t": 0,
        "d": 1455314800000,
        "s": "undefined"
      }
    ]
  },
  "sent": 1675555546102
}