Skip to main content

Cancel All Open Orders

Description

Cancel all active orders for a specific trading pair.

HTTP Request

DELETE /fapi/v1/allOpenOrders (HMAC SHA256)

Request Parameters

NameTypeRequiredDescription
symbolSTRINGYESTrading pair
timestampLONGYESTimestamp

Response Example

{
"code": 200,
"msg": "The operation of cancel all open order is done."
}

Notes

  • This operation cancels the caller's open orders on the orders table for the symbol: resting limit orders plus STOP* / TAKE_PROFIT* trigger orders that were placed via POST /fapi/v1/order.
  • Conditional orders created via POST /fapi/v1/algoOrder are not cancelled by this endpoint — use DELETE /fapi/v1/algoOpenOrders for those.
  • Cancellation is not a single transaction: engine removal, status updates, and the margin release happen as separate steps.
  • Frozen margin attributable to the cancelled orders' unfilled remainders is released back to the available balance.

Code Examples

cURL

API_KEY="your_api_key"
API_SECRET="your_api_secret"
TIMESTAMP=$(date +%s%3N)
QUERY_STRING="symbol=BTCUSDT&timestamp=${TIMESTAMP}"
SIGNATURE=$(echo -n "${QUERY_STRING}" | openssl dgst -sha256 -hmac "${API_SECRET}" | awk '{print $2}')

curl -s -X DELETE \
-H "X-MBX-APIKEY: ${API_KEY}" \
"https://api.prex.world/fapi/v1/allOpenOrders?${QUERY_STRING}&signature=${SIGNATURE}"

Python

import time, hmac, hashlib, requests

API_KEY = "your_api_key"
API_SECRET = "your_api_secret"
BASE_URL = "https://api.prex.world"

def sign(params: str) -> str:
return hmac.new(API_SECRET.encode(), params.encode(), hashlib.sha256).hexdigest()

def signed_delete(path, params={}):
params["timestamp"] = int(time.time() * 1000)
qs = "&".join(f"{k}={v}" for k, v in params.items())
params["signature"] = sign(qs)
return requests.delete(f"{BASE_URL}{path}", params=params, headers={"X-MBX-APIKEY": API_KEY})

# Cancel all open orders for BTCUSDT
resp = signed_delete("/fapi/v1/allOpenOrders", params={
"symbol": "BTCUSDT"
})
print(resp.json())