flatten_and_go_short
Sell any existing long position in a symbol, then place a short-sale order; skip the flatten step if no long position exists, noting the two orders are not atomic.
Instructions
Sell any existing long position in a symbol, then place a short-sale order.
⚠️ Experimental — this is a two-order workflow, not atomic. Market conditions may change between the flatten fill and the short entry. Both orders execute as real trades.
If no long position exists the flatten step is skipped and only the short order is placed.
Args: symbol: Ticker symbol (e.g. "AAPL"). short_quantity: Number of shares to short after flattening. order_type: MARKET, LIMIT, STOP, STOP_LIMIT, MARKET_ON_CLOSE or LIMIT_ON_CLOSE. Default is MARKET. The on-close types execute at the closing auction. time_in_force: DAY or GTD. Default is DAY. limit_price: Required for LIMIT, STOP_LIMIT and LIMIT_ON_CLOSE orders. stop_price: Required for STOP and STOP_LIMIT orders. expiration_time: Required when time_in_force is GTD. ISO 8601 format. equity_market_session: CORE or EXTENDED. flatten_timeout: Seconds to wait for the flatten order to fill (default 60). account_id: Account ID. Optional if PUBLIC_COM_ACCOUNT_ID is set.
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": {
"symbol": "<symbol>",
"short_quantity": "<short_quantity>"
},
"name": "flatten_and_go_short"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | ||
| account_id | No | ||
| order_type | No | MARKET | |
| stop_price | No | ||
| limit_price | No | ||
| time_in_force | No | DAY | |
| short_quantity | Yes | ||
| expiration_time | No | ||
| flatten_timeout | No | ||
| equity_market_session | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |