Pre Trade Check
workflow.run_pre_trade_checkFull pre-trade decision card: orchestrates position sizing, breakeven, liquidation, and funding cost in one call. Use when user describes a full trade setup and asks "should I take this trade?" or "run the numbers on this setup". Provide exchange+symbol to fetch live funding rate automatically. For an R:R-graded verdict on an entry, stop and target, see workflow.run_risk_reward. Returns: positionSize, breakeven, liquidationPrice, fundingCost, overnightBreakevenShift, verdict.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mmr | No | Maintenance margin rate, default 0.005 | |
| side | Yes | Trade direction: "long" or "short" | |
| symbol | No | Perpetual symbol, e.g. "BTCUSDT". | |
| exchange | No | Exchange code, e.g. "binance" or "bybit". Used to fetch the live funding rate if funding_rate is omitted, and to set funding_interval_hours when that is omitted (1 for Hyperliquid, dYdX and Kraken, whose rates are per hour; pass funding_interval_hours: 8 if your rate is per 8 hours). | |
| leverage | Yes | Leverage multiplier | |
| risk_pct | Yes | Risk as % of balance, e.g. 1.0 = 1% | |
| stop_loss | Yes | Stop-loss price (positive) | |
| hold_hours | No | Expected hold time in hours for overnight shift calc. Default 8. | |
| entry_price | Yes | Entry price (positive) | |
| contractType | No | linear = USDT-margined (default), inverse = coin-margined (e.g. Bybit BTCUSD). All returned figures (notional, margin, risk_amount, funding_cost_*) stay USD-denominated either way; recommended_size is USD notional (contracts) for inverse. | |
| fee_open_pct | No | Opening fee fraction, default 0.0002 | |
| funding_rate | No | Funding rate per funding interval as decimal, e.g. 0.0001. If omitted, fetched live from exchange. | |
| fee_close_pct | No | Closing fee fraction, default 0.0005 | |
| account_balance | Yes | Total account balance in USDT | |
| funding_interval_hours | No | Hours per funding payment: 8 or 1 (Hyperliquid, dYdX and Kraken, whose rate is per hour). Omitted: taken from exchange when given, else 8. When funding_rate is also omitted and fetched live, the exchange interval is always used, since the fetched rate is quoted per it. |