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 - Private
  4. Order Channel

Order Closed

There are multiple scenarios in which an order is closed as described by the status field in the OrderClosed message. In summary orders can be closed by:-

  • CANCELED_BY_USER - the client themselves initiating this action or the liquidation engine on the clients behalf

  • CANCELED_BY_MAKER_ONLY - if a maker-only order is priced such that it would actually be an agressing taker trade, the order is automatically canceled to prevent this order from matching as a taker

  • CANCELED_BY_FOK - since fill-or-kill orders requires all of the order quantity to immediately take and match at the submitted limit price or better, if no such match is possible then the whole order quantity is canceled

  • CANCELED_ALL_BY_IOC - since immediate-or-cancel orders also requires an immediate match at the specified limit price or better, if no such match price is possible for any of the submitted order quantity then the whole order quantity is canceled

  • CANCELED_PARTIAL_BY_IOC - since immediate-or-cancel orders only requires some of the submitted order quantity to immediately take and match at the specified limit price or better, if a match is possible for only a partial quantity then only the remaining order quantity which didn't immediately match is canceled

  • CANCELED_BY_SELF_TRADE_PROTECTION - orders canceled by your selected selfTradePreventionMode settings

Curl

OrderClosed message format - LIMIT order

{
  "table": "order", 
  "data": [
      {
          "accountId": "<Your account ID>", 
          "clientOrderId": "1", 
          "orderId": "1000021764611", 
          "price": "20000.0", 
          "quantity": "0.001", 
          "amount": "0.0", 
          "side": "BUY", 
          "status": "CANCELED_BY_USER", 
          "marketCode": "BTC-USD-SWAP-LIN", 
          "timeInForce": "GTC", 
          "timestamp": "1680043402806", 
          "remainQuantity": "0.001", 
          "limitPrice": "20000.0", 
          "notice": "OrderClosed", 
          "orderType": "LIMIT", 
          "isTriggered": "false", 
          "displayQuantity": "0.001"
      }
  ]
}

OrderClosed message format - STOP LIMIT order

{
  "table": "order", 
  "data": [
      {
          "accountId": "<Your account ID>", 
          "clientOrderId": "1", 
          "orderId": "1000021852415", 
          "price": "21000.0", 
          "quantity": "0.001", 
          "amount": "0.0", 
          "side": "BUY", 
          "status": "CANCELED_BY_USER", 
          "marketCode": "BTC-USD-SWAP-LIN", 
          "timeInForce": "GTC", 
          "timestamp": "1680044038047", 
          "remainQuantity": "0.001", 
          "stopPrice": "20000.0", 
          "limitPrice": "21000.0", 
          "notice": "OrderClosed", 
          "orderType": "LIMIT", 
          "isTriggered": "true", 
          "triggerType": "MARK_PRICE", 
          "displayQuantity": "0.001"
      }
  ]
}

Channel Update Fields

Fields
Type
Description

table

STRING

order

data

LIST of dictionary

notice

STRING

OrderClosed

accountId

STRING

Account identifier

clientOrderId

STRING

Client assigned ID to help manage and identify orders with max value 9223372036854775807

orderId

STRING

Unique order ID from the exchange

price

STRING

Limit price of closed order (only applicable for LIMIT order types)

quantity

STRING

Original order quantity of closed order

amount

STRING

"0.0" if not provided in the request

side

STRING

BUY or SELL

status

STRING

  • CANCELED_BY_USER

  • CANCELED_BY_MAKER_ONLY

  • CANCELED_BY_FOK

  • CANCELED_ALL_BY_IOC

  • CANCELED_PARTIAL_BY_IOC

marketCode

STRING

Market code e.g. BTC-USD-SWAP-LIN

timeInForce

STRING

Time in force of closed order

timestamp

STRING

Current millisecond timestamp

remainQuantity

STRING

Historical remaining order quantity of closed order

stopPrice

STRING

Stop price of closed stop order (only applicable for STOP order types)

limitPrice

STRING

Limit price

ordertype

STRING

LIMIT or STOP_LIMIT

isTriggered

STRING

False or True

triggerType

STRING

Stops are triggered on MARK_PRICE

displayQuantity

STRING

Quantity displayed in the book, primarily used for iceberg orders, otherwise echos the quantity field

PreviousOrder OpenedNextOrder Closed Failure

Last updated 6 months ago

☁️