tanX Docupaper
AboutTrade
  • ABOUT
    • 📒tanX Docupaper
  • TECH
    • 👩‍💻Tech Docupaper
      • 🏨High level architecture
      • 🤔Starkware logic
      • 🌊Transactional flow
        • Off-chain accounts
        • The deposit flow
        • The withdrawal flow
        • The trade flow
        • The transfer flow
        • Full withdrawal
    • 🔌API Documentation
      • 😋Getting started
        • Test connectivity
      • 📈Market
        • 24hr Tickers Price
        • K-line/Candlestick data
        • Orderbook
        • Recent trades
      • ↔️Trading
        • Create order
        • Get order
        • List orders
        • Cancel order
        • Bulk Cancel
        • List trades
      • 🔐Account
        • Generating L2 Key Pairs
        • Login
        • Deposit
        • Withdrawal
        • Profile Information
        • Balance details
        • Profit and loss details
      • 🌏Web-socket stream
        • 🗝️Private web-socket connection
        • 👥Public websocket connection
      • ✨Internal Transfer
        • Create Internal Transfer
        • Get Internal Transfer
        • Check User Existence
        • List Internal Transfers
      • 🧪SDK Reference
        • NodeJS SDK
        • Python SDK
  • LEGAL
    • ‼️tanX Disclaimer
Powered by GitBook
On this page
  • Endpoint
  • Request Headers
  • Request Body

Was this helpful?

  1. TECH
  2. API Documentation
  3. Trading

Cancel order

Cancel an order. (Private 🔒)

PreviousList ordersNextBulk Cancel

Last updated 11 months ago

Was this helpful?

This endpoint is used to cancel a limit order which hasn’t already been executed at a given time. Please note that this is a Private 🔒 route which means it needs to be authorised by the account initiating this request.

Note: You will need to include the JWT Auth token to request headers to access this endpoint. To get the JWT Auth Token, refer the section of the documentation.

Endpoint

POST /sapi/v1/orders/cancel/

Request Headers

{
  "Authorization": "JWT ***"
}

Request Body

Field
Type
Mandatory

order_id

INTEGER

YES

Example

{
  "order_id": 3
}

Response

{
    "status": "success",
    "message": "Order is successfully queued for cancellation",
    "payload": {
        "id": 25768879,
        "uuid": "17be02d1-34ef-49df-9b92-264705047d99",
        "side": "buy",
        "ord_type": "limit",
        "price": "68733.81",
        "stop_price": null,
        "avg_price": "68733.81",
        "state": "wait",
        "market": "btcusdc",
        "created_at": "2024-05-31T09:02:00+02:00",
        "updated_at": "2024-05-31T09:02:03+02:00",
        "origin_volume": "0.0425",
        "remaining_volume": "0.0335",
        "executed_volume": "0.009000000000000001",
        "maker_fee": "0.0004",
        "taker_fee": "0.0004",
        "trades_count": 2,
        "cancel_reason": null
    }
}

Possible Cancel Reasons:

You may receive the following cancel reasons in the response:

  • 'Order cancelled by user': The user requested to cancel the order directly, or through a bulk cancel request.

  • ‘Slippage greater than 30%. Order cancelled to prevent loss of funds’: The order was cancelled because its price changed by more than 30% from the time it was placed to the time it was matched.

  • ‘Order cancellation was initiated by system’: The order was cancelled for reasons such as order expiration, slippage exceeding a specified threshold, inconsistent order matching, or detection of suspicious activity. However, cancellations due to these reasons are infrequent.

  • ‘Something went wrong, order was cancelled to prevent loss of funds’: The order was cancelled because it didn't meet the matching criteria due to unexpected reasons.

🔌
↔️
login