View Live Order and Market Data Updates

Overview

You can use the Trade WebSocket API to get to 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

Steps

1. Subscribe to Order Books

  • API
1 2 3 4 5 6 7 8 GET /api/prime/trading/v1/ws { "type": "subscribe", "accountId": "f230fdebfa084ffebc7e00515f54603f", "channel": "level2", "productId": "TBTC-TUSD*" }

Step Result

1 2 3 4 5 6 7 8 { "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

  • API
1 2 3 4 5 6 7 GET /api/prime/trading/v1/ws { "type": "subscribe", "channel": "orders", "accountId": "f230fdebfa084ffebc7e00515f54603f", }

Step Result

  • Created
  • Fill Updated
  • Order Completed
  • Order Canceled
  • Order Error
1 2 3 4 5 6 7 8 9 10 11 12 { "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", }