Files
trading_bot_v4/config/trading.ts
mindesbunister 58f812f0a7 critical: Fix Bug #2 - Direction-specific leverage thresholds not loaded
PROBLEM: Quality 90 LONGs getting 5x instead of expected 10x leverage
ROOT CAUSE: ENV vars QUALITY_LEVERAGE_THRESHOLD_LONG/SHORT existed but never loaded in code
IMPACT: 50% smaller position sizes on quality 90-94 signals

FIXES:
1. Added qualityLeverageThresholdLong and qualityLeverageThresholdShort to TradingConfig interface
2. Added ENV loading for both direction-specific thresholds
3. Updated getLeverageForQualityScore() to use direction-specific thresholds
4. Added proper fallback hierarchy: direction-specific → backward compat → hardcoded default
5. Added console logs showing which threshold and leverage tier is applied

RESULT: Quality 90 LONGs will now get 10x leverage (highQualityLeverage)
Position sizes will double from ~$89 to ~$178

User reported: 'last trades were very small positions. no way near a 10 or 15x leverage'
This fix addresses that complaint - user expectation was correct, code was wrong.

Files: config/trading.ts (interface lines 20-27, ENV loading lines 520-532, function lines 673-730)
2025-12-03 08:11:24 +01:00

30 KiB