Websocket Reference

The Order Status WebSocket allows you to receive real-time updates about your single/multi orders directly into your application or script. You can subscribe using your API access token and get instant notifications when an order event occurs.

wss://<server>/ws/orders/

Authentication

Pass your API token as a query parameter in the WebSocket URL. If authentication fails, the connection will be automatically closed.

wss://<server>/ws/orders/?token=<API_token>

Subscribing to Order Updates

After connecting, you must send a subscription message to start receiving updates.

Subscribe

{
  "command": "subscribe",
  "data_type": "user_orders"
}

Keep-Alive

To prevent disconnects (after 30s inactivity), send this message every 5–10 seconds:

{
  "command": "keep_alive"
}

Unsubscribe (optional)

Order Updates

After successfully subscribing, you will receive order_update messages with an update_type field for your orders. The possible values depend on whether the update is for a single order or a multi-order (parent/child).

Single Orders Update Types

  • order_created — The order was created.

  • order_activated — The order became active.

  • order_canceled — The order was canceled.

  • order_completed — The order was fully completed.

  • order_fill_received — The order received a fill (partial or full execution).

  • order_paused — The order was paused.

Multi-Orders Update Types

  • order_created — The parent order was created.

  • order_activated — The parent order became active.

  • order_canceled — The parent order was canceled.

  • order_completed — The parent order was completed (all child orders finished).

  • order_paused — The parent order was paused.

  • child_order_created — A child order was created.

  • child_order_activated — A child order became active.

  • child_order_canceled — A child order was canceled.

  • child_order_completed — A child order was completed.

  • child_order_fill_received — A child order received a fill.

Example Update

Single Orders

Multi-Orders

Troubleshooting

  • Connection closes immediately

    • Check your API token and WebSocket URL.

  • No updates received

    • Make sure you sent the subscription message after connecting.

  • Timeouts

    • Ensure you are sending keep-alive messages regularly.

Best Practices

  • Send keep-alive messages to avoid disconnects.

  • Subscribe after connecting; unsubscribe when done.

  • Handle disconnection properly in your client.

Last updated

Was this helpful?