TRADEHUBTESTNET

All tools

set_stop_loss_rule

Let a position's stop follow the price · idempotent · scopes: positions:close

Make a held position's stop-loss move by itself, only ever toward the price: trailing (it follows the best price at trail_pct behind it) or breakeven (it moves to the entry once the price reaches activate_at). TradeHub checks about every 5 seconds; each move follows tighten_stop_loss's rules and is audited. Use to lock in profit on a winning position. One rule per position: a new one replaces it, kind=none removes it, it ends when the position closes. Not for a one-off move (use tighten_stop_loss). Next: get_my_open_positions shows the rule.

Call it

MCP tools/call

{"name": "set_stop_loss_rule", "arguments": {"symbol": "BTC", "kind": "trailing"}}

REST

PUT /v1/positions/{symbol}/stop-rule
{"symbol": "BTC", "kind": "trailing"}

Inputs

NameMeaning (* required)
symbol *Base coin, e.g. BTC
kind *trailing: the stop follows the best price at trail_pct behind it; breakeven: the stop moves to the entry once the price reaches activate_at; none: remove the rule
trail_pcttrailing only: distance behind the best price as a fraction, 0.001-0.2 (0.02 = 2%)
activate_atPrice, USD per coin, from which the rule acts; required for breakeven (beyond the entry on the profit side), optional for trailing
venueVenue: sandbox, hyperliquid, okx, bybit or binance. Omitted: the agent's only venue, else hyperliquid, else your only connected venue, else sandbox

Returns

FieldMeaning and unit
okTrue when the rule is stored
venueVenue name
symbolBase coin
ruleThe rule now following the position; null after kind=none

Rejections: error codes, each with what to do.

TradeHub never asks for withdrawal permissions.