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
  2. Websocket API
  3. Subscriptions - Public

Liquidation RFQ

Channel Update Frequency: real-time, whenever there is an upcoming liquidation.

The liquidation RFQ (request for quotes) channel publishes a message 500ms before a liquidation event is due to occur. A liquidation event can be classed as one of the following:-

  • liquidation of a clients perp position (in the perp books)

  • liquidation of a clients spot collateral (in the spot books)

The message will contain the market code and is designed to give liquidity providers and traders an opportunity to make a 2-way market for the upcoming liquidation event.

Curl

Request format

{
  "op": "subscribe", 
  "tag": 1,
  "args": ["liquidationRFQ"]
}

Success response format

{
  "event": "subscribe", 
  "channel": "liquidationRFQ", 
  "success": True, 
  "tag": "1", 
  "timestamp": "1613774604469"
}

Channel update format

{
  "table": "liquidationRFQ",
  "data": [ {
              "marketCode": "BTC-USD-SWAP-LIN"
              "timestamp": "1613774607889"
          } ]
}
Python

Request format

import websockets
import asyncio
import json

liquidation = \
{
  "op": "subscribe", 
  "tag": 1,
  "args": ["liquidationRFQ"]
}

url= 'wss://api.ox.fun/v2/websocket'
async def subscribe():
    async with websockets.connect(url) as ws:
        while True:
            if not ws.open:
                print("websocket disconnected")
                ws = await websockets.connect(url)
            response = await ws.recv()
            data = json.loads(response)
            print(data)
            if 'nonce' in data:
                await ws.send(json.dumps(liquidation))
            elif 'success' in data and data['success'] == 'True':
                continue
asyncio.get_event_loop().run_until_complete(subscribe())

Request Parameters

Parameters
Type
Required
Description

op

STRING

Yes

subscribe

tag

INTEGER or STRING

No

If given it will be echoed in the reply and the max size of tag is 32

args

Single element LIST

Yes

liquidationRFQ

Channel Update Fields

Fields
Type
Description

table

STRING

liquidationRFQ

data

LIST of dictionary

marketCode

STRING

Market code of liquidation

timestamp

STRING

Millisecond timestamp

Market

PreviousCandlesNextMarket

Last updated 3 months ago

☁️