sweep_brackets
Tidies live protective orders for one coin after fills or closes: cancels stranded stops/targets when flat and merges duplicate stops or targets into a single pair when a position is open.
Instructions
LIVE MONEY: acts on the real account. Tidy one coin's protective orders (one coin per call). On a flat coin it cancels stops and targets left behind after a stop or target fired (a resting entry's own attached stop and target are kept) and lists resting entries. With an open position it checks the stop covers the full size and folds several stops or targets at one price (one per fill) into a single pair, placing the new order before cancelling the old ones. Never opens, closes or moves a level. Run it after every close or fill; to move a level use set_stop or set_target. Needs a trading key. Returns {ok, position, stop_px[], tp_px[], stop_covers} with an open position, or {ok, position: 0, cancelled_stranded, resting_entries[]: {oid, px, sz}} when flat; ok=false with reason "POSITION NOT FULLY COVERED BY A STOP" means place one now with set_stop.
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": "sweep_brackets"
}
}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). One coin per call. |