Files
test/backend/tests
Le cccef51eaf feat: ATR-based SL/TP in backtest, portfolio-aware Kelly sizing, weighted correlation dampening, adaptive volatile threshold, fix eviction race
- backtest_engine.py: positions now also exit on ATR/regime-adaptive
  STOP_LOSS/TAKE_PROFIT (mirroring signal_service.py's close_stale_trades),
  not just REVERSAL/TIME_LIMIT/END_OF_DATA -- backtest/WFO now exercises
  the same exit rule live trading actually enforces.
- trade_executor.py: Kelly sizing dampens by 1/sqrt(same_direction_open+1)
  to account for correlated risk across simultaneously open positions
  (crypto altcoins move together); opposite-direction positions don't
  dampen since they net against that risk.
- signal_scoring.py: correlation dampening between the 13 vote algorithms
  now uses per-pair weighted coefficients (StochRSI~RSI high, MFI~RSI
  moderate, etc.) instead of uniform 1/sqrt(count), so near-duplicate
  signals get dampened harder than genuinely complementary ones.
- indicator_service.py: "volatile" regime threshold is now the 90th
  percentile of a symbol's own recent ATR% history instead of one fixed
  5% cutoff shared by every symbol (BTC vs. a naturally-volatile altcoin).
- trade_executor.py: fixed a phantom-read race in the eviction path where
  two concurrent signals for the same user could both pass the
  MAX_OPEN_TRADES check before either committed -- now locks the user row
  first to serialize per-user trade-opening.

209 backend tests pass (+22).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-04 16:58:37 +07:00
..