Skip to main content

Connection

Connect to the WebSocket endpoint:
wss://exchange.jamesxu.dev/ws
Once connected, the server begins sending heartbeat messages every 15 seconds. The connection supports one L3 market subscription at a time. Trading and user-event messages share the same socket once you authenticate.
You can subscribe to market data and trade on the same connection. Authenticate first, then subscribe to a market.

authenticate

Send your API key to identify yourself. On success the server replies with authenticated.
{"op":"authenticate","api_key":"YOUR_API_KEY"}
op
string
required
Must be "authenticate".
api_key
string
required
Your trader API key.

subscribe

Subscribe to the L3 order book for a market. The server replies immediately with a snapshot, then streams delta messages.
{"op":"subscribe","channel":"l3","market":"BTC-USD","last_sequence":null}
op
string
required
Must be "subscribe".
channel
string
required
Must be "l3". No other channels are currently supported.
market
string
required
Market identifier, e.g. "BTC-USD".
last_sequence
number
Supported by the protocol shape, but the current server flow always returns a full snapshot regardless of this value. Pass null or omit the field.

unsubscribe

Stop receiving updates for a market.
{"op":"unsubscribe","channel":"l3","market":"BTC-USD"}
op
string
required
Must be "unsubscribe".
channel
string
required
Must be "l3".
market
string
required
Market identifier to unsubscribe from.

submit_order

Place a limit order. Requires authentication. The server replies with ack on success or reject on failure.
{
  "op": "submit_order",
  "request_id": "req-1",
  "market": "BTC-USD",
  "side": "BUY",
  "price": 100,
  "quantity": 2
}
op
string
required
Must be "submit_order".
request_id
string
Client-assigned identifier echoed back in the ack or reject. Useful for correlating responses to requests.
market
string
required
Market identifier, e.g. "BTC-USD".
side
string
required
"BUY" or "SELL".
price
number
required
Limit price in integer units (subject to the market’s tick size).
quantity
number
required
Order quantity (subject to the market’s minimum order quantity).

cancel_order

Cancel an open order you own. Requires authentication.
{
  "op": "cancel_order",
  "request_id": "req-2",
  "order_id": "66377526-7b98-485a-8c40-7024e68fa3c5"
}
op
string
required
Must be "cancel_order".
request_id
string
Client-assigned correlation identifier.
order_id
string
required
UUID of the order to cancel.

amend_order

Reduce the remaining quantity of an open order you own. Requires authentication.
{
  "op": "amend_order",
  "request_id": "req-3",
  "order_id": "66377526-7b98-485a-8c40-7024e68fa3c5",
  "remaining": 1
}
op
string
required
Must be "amend_order".
request_id
string
Client-assigned correlation identifier.
order_id
string
required
UUID of the order to amend.
remaining
number
required
New remaining quantity. Must be less than the current remaining quantity.

Current limitations

  • One L3 market subscription per connection. To track multiple markets simultaneously, open one connection per market.
  • No replay endpoint. If you miss messages, you must resubscribe from a fresh snapshot.
  • No persisted user-event sequence numbers. User events do not carry a sequence number and cannot be replayed.
  • Only the l3 channel is supported. No trades-only or ticker channels are available.

Build docs developers (and LLMs) love