OX.FUN
TradeSupport
  • 🏠OX.FUN
  • OX.FUN DOCS
    • 📈Perps
    • 📊Strategies
    • 🐂OX Coin
    • 🍂Seasons
    • 📩Referral
  • Page
  • API
    • ⚙️OX FUN API
    • 🔑API Key Management
    • ☁️Websocket API
      • Authentication
      • Session Keep Alive
      • Order Commands
        • Place Limit Order
        • Place Market Order
        • Place Stop Limit Order
        • Place Stop Market Order
        • Place Batch Market Order
        • Cancel Order
        • Cancel Batch Order
        • Modify Order
        • Modify Batch Orders
      • Subscriptions - Private
        • Balance Channel
        • Position Channel
        • Order Channel
          • Order Opened
          • Order Closed
          • Order Closed Failure
          • Order Modified
          • Order Modified Failure
          • Order Matched
      • Subscriptions - Public
        • Fixed Size Order Book
        • Full Order Book
        • Incremental Order Book
        • Best Bid/Ask
        • Trade
        • Ticker
        • Candles
        • Liquidation RFQ
        • Market
      • Other Responses
      • Error Codes
        • Curl Error Codes
    • 🔌REST API V3
      • Account & Wallet - Private
      • Deposits & Withdrawals - Private
      • Market Data - Public
      • Orders - Private
      • Trades - Private
  • 🔗External
    • 💧Aerodrome Pool
    • 🔵Trade on Uniswap (Base)
    • Trade on Solana
    • 🦎CoinGecko
    • API Code Examples
  • 🔗SOCIALS
    • 🐂OX.FUN
    • Discord
    • Twitter
Powered by GitBook
On this page
  1. API

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

PreviousAPI Key ManagementNextAuthentication

Last updated 2 months ago

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