Files
trading_bot_v4/run_comprehensive_diagnostics.sh
mindesbunister cc56b72df2 fix: Database-first cluster status detection + Stop button clarification
CRITICAL FIX (Nov 30, 2025):
- Dashboard showed 'idle' despite 22+ worker processes running
- Root cause: SSH-based worker detection timing out
- Solution: Check database for running chunks FIRST

Changes:
1. app/api/cluster/status/route.ts:
   - Query exploration database before SSH detection
   - If running chunks exist, mark workers 'active' even if SSH fails
   - Override worker status: 'offline' → 'active' when chunks running
   - Log: ' Cluster status: ACTIVE (database shows running chunks)'
   - Database is source of truth, SSH only for supplementary metrics

2. app/cluster/page.tsx:
   - Stop button ALREADY EXISTS (conditionally shown)
   - Shows Start when status='idle', Stop when status='active'
   - No code changes needed - fixed by status detection

Result:
- Dashboard now shows 'ACTIVE' with 2 workers (correct)
- Workers show 'active' status (was 'offline')
- Stop button automatically visible when cluster active
- System resilient to SSH timeouts/network issues

Verified:
- Container restarted: Nov 30 21:18 UTC
- API tested: Returns status='active', activeWorkers=2
- Logs confirm: Database-first logic working
- Workers confirmed running: 22+ processes on worker1, workers on worker2
2025-11-30 22:23:01 +01:00

91 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
# Comprehensive Diagnostic Test Suite for v9 Optimization
# Purpose: Identify root cause of parameter insensitivity and find real profitability improvements
set -e
echo "============================================================================"
echo "V9 COMPREHENSIVE DIAGNOSTIC SUITE"
echo "============================================================================"
echo ""
echo "This suite will run 3 diagnostic tests:"
echo " 1. Parameter Verification - Do parameters actually affect behavior?"
echo " 2. Trade Analysis - What patterns exist in winning/losing trades?"
echo " 3. Profitability Analysis - Where are the real optimization opportunities?"
echo ""
# Configuration
CSV_PATH="${1:-backtester/data/solusdt_5m.csv}"
SYMBOL="SOL-PERP"
if [ ! -f "$CSV_PATH" ]; then
echo "❌ ERROR: CSV file not found: $CSV_PATH"
echo "Usage: $0 [path/to/solusdt_5m.csv]"
exit 1
fi
echo "Data source: $CSV_PATH"
echo ""
# Ensure scripts are executable
chmod +x scripts/diagnostic_sweep.py
chmod +x scripts/trade_analysis.py
# Test 1: Parameter Verification
echo "============================================================================"
echo "TEST 1: PARAMETER VERIFICATION"
echo "============================================================================"
echo "Testing if parameters actually control behavior..."
echo ""
python3 scripts/diagnostic_sweep.py \
--csv "$CSV_PATH" \
--symbol "$SYMBOL" \
2>&1 | tee diagnostic_parameter_results.txt
echo ""
echo "✅ Results saved to: diagnostic_parameter_results.txt"
echo ""
read -p "Press Enter to continue to trade analysis..."
# Test 2: Trade-Level Analysis
echo ""
echo "============================================================================"
echo "TEST 2: TRADE-LEVEL ANALYSIS"
echo "============================================================================"
echo "Analyzing winning/losing trade patterns..."
echo ""
python3 scripts/trade_analysis.py \
--csv "$CSV_PATH" \
--symbol "$SYMBOL" \
2>&1 | tee diagnostic_trade_results.txt
echo ""
echo "✅ Results saved to: diagnostic_trade_results.txt"
echo ""
# Summary
echo "============================================================================"
echo "DIAGNOSTIC SUITE COMPLETE"
echo "============================================================================"
echo ""
echo "📊 Results Summary:"
echo " - Parameter verification: diagnostic_parameter_results.txt"
echo " - Trade analysis: diagnostic_trade_results.txt"
echo ""
echo "📋 Next Steps:"
echo " 1. Review parameter verification results"
echo " - If parameters have NO effect: Fix bug before optimizing"
echo " - If parameters work: Continue to optimization"
echo ""
echo " 2. Review trade analysis for patterns"
echo " - Check MAE/MFE analysis for exit improvements"
echo " - Check direction analysis for threshold adjustments"
echo " - Check exit strategy recommendations"
echo ""
echo " 3. Create focused optimization plan based on findings"
echo ""
echo "============================================================================"