Hedge mode in your tournament system: advantages
· One min read
Code/architecture
- Independent positions per symbol: no shared state or cross-talk; each position flows through its own lifecycle and orders.
- Simpler orchestration: no aggregation/reconciliation logic for “net” symbol state; fewer edge-cases on partial closes.
- Clear routing via positionIdx: map LONG → 1, SHORT → 2 (one-way stays 0). Makes SL/TP updates and order sync unambiguous.
- Better testability: per-position invariants; easier to simulate concurrent strategies on same market.
- Adapter boundary stays the same: only the positionIdx mapping changes in one place (helper).
Trading/operations
- Parallel strategies per market: let opposing or orthogonal strategies run simultaneously without interference.
- Cleaner risk segmentation: track PnL, exposure, and trailing SL per position, not per symbol net.
- Laddering and scaling: open multiple staggered entries/TP ladders without clobbering existing orders.
- Reduced unintended netting: shorts won’t cancel longs (and vice‑versa); fewer surprises during volatility.
- Clear auditability: each tournament position has its own orders and lifecycle, simplifying post‑mortems.
If you want, I can:
- Add a small
resolvePositionIdx(position)helper (0 one-way; 1 long; 2 short) and switch SL/TP to use it. - Stabilize the flaky real e2e by adding retries/backoff or a guard on empty tickers before asserting.