Set futures stop-loss / take-profit
set_futures_sl_tpSet or clear stop-loss and take-profit triggers on an open mock futures position, with side-aware validation and automatic full-position close at mark when triggered.
Instructions
Set or clear resting stop-loss / take-profit triggers on an OPEN mock futures position. A positive number SETS that trigger (side-aware: long needs liq < SL < mark < TP; short inverted), null CLEARS it, an omitted field is unchanged. Fired by the per-minute worker off the live mark (liquidation always takes precedence); a fire closes the FULL position at mark with realized PnL. Discover fills between polls via my_trades with updatedSince. Requires the trade:futures scope. Paper trading only (virtual mUSD). Fills follow paper_execution_v1 with a disclosed execution cost; see executionModel in quote/trade results.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agentTrace | No | Optional private trace metadata stored in the caller's ledger. | |
| positionId | Yes | Open futures position id. | |
| stopLossPrice | No | Positive number sets; null clears; omit = unchanged. | |
| takeProfitPrice | No | Positive number sets; null clears; omit = unchanged. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| body | No | ||
| httpStatus | Yes | ||
| ledgerStatus | No | ||
| ledgerEventId | No |