Commit Graph

5 Commits

Author SHA1 Message Date
fanziqi
ae3ed78b10 Refactor V5 engine: split state/scoring and wire strategy factory 2026-03-13 16:00:18 +08:00
root
72ea0ffd0e fix: remove 0.7 ATR multiplier, store risk_distance in DB
- Removed 0.7*ATR multiplier from signal_engine and paper_monitor
- risk_distance now stored per-trade in paper_trades table
- paper_monitor/signal_engine read risk_distance from DB (no hardcoded values)
- V5.1 TP/SL: 2.0/1.5/3.0 -> 1.4/1.05/2.1 (same actual distance)
- V5.2 TP/SL: 3.0/2.0/4.5 -> 2.1/1.4/3.15 (same actual distance)
- Fixed V5.2 pnl_r: all historical values corrected by *2/3
- API unrealized_pnl_r also reads from DB risk_distance
2026-03-02 07:00:05 +00:00
root
2f9dce483c fix: simulate limit orders for TP/SL (match real trading)
- TP/SL now exit at order price (limit order), not market price
- SL exits at sl_price, TP1 at tp1_price, TP2 at tp2_price
- Only timeout and signal_flip use market price (current price)
- Updated fix_historical_pnl.py to also correct exit_price
- This eliminates fake slippage in paper trading stats
2026-03-01 09:40:00 +00:00
root
45bad25156 fix(P0): pnl_r calculation + cooldown bypass + partition month bug
P0-1: Reverse signal now bypasses cooldown - evaluate_signal always
      outputs direction, main loop checks direction+score>=60 for
      closing positions against trend (not blocked by COOLDOWN_MS)

P0-2: pnl_r unified to (exit-entry)/risk_distance across all exit
      scenarios (tp, sl, sl_be, timeout) in both paper_monitor.py
      and signal_engine.py. Old hardcoded values (1.5R/2.25R) were
      ~2x too high vs actual risk_distance basis.

P1-1: ensure_partitions month calculation fixed from timedelta(30d)
      to proper month arithmetic. Also fixed UTC timezone for
      partition boundaries.

docs: V52-TODO.md with full audit backlog for V5.2
2026-03-01 09:29:32 +00:00
root
7b901a2390 feat: paper_monitor.py - WebSocket realtime TP/SL + frontend WS price feed (1s update) 2026-02-28 11:55:40 +00:00