Fee-aware position size
calculate_position_sizeRead-onlyIdempotent
Calculate position quantity and notional for a linear crypto futures trade from user-specified account balance, risk percentage, entry and stop. Includes separate entry/stop fees and optional target profit and net R. Direction is derived. Use when asked how much to buy or sell for a specified risk budget. Ask for missing prices or risk preference; do not invent them. Does not calculate liquidation, leverage, inverse contracts, exchange lot rounding, signals, or execute orders.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fees | No | User-supplied rates. Omission explicitly assumes zero fees; no exchange rate lookup is performed. | |
| stopPrice | Yes | Planned stop price. Direction is derived from entry and stop. | |
| entryPrice | Yes | Planned entry price in quote currency per base unit. | |
| riskPercent | Yes | User-chosen account risk percentage, e.g. 1 means 1%. Never infer a risk preference. | |
| targetPrice | No | Optional profit target, opposite the stop relative to entry. | |
| quoteCurrency | No | Currency shared by all monetary inputs. Defaults to USD; no currency conversion is performed. | |
| accountBalance | Yes | Account balance in the same quote currency as prices. | |
| instrumentType | No | Linear quote-margined instruments only. Inverse contracts and liquidation are unsupported. |
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tool | Yes | ||
| inputs | Yes | ||
| metrics | Yes | ||
| formulas | Yes | ||
| warnings | Yes | ||
| assumptions | Yes | ||
| reproduceUrl | Yes | ||
| documentationUrl | Yes | ||
| calculationVersion | Yes |