Funded

Overview

You can use the Trade WebSocket API to get real-time status updates for market data and trigger messages for:

  • Order books - Subscribe to a live feed of all outstanding buy and sell orders on the market for specific coins and tokens. Send messages when specific market conditions occur.
  • Trade orders - Subscribe to live status updates for your trade orders, including individual fills for an order. Send messages when statuses update.

Prerequisites

Cookbook

Need just the steps? Expand the cookbook below to get started:

View Live Order and Market Data UpdatesOpen Cookbook

Steps

1. Subscribe to Order Books

Endpoint: Get WebSocket Connection

GET /api/prime/trading/v1/ws

{
  "type": "subscribe",
  "accountId": "f230fdebfa084ffebc7e00515f54603f",
  "channel": "level2",
  "productId": "TBTC-TUSD*"
}

Step Result

{
  "channel": "level2",
  "type": "snapshot",
  "product": "TBTC-TUSD*",
  "time": "2020-01-01T09:35:26.465Z",
  "bids": [["7001.10", "1.5084"]],
  "asks": [["7002.55", "2.7524"]],
}

2. Subscribe to Trade Orders

Endpoint: Get WebSocket Connection

GET /api/prime/trading/v1/ws

{
  "type": "subscribe",
  "channel": "orders",
  "accountId": "f230fdebfa084ffebc7e00515f54603f",
}

Step Result

{
  "channel": "order",
  "time": "2019-04-25T01:02:03.045678Z",
  "accountId": "f230fdebfa084ffebc7e00515f54603f",
  "orderId": "14db12f5-4d3d-4fd8-8ced-062aa81bb4bc",
  "clientOrderId": "my-order-1",
  "product": "TBTC-TUSD*",
  "status": "opened",
  "type": "market",
  "side": "buy",
  "quantity": "1.01",
}

See Also

API Reference: Get WebSocket Connection