feat: Add direction-specific quality thresholds and dynamic collateral display

- Split QUALITY_LEVERAGE_THRESHOLD into separate LONG and SHORT variants
- Added /api/drift/account-health endpoint for real-time collateral data
- Updated settings UI to show separate controls for LONG/SHORT thresholds
- Position size calculations now use dynamic collateral from Drift account
- Updated .env and docker-compose.yml with new environment variables
- LONG threshold: 95, SHORT threshold: 90 (configurable independently)

Files changed:
- app/api/drift/account-health/route.ts (NEW) - Account health API endpoint
- app/settings/page.tsx - Added collateral state, separate threshold inputs
- app/api/settings/route.ts - GET/POST handlers for LONG/SHORT thresholds
- .env - Added QUALITY_LEVERAGE_THRESHOLD_LONG/SHORT variables
- docker-compose.yml - Added new env vars with fallback defaults

Impact:
- Users can now configure quality thresholds independently for LONG vs SHORT signals
- Position size display dynamically updates based on actual Drift account collateral
- More flexible risk management with direction-specific leverage tiers
This commit is contained in:
mindesbunister
2025-12-01 09:09:30 +01:00
parent a294f44a06
commit 67ef5b1ac6
7 changed files with 90 additions and 19 deletions

7
.env
View File

@@ -395,11 +395,14 @@ MIN_SIGNAL_QUALITY_SCORE=91
MIN_SIGNAL_QUALITY_SCORE_LONG=90
MIN_SIGNAL_QUALITY_SCORE_SHORT=80
# Adaptive Leverage System (Nov 24, 2025)
# ENABLED Dec 1, 2025: 10x for high-quality signals (Q≥95 LONGs, Q≥90 SHORTs), 5x for borderline
# ENABLED Dec 1, 2025: 10x for high-quality signals, 5x for borderline
# Direction-specific thresholds: LONG ≥95, SHORT ≥90
USE_ADAPTIVE_LEVERAGE=true
HIGH_QUALITY_LEVERAGE=10
LOW_QUALITY_LEVERAGE=5
QUALITY_LEVERAGE_THRESHOLD=95
QUALITY_LEVERAGE_THRESHOLD_LONG=95
QUALITY_LEVERAGE_THRESHOLD_SHORT=90
QUALITY_LEVERAGE_THRESHOLD=95 # Kept for backward compatibility
SOLANA_ENABLED=true
SOLANA_POSITION_SIZE=100
SOLANA_LEVERAGE=5