Position size
size_positionCalculate a position size from entry, stop, and a max-loss budget or account risk percentage, with optional fees, gas, target R-multiple, and notional cap.
Instructions
Pure local math, no network: size a position from a max loss and a stop. quantity = risk budget / loss per unit at the stop (plus optional per-side costs and flat Ethereum gas per swap). Give risk_usd, or account_usd with risk_pct. Direction is inferred from the stop (stop below entry = buy). Optional target returns the R multiple and reward; optional max_notional_usd caps the size.
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": {
"entry": "<entry>",
"stop": "<stop>"
},
"name": "size_position"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| side | No | Optional check: must agree with the stop (buy = stop below entry). | |
| stop | Yes | Stop price; the trade is closed here. | |
| entry | Yes | Entry price. | |
| target | No | Take-profit price, for the R multiple. | |
| gas_usd | No | Ethereum gas per swap in USD, paid on entry and exit (default 0 = not included). | |
| cost_bps | No | Fees + slippage per side in bps (default 0). | |
| risk_pct | No | Percent of account_usd to risk, e.g. 1 for 1%. | |
| risk_usd | No | Max loss in USD if the stop is hit. | |
| account_usd | No | Account size in USD (with risk_pct). | |
| max_notional_usd | No | Cap on position value in USD, e.g. your balance. |