Position Sizing
workflow.run_position_sizingCalculate the correct position size given a maximum risk in USDT and a stop-loss price. Edge cases: entryPrice, stopLoss and riskUsdt above zero; leverage above zero (default 1); fees 0 to 0.05; a fee and price combination that makes the risk denominator zero or negative is an error. Not covered: slippage past the stop, funding, exchange lot size and step rounding, and whether the margin is available. Use when user asks "how many coins should I buy?" or "size my position so I risk exactly $X". Returns: positionSize (base), positionUsdt, marginRequired.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"side": "<side>",
"entryPrice": "<entryPrice>",
"stopLoss": "<stopLoss>",
"riskUsdt": "<riskUsdt>"
},
"name": "workflow.run_position_sizing"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| side | Yes | Trade direction: "long" or "short" | |
| leverage | No | Leverage, default 1 | |
| riskUsdt | Yes | Maximum acceptable loss in USDT | |
| stopLoss | Yes | Stop-loss price | |
| entryPrice | Yes | Entry price | |
| feeOpenPct | No | Opening fee fraction, default 0.0002 | |
| feeClosePct | No | Closing fee fraction, default 0.0005 | |
| contractType | No | linear = USDT-margined (default), inverse = coin-margined. For inverse, sizeQuote is USD contracts and margin is returned in the base coin. |