Time SeventeenDocs

WebSocket

Time Seventeen WebSocket operations and pushes — public order books, trades and BBO, private account events, order entry and recovery after reconnects.

wss://api-testnet.timeseventeen.com/v2/ws

Text frames carry JSON operations and pushes. Binary frames carry signed orders.

Operations (client → server)

OperationMessageReply
Subscribe{"op":"subscribe","markets":[1,2],"channels":["trades","l2","bbo"],"resume":{"1":120}}{"type":"subscribed",…} then pushes
Unsubscribe{"op":"unsubscribe"}{"type":"unsubscribed"}
Book snapshot{"op":"book","market":1,"depth":20,"view":"l2"} ("mbo" for orders){"type":"book","book":{…,"md_seq"}}
Markets{"op":"markets"}{"type":"markets","markets":{…}}
Private pushes{"op":"auth","account":1001,"ts":<unix ms>,"sig":"<hex>"}{"type":"authenticated","account","snapshot"}
Ordersbinary: ref u64 LE ‖ one or more signed frames{"type":"results","ref":n,"results":[…]}
  • markets: null subscribes to every market. channels defaults to ["trades","l2"]; add "bbo" and "mbo" where needed.
  • resume maps market → last public seq you hold; retained events after it are replayed first.
  • The auth signature is the signed account read.

Public pushes

{"type": "md", "epoch": 1, "events": [
  {"type": "trade", "market": 1, "seq": 7746591, "price": 203239, "no_price": 796761, "qty": 309, "aggressor": "Bid", "maker_ref": 418647642210412},
  {"type": "level", "market": 1, "seq": 7746592, "side": "Ask", "price": 203239, "qty": 1144},
  {"type": "bbo", "market": 1, "seq": 7746593, "bid": 165913, "bid_qty": 5967, "ask": 203239, "ask_qty": 1144}
]}
EventFields
tradeYES price, no_price, qty, aggressor (Bid = buyer of YES lifted an ask), maker_ref
levelside, price, absolute qty at that price (0 = level removed)
bbobest bid, bid_qty, ask, ask_qty (sent when the top changes)
MBO eventsadd / modify / delete of anonymous order_refs in priority order

Every event has its market’s public seq: gap-free across all four channels, increasing within any subset.

Private pushes

After auth, every committed event of your account arrives as:

{"type": "private", "account": 1001, "epoch": 1, "first_seq": 28703100, "last_seq": 28703100,
 "events": [[28703100, {"Fill": {"maker": 4299262263297, "maker_account": 1001, "price": 250000, "no_price": 750000, "qty": 4, "maker_leaves": 6, "…": "…"}}]]}

This includes fills of your resting orders caused by other participants, Done when an order leaves the book, and withdrawal state changes.

Errors and recovery

MessageAction
{"type":"error","error":"LAGGED"}You fell behind the push buffer; the server closes the socket. Reconnect with resume.
{"type":"error","error":"GAP"}The gateway skipped upstream data. Reconnect and re-snapshot.
{"type":"RESNAPSHOT","markets":[…]}resume too old for these markets; request a book snapshot.
AUTH_FAILEDBad or stale signature; sign a fresh timestamp.
MBO_NOT_ON_THIS_EDGEThis gateway does not carry MBO.
INVALID_JSON, UNKNOWN_OP, INVALID_CHANNELS, MISSING_REFFix the request.

Reconnect with exponential backoff (0.5 s doubling to 15 s). On a new epoch, re-snapshot books.