--- name: scalp-plan description: Compute position size, stop, take-profit, notional and margin for a scalp trade given equity, $-risk, entry, and stop/target percentages. Use whenever the user asks "how much size / size this trade / plan this scalp / what's my stop and target". Pure math, no network, no API keys. --- # scalp-plan Takes a planned entry, your dollar risk, and a stop/TP percentage and returns the exact qty, stop price, TP price, notional, and required margin. Rounds to tick / lot so numbers are actually placeable on Bybit. ## When to use - "Size this for $25 risk" - "What's my stop and target if I enter X at Y?" - "Plan a long on SOLUSDT at $148" ## How to run ``` python scalp-plan/plan.py \ --equity 500 --risk 25 \ --side long --entry 148.20 \ [--symbol SOLUSDT] \ [--stop-pct 1.5] [--tp-pct 2.0] \ [--tick 0.01] [--lot 0.001] \ [--leverage 10] [--json] ``` Defaults: stop 1.5%, TP 2.0%, leverage 10x, tick 0.01, lot 0.001. Override `--tick` and `--lot` per instrument (Bybit's `instruments-info` endpoint has the exact values). ## Output - `entry`, `stop`, `tp` (tick-rounded) - `qty` (lot-rounded, floored — never exceeds your $-risk) - `risk_actual` (may be slightly under `--risk` due to lot rounding) - `notional`, `margin_required` (at given leverage) - `r_r` (target / stop distance) - warnings if qty rounds to zero, or if margin exceeds equity ## Exit codes - 0 on success, 1 if warnings fired (qty zero, margin > equity, etc.) - script exits with a message if stop equals entry after rounding ## Notes - No network. Safe to run offline. - Does not place any orders. Pairs with `bybit-trade` for execution.