Preview a perpetual futures order
preview_perp_orderCheck a perpetual futures order with its stop-loss (optional take-profit) against this agent's permissions, the person's limits and the price band, sending nothing. Use before every new position, also one that waits for a price (trigger_price) or is split over 2-5 limit prices (ladder_prices). Not for closing (use close_perp_position_reduce_only). size_base (base coin): from size_position_by_risk; stop: stop_loss (USD) or stop_pct. Returns preview_id (30 s), notional, risk, margin and every check; a rejection names the failing check. Next: execute_previewed_order(preview_id).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| side | Yes | buy = open or add to a long, sell = open or add to a short | |
| price | No | Limit price, USD per coin (limit orders only) | |
| venue | No | Venue: sandbox, hyperliquid, okx, bybit or binance. Omitted: the agent's only venue, else hyperliquid, else your only connected venue, else sandbox; or "best": the cheapest all-in venue (price plus fee) you may use and have the margin for | hyperliquid |
| reason | No | Optional: why, in your words (up to 500 characters). The person sees it on the approval card and in history; other agents never do | |
| symbol | Yes | Base coin, e.g. BTC | |
| leverage | No | Leverage, e.g. 5 | |
| stop_pct | No | Or the stop as a distance from the entry (trigger price, limit price or mark), 0.02 = 2% | |
| size_base | Yes | Size in the base coin (BTC, not USD); rounded down to the venue step. Get it from size_position_by_risk | |
| stop_loss | No | Required stop-loss, USD per coin: below entry for buys, above for sells. Or give stop_pct | |
| hold_hours | No | Optional: how long you expect to hold, in hours, to see funding and the round trip's cost (and, with venue "best", to choose by them) | |
| order_type | No | market | |
| take_profit | No | Optional take-profit, USD per coin | |
| ladder_prices | No | Optional ladder entry: 2-5 limit prices, size_base split evenly across them, one stop-loss beyond all of them (stop_pct counts from the farthest price); order_type limit, no price | |
| trigger_price | No | Optional: hold the order and open it at market only when the mark reaches this price (a breakout or a pullback), re-checked then; market orders only. Risk is computed from this price | |
| trigger_valid_hours | No | With trigger_price: hours it waits before lapsing, 1-168 (default 24) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | True: every check passed | |
| legs | No | A ladder entry: [{price, size_base}] per limit leg, USD per coin and in the base coin (e.g. BTC), not USD | |
| side | Yes | buy or sell | |
| size | Yes | Size after rounding down to the venue step, in the base coin (e.g. BTC), not USD | |
| venue | Yes | Venue name | |
| checks | Yes | Every check that ran, all pass | |
| symbol | Yes | Base coin | |
| risk_usd | Yes | Loss if the stop fills, USD | |
| expires_at | Yes | ISO 8601 UTC | |
| fee_source | No | account (your own rate), published (the base rate) or none (sandbox) | |
| margin_usd | Yes | Margin needed, USD | |
| mark_price | Yes | Mark at preview time, USD per coin | |
| preview_id | Yes | Pass to execute_previewed_order within 30 seconds | |
| deprecation | No | Present only while this tool is deprecated: replacement, removal_date, changelog | |
| est_fee_usd | No | Trading fee for this order, USD: taker rate for market orders, maker for limit; the exit pays a fee too | |
| fee_rate_bps | No | The rate used, basis points of notional | |
| notional_usd | Yes | size x entry, USD | |
| venue_choice | No | With venue "best": why this venue (all-in price and the alternatives) | |
| trigger_price | No | A trigger entry: opens at market only when the mark reaches this, USD per coin | |
| est_fill_price | No | Market orders: average fill if executed now against the book, USD per coin; null for limit orders or when the book is too thin to say | |
| est_funding_usd | No | With hold_hours: funding over that time at today's rate, USD; negative = received | |
| est_slippage_bps | No | est_fill_price against mark_price in basis points, positive = worse; a market order never fills beyond the price band | |
| requires_approval | Yes | True: execute_previewed_order will wait for a person's approval | |
| trigger_valid_hours | No | A trigger entry: hours it waits before lapsing | |
| est_round_trip_cost_usd | No | With hold_hours: entry fee, exit fee at the taker rate and that funding, USD |