set_take_profit_levels
Set a position's take-profits · idempotent ·
scopes: positions:close
Replace a held position's take-profits: one level or several (e.g. 50% at 98000, the rest at 101000), each a reduce-only trigger on the exchange, so it can only shrink the position. Use after entry, or to move or remove them ([] removes all). Not for the stop-loss (use tighten_stop_loss) or for closing now (use close_perp_position_reduce_only). Inputs: symbol, levels [{price, close_pct}], venue. New orders are placed before the old ones go. Works while trading is halted. Next: get_my_open_orders.
Call it
MCP tools/call
{"name": "set_take_profit_levels", "arguments": {"symbol": "BTC", "levels": [{"price": 86000, "close_pct": 50}, {"price": 90000, "close_pct": 50}]}}
REST
PUT /v1/positions/{symbol}/take-profits
{"symbol": "BTC", "levels": [{"price": 86000, "close_pct": 50}, {"price": 90000, "close_pct": 50}]}
Inputs
| Name | Meaning (* required) |
|---|---|
symbol * | Base coin, e.g. BTC |
levels * | Up to 4 levels, percentages adding up to at most 100; [] removes every take-profit |
venue | Venue: sandbox, hyperliquid, okx, bybit or binance. Omitted: the agent's only venue, else hyperliquid, else your only connected venue, else sandbox |
Returns
| Field | Meaning and unit |
|---|---|
ok | False when rejected or failed |
request_id | Order request id; get_order_request_status(request_id) follows it |
status | pending_approval, armed (a trigger entry waiting for its price), executed, rejected, failed, expired, declined, cancelled, or executing (TradeHub has not confirmed the outcome yet: check get_order_request_status) |
venue | Venue name |
order_id | Venue order id of the fill |
sl_oid | Venue order id of the protective stop |
fill_price | Average fill, USD per coin |
filled_size | Filled size, in the base coin (e.g. BTC), not USD |
approval_expires_at | While pending: when the approval request lapses, ISO 8601 UTC |
error | Why it was rejected or failed |
checks | Checks run at execution |
receipt | Signed receipt (compact JWS, EdDSA) once executed: request, checks, preview price, fill, slippage, order ids, delegation. Verify with /.well-known/tradehub-receipts.jwks |
take_profits | set_take_profit_levels: the take-profits now on the exchange |
trigger_price | status armed: opens at market when the mark reaches this, USD per coin |
trigger_expires_at | status armed: when it lapses unless reached, ISO 8601 UTC |
fee | Once executed: the trading fee, estimated at once and replaced by the amount the exchange charged once its fill records show it |
Rejections: error codes, each with what to do.