Set futures stop-loss / take-profit
set_futures_sl_tpSet or clear stop-loss and take-profit triggers on an open mock futures position to manage risk with automated exits.
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 funds (50,000 mUSD). Not financial advice.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| positionId | Yes | Open futures position id. | |
| stopLossPrice | No | Positive number sets; null clears; omit = unchanged. | |
| takeProfitPrice | No | Positive number sets; null clears; omit = unchanged. | |
| agentTrace | No | Optional private trace metadata stored in the caller's ledger. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| httpStatus | Yes | HTTP status returned by CoinRithm, or 0 for network errors. | |
| ok | Yes | True when CoinRithm returned a successful 2xx response. | |
| ledgerEventId | No | Private AgentActionEvent id returned by /api/agent/*, when present. | |
| ledgerStatus | No | Ledger write status header returned by CoinRithm, when present. | |
| body | No | Parsed CoinRithm response body, or raw text when the response is not JSON. |