close_all_positions
Closes all open long and short positions by placing a closing order for each, optionally canceling open orders first. Use it to flatten a portfolio and review each result for errors.
Instructions
Closes all open long and short positions by placing a closing order for each. Returns one result per position: check every result's status, because a position that could not be closed is reported as an error even when the call as a whole succeeds. If the market is closed, the closing orders remain queued and execute at the next market open.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "close_all_positions"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cancel_orders | No | If true is specified, cancel all open orders before liquidating all positions. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||