Skip to main content
Stop Orders can be modified over WebSocket.
Only price and quantity may be changed.
  • You must specify the stop_order’s stop_order_id (UUID v4).
  • You must specify the symbol.
  • You must specify the side.
  • You must specify the order_type.
  • 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_stop_order",
  "params": {
    "stop_order_id": "510333ac-3f7b-4d88-934a-4396d48824cc",
    "symbol": "AAPL-USD",
    "side": "BUY",
    "order_type": "TAKE_PROFIT",
    "quantity": 2,
    "price": 200
  }
}

Parameters

FieldTypeRequiredDescription
stop_order_idstringUUID v4 of the order to modify.
symbolstringThe market symbol (e.g. AAPL-USD).
sideenumMust match the original stop order’s side. See OrderDirection.
order_typeenumMust match the original stop order’s type. See OrderType.
quantitynumberOptionalNew stop order quantity. Must respect symbol lot size, min, and max constraints.
pricenumberOptionalNew price for when the order is triggered. Must respect tick size but not price bands.
⚠️ Notes:
  • Only price and quantity may be modified.

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 stop order
    send(ws, {
        "type": "modify_stop_order",
        "params": {
            "stop_order_id": "510333ac-3f7b-4d88-934a-4396d48824cc",
            "symbol": "AAPL-USD",
            "side": "BUY",
            "order_type": "TAKE_PROFIT",
            "quantity": 2,
            "price": 200
        }
    })

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,
    "side": "BUY",
    "type": "TAKE_PROFIT",
    "time_in_force": "GTC",
    "user_id": "0020ce8e-eaee-480e-8d7f-b9241d756ee5",
    "client_order_id": "",
    "quantity_remaining": 2.0
  }
}