close_position
Close a coin's open perpetual position immediately with a reduce-only market order, either fully or by a specified fraction. Full closes cancel the attached stop and target; partial closes keep them.
Instructions
LIVE MONEY: acts on the real account. Close a coin's open position now with one reduce-only market order. Omit fraction (or pass 1) to close it all: the stop and target are then cancelled. fraction between 0 and 1 closes that share (0.5 = half) and keeps the stop and target, which still cover what is left; a share worth under the venue's $10 minimum closes $10 worth. Like any market order it pays the spread and slippage of the book. A flat coin returns ok=true with noop already_flat and sends nothing; closes are never refused for a delisted coin. Afterwards run sweep_brackets on the coin. Use when the user asks to exit now, fully or in part; to exit at a price instead, move the level with set_stop or set_target. Needs a trading key. Returns {closed, result: {total_sz, avg_px, partial, fraction}} or {error} with isError true; a fraction outside (0, 1] is refused with nothing sent.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"coin": "<coin>"
},
"name": "close_position"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coin | Yes | Coin: a main-dex perp by name (BTC, ETH) or a HIP-3 perp as dex:SYMBOL (xyz:GOLD, xyz:BRENTOIL). | |
| fraction | No | Share of the position to close, e.g. 0.5 for half. Omit to close it all. |