Orders can be modified over WebSocket.
Only price, quantity, take_profit, and stop_loss may be changed.
  • You must specify the order’s order_id (UUID v4).
  • You must specify the symbol.
  • You must specify the side.
  • client_order_id cannot be used for modifies.

1) Authenticate

Send this immediately after you connect:
{ "type": "auth", "params": { "api_key": "YOUR_API_KEY" } }

2) Modify Order

{
  "type": "modify_order",
  "params": {
    "order_id": "510333ac-3f7b-4d88-934a-4396d48824cc",
    "symbol": "AAPL-USD",
    "side": "BUY",
    "quantity": 2,
    "price": 200,
    "take_profit": 200,
    "stop_loss": 150
  }
}

Parameters

FieldTypeRequiredDescription
order_idstringUUID v4 of the order to modify.
symbolstringThe market symbol (e.g. AAPL-USD).
sideenumMust match the original order’s side. See OrderDirection.
quantitynumberOptionalNew order quantity. Must respect symbol lot size, min, and max constraints.
pricenumberOptionalNew price for limit/ALO orders. Ignored for market orders. Must respect tick size and price bands.
take_profitnumberOptionalUpdated take-profit price. Set 0 if unused.
stop_lossnumberOptionalUpdated stop-loss price. Set 0 if unused.
⚠️ Notes:
  • Only price, quantity, take_profit, and stop_loss may be modified.
  • client_order_id cannot be used for modifies.
  • Modifications that would cause an invalid state (e.g. reducing below partially filled quantity) will be rejected with OrderStatus codes such as CANNOT_MODIFY_PARTIAL_FILL or CANNOT_MODIFY_NO_SUCH_ORDER.

Sample Code

# Python (websocket-client)
import json, websocket

API_KEY = "YOUR_API_KEY"

def send(ws, obj): ws.send(json.dumps(obj))

def on_open(ws):
    # Authenticate
    send(ws, {"type": "auth", "params": {"api_key": API_KEY}})
    # Modify order
    send(ws, {
        "type": "modify_order",
        "params": {
            "order_id": "510333ac-3f7b-4d88-934a-4396d48824cc",
            "symbol": "AAPL-USD",
            "side": "BUY",
            "quantity": 2,
            "price": 200,
            "take_profit": 200,
            "stop_loss": 150
        }
    })

ws = websocket.WebSocketApp(
    "wss://trade.qfex.com?api_key=YOUR_API_KEY",
    on_open=on_open,
    on_message=lambda _, m: print("Message:", m)
)
ws.run_forever()

Example Response

When an order is successfully modified, you receive the same order_response object as with add, but with status MODIFIED:
{
  "order_response": {
    "order_id": "510333ac-3f7b-4d88-934a-4396d48824cc",
    "symbol": "AAPL-USD",
    "status": "MODIFIED",
    "quantity": 2.0,
    "price": 200.0,
    "take_profit": 200.0,
    "stop_loss": 150.0,
    "side": "BUY",
    "type": "LIMIT",
    "time_in_force": "GFD",
    "user_id": "0020ce8e-eaee-480e-8d7f-b9241d756ee5",
    "client_order_id": "",
    "quantity_remaining": 2.0
  }
}