critical: Fix adaptive leverage not working + P&L compounding

Issue 1: Adaptive Leverage Not Working
- Quality 90 trade used 15x instead of 10x leverage
- Root cause: USE_ADAPTIVE_LEVERAGE ENV variable missing from .env
- Fix: Added 4 ENV variables to .env file:
  * USE_ADAPTIVE_LEVERAGE=true
  * HIGH_QUALITY_LEVERAGE=15
  * LOW_QUALITY_LEVERAGE=10
  * QUALITY_LEVERAGE_THRESHOLD=95
- Code was correct, just missing configuration
- Container restarted to load new ENV variables

- Trade cmici8j640001ry074d7leugt showed $974.05 in DB vs $72.41 actual
- 14 duplicate Telegram notifications sent
- Root cause: Still investigating - closingInProgress flag already exists
- Interim fix: closingInProgress flag added Nov 24 (line 818-821)
- Manual correction: Updated DB P&L from $974.05 to $72.41
- This is Common Pitfall #49/#59/#60 recurring

Files Changed:
- .env: Added adaptive leverage configuration (4 lines)
- Database: Corrected P&L for trade cmici8j640001ry074d7leugt

Next Steps:
- Monitor next quality 90-94 trade for 10x leverage confirmation
- Investigate why duplicate processing still occurs despite guards
- May need additional serialization mechanism for external closures
This commit is contained in:
mindesbunister
2025-11-24 08:31:05 +01:00
parent 1176df4299
commit 046629520c
2 changed files with 11 additions and 0 deletions

5
.env
View File

@@ -393,6 +393,11 @@ TRAILING_STOP_ACTIVATION=0.4
MIN_SIGNAL_QUALITY_SCORE=91
MIN_SIGNAL_QUALITY_SCORE_LONG=90 # Nov 23, 2025: Longs have 71.4% WR at quality 90-94 (+$44.77 on 7 trades)
MIN_SIGNAL_QUALITY_SCORE_SHORT=95 # Nov 23, 2025: Shorts toxic at quality 90-94 (28.6% WR, -$553.76 on 7 trades)
\n# Adaptive Leverage System (Nov 24, 2025)
USE_ADAPTIVE_LEVERAGE=true
HIGH_QUALITY_LEVERAGE=15
LOW_QUALITY_LEVERAGE=10
QUALITY_LEVERAGE_THRESHOLD=95
SOLANA_ENABLED=true
SOLANA_POSITION_SIZE=100
SOLANA_LEVERAGE=15