PnL Planning
workflow.run_pnl_planningCalculate net PnL, ROE, fees and gross profit/loss for a futures trade. Use when user asks "what's my profit/loss on this trade?" Returns: grossPnl, fees, netPnl, netPnlUsdt, roe (%), maxLossBound (only non-null for an inverse/coin-margined short: the finite ceiling on net coin-denominated loss as price rises without limit, (size/entryPrice)×(1+feeOpenPct) - includes the opening fee, since it survives the exit-price-to-infinity limit while the closing fee vanishes - null for every other side/contractType combination, which either has no such bound or a trivial one).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| side | Yes | Trade direction | |
| size | Yes | Position size: base asset qty for linear, USD contracts for inverse | |
| exitPrice | Yes | Exit price (positive) | |
| entryPrice | Yes | Entry price (positive) | |
| feeOpenPct | No | Opening fee as fraction, e.g. 0.0002 = 0.02% | |
| feeClosePct | No | Closing fee as fraction | |
| contractType | No | linear = USDT-margined (default), inverse = coin-margined. For inverse, pnl/fees are returned in the base coin, not USDT. |