v2

OpenAPI 3.0.02026-07-311824171.4 MB
Trading
Matching Engine
Private

Places a reduce-only order to close an existing position. Reduce-only orders can only reduce or close a position; they cannot open a new position or increase an existing one.

You can specify whether to use a market or limit order. If using a limit order, provide the price. The order will automatically be set to reduce-only to ensure it only closes the position.

Scope: trade:read_write

Try in API console

get/private/close_position

Query parameters

instrument_namestring required

Unique instrument identifier

Example:BTC-PERPETUAL

Instrument name

type'limit' | 'market' required

The order type

pricenumber

Optional price for limit order.

Response

Success response

jsonrpc'2.0' required

The JSON-RPC version (2.0)

idinteger

The id that was sent in the request

Example response

{
  "result": {
    "order": {
      "order_id": "ETH-100234",
      "instrument_name": "BTC-PERPETUAL",
      "creation_timestamp": 1536569522277,
      "last_update_timestamp": 1536569522277,
      "starbase_last_update_timestamp": 1536569522277000000,
      "block_trade": true,
      "trigger_order_id": "SLIB-370",
      "combo_order_id": "103148386169",
      "starbase_order_id": 103148386170,
      "app_name": "Example Application",
      "mmp_cancelled": true,
      "oto_order_ids": [
        "ETH-100234"
      ],
      "primary_order_id": "ETH-100234"
    },
    "trades": [
      {
        "instrument_name": "BTC-PERPETUAL",
        "timestamp": 1517329113791,
        "starbase_timestamp": 1536569522277000000,
        "starbase_order_id": 103148386170,
        "block_trade_id": "154",
        "block_trade_leg_count": 3
      }
    ]
  }
}