Size a position by risk
size_positionTurns "risk 1% of equity, stop 2% below" into a size in the base coin, rounded down to the venue step and capped by every limit; reads equity, price and contract rules itself. Use before preview_order. Not an order: preview and execute after it. Give the stop once and the amount once (see the inputs). Example: {"symbol": "BTC", "side": "buy", "stop_distance_pct": 0.02, "risk_pct_of_equity": 0.01}. Next: preview_order with preview_args from the result.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| side | Yes | buy = long, sell = short | |
| venue | No | Venue: sandbox, hyperliquid, okx, bybit or binance. Omitted: the agent's only venue, else hyperliquid if connected, else your only connected exchange, else the sandbox | hyperliquid |
| symbol | Yes | Base coin, e.g. BTC | |
| stop_loss | No | The stop as a price, USD per coin: below entry for a long, above for a short. Or give stop_distance_pct | |
| entry_price | No | Planned entry, USD per coin (a limit or trigger price); omitted: the mark | |
| notional_usd | No | Or the position's value in USD ("buy $200 worth"), instead of risk_pct_of_equity; still capped by the risk limits | |
| stop_distance_pct | No | The stop as a distance from entry, a fraction of the price (0.02 = 2% away), instead of stop_loss | |
| risk_pct_of_equity | No | How much of equity to lose if the stop fills (0.01 = 1%). Omit it and notional_usd for the most your limits allow |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| side | Yes | buy (long) or sell (short) | |
| venue | Yes | Venue name | |
| symbol | Yes | Base coin | |
| risk_usd | Yes | Loss if the stop fills, USD | |
| capped_by | Yes | Which limit made the size smaller than asked, if any | |
| size_base | Yes | Suggested size, in the base coin (e.g. BTC), not USD, rounded down to the venue's size step; pass it to preview_order as size_base | |
| stop_loss | Yes | Stop-loss used, USD per coin | |
| equity_usd | Yes | Equity used for the calculation (the venue's book), USD | |
| deprecation | No | Present only while this tool is deprecated: replacement, removal_date, changelog | |
| entry_price | Yes | Entry used, USD per coin (the mark when not given) | |
| notional_usd | Yes | size_base x entry, USD | |
| preview_args | Yes | The arguments for preview_order with this size: symbol, side, size_base, stop_loss, venue and leverage (5, or less where a limit says so); add price and order_type for a limit order | |
| within_limits | Yes | False if even the capped size cannot pass (e.g. below the venue minimum) | |
| risk_pct_of_equity | Yes | risk_usd / equity, as a fraction |