ib-trailing-stop
IB Trailing Stop Manager
Places IB native TRAIL orders against stocks and naked LEAPS in the portfolio. IB auto-adjusts the stop trigger as the price climbs and locks it as price falls.
PMCC positions are intentionally excluded — use ib-stop-loss for those (a standalone
trailing stop on the PMCC long leg would break the hedge at trigger).
Default mode is dry-run — no orders are placed unless --execute is in the request.
IB Connection
TWS or IB Gateway must be running locally with API enabled:
- Paper trading — port 7497
- Live trading — port 7496
Port fallback: If the configured port fails, automatically retry on the other port. If the retry succeeds, save to memory which account type worked (live/paper) and reuse it for all IB skill calls in this and future sessions — until the user explicitly asks for the other account. If both ports fail, ask the user to verify that TWS or IB Gateway is running with API access enabled.