☁️Websocket API

TEST site

  • wss://stgapi.ox.fun/v2/websocket

LIVE site

  • wss://api.ox.fun/v2/websocket

OX.FUN's application programming interface (API) provides our clients with programmatic access to control aspects of their accounts and to place orders on OX.FUN. The API is accessible via WebSocket connection to the URIs listed above. Commands, Replies, and Notifications all traverse the WebSocket in text frames with JSON-formatted payloads.

WebSocket commands can be sent in either of the following two formats:

For subscription-based requests

{"op": "<value>", "args": ["<value1>", "<value2>",.....]}

op: can either be:

  • subscribe

  • unsubscribe

args: the value(s) will be the instrument ID(s) or asset ID(s), for example:

  • order: BTC-USD-SWAP-LIN

  • depth: ETH-USDT-SWAP-LIN

  • position: all

All other commands

{"op": "<command>", "data": {"<key1>":"<value1>",.....}}

op: can be:

  • login

  • placeorder

  • cancelorder

  • modifyorder

data: JSON string of the request object containing the required parameters

Further information regarding the error codes and corresponding error messages from a failed subscription or order command request can be found in a later section of this documentation Error Codes.

Last updated