close_position
Closes a coin's entire open position immediately with one full-size market order; partial closes are unsupported. Use when the user asks to exit now, then cancel stale stop and target orders.
Instructions
LIVE MONEY: acts on the real account. Close a coin's entire open position now with one market order for the full size; partial closes are not supported, and 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 to cancel the stop and target that no longer protect anything. Use when the user asks to exit now; to exit at a price instead, move the level with set_stop or set_target. Needs a trading key. Returns {ok, result: {total_sz, avg_px}} or {error} with isError true.
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). |