Skip to main content

private/close-position

REQUEST 

wss://stream.crypto.com/exchange/v1/user

private/close-positionPrivate
Cancels position for a particular instrument/pair (asynchronous).

This call is asynchronous, so the response is simply a confirmation of the request.

The user.order subscription can be used to check when the order is successfully canceled.

Request

Body

required
    id int64required

    Request id (echoed in response)

    method stringrequired

    Must be "private/close-position"

    nonce int64required

    Current timestamp in milliseconds, e.g. "1771761038000".

    params objectrequired
    instrument_name stringrequired

    e.g. BTCUSD-PERP.

    type WsClosePositionType (string)required

    Possible values: [LIMIT, MARKET]

    LIMIT or MARKET

    price decimal

    For LIMIT orders only. Must use decimal precision matching the instrument's price_tick_size.

    quantity decimal

    Positive number only. Only provide if intending to do partial closing.

    isolation_id string

    Needed when closing an existing isolated position. If omitted, the non-isolated position will be closed.

WebSocket response
Schema
    id int64

    Echoed request id

    method string

    Method invoked

    code int32

    0 = success; non-zero indicates error (reason code).

    result object
    Present when code === 0. order_id, client_oid.
    order_id int64

    Order ID

    client_oid string

    Client Order ID

    message string

    Present when code !== 0.

    original string

    Present when code !== 0.