Files
trading_bot_v4/cluster/status.py
mindesbunister 2a8e04fe57 feat: Continuous optimization cluster for 2 EPYC servers
- Master controller with job queue and result aggregation
- Worker scripts for parallel backtesting (22 workers per server)
- SQLite database for strategy ranking and performance tracking
- File-based job queue (simple, robust, survives crashes)
- Auto-setup script for both EPYC servers
- Status dashboard for monitoring progress
- Comprehensive deployment guide

Architecture:
- Master: Job generation, worker coordination, result collection
- Worker 1 (pve-nu-monitor01): AMD EPYC 7282, 22 parallel jobs
- Worker 2 (srv-bd-host01): AMD EPYC 7302, 22 parallel jobs
- Total capacity: ~49,000 backtests/day (44 cores @ 70%)

Initial focus: v9 parameter refinement (27 configurations)
Target: Find strategies >00/1k P&L (current baseline 92/1k)

Files:
- cluster/master.py: Main controller (570 lines)
- cluster/worker.py: Worker execution script (220 lines)
- cluster/setup_cluster.sh: Automated deployment
- cluster/status.py: Real-time status dashboard
- cluster/README.md: Operational documentation
- cluster/DEPLOYMENT.md: Step-by-step deployment guide
2025-11-29 22:34:52 +01:00

84 lines
2.6 KiB
Python

#!/usr/bin/env python3
"""
Quick cluster status dashboard
"""
import sqlite3
from pathlib import Path
from datetime import datetime
CLUSTER_DIR = Path(__file__).parent
DB_PATH = CLUSTER_DIR / 'strategies.db'
QUEUE_DIR = CLUSTER_DIR / 'queue'
def show_status():
"""Display cluster status"""
print("="*70)
print("🎯 OPTIMIZATION CLUSTER STATUS")
print("="*70)
print(f"📅 {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
# Job queue status
queued_jobs = list(QUEUE_DIR.glob("*.json")) if QUEUE_DIR.exists() else []
print(f"📋 Queue: {len(queued_jobs)} jobs waiting")
# Database status (if exists)
if DB_PATH.exists():
conn = sqlite3.connect(DB_PATH)
c = conn.cursor()
# Job stats
c.execute("SELECT status, COUNT(*) FROM jobs GROUP BY status")
job_stats = dict(c.fetchall())
print(f" Running: {job_stats.get('running', 0)}")
print(f" Completed: {job_stats.get('completed', 0)}")
# Top strategies
c.execute("""
SELECT name, pnl_per_1k, trade_count, win_rate, profit_factor
FROM strategies
WHERE status = 'completed' AND pnl_per_1k IS NOT NULL
ORDER BY pnl_per_1k DESC
LIMIT 5
""")
top_strats = c.fetchall()
if top_strats:
print("\n🏆 TOP 5 STRATEGIES:")
print("-" * 70)
print(f"{'Rank':<6} {'Strategy':<30} {'P&L/1k':<12} {'Trades':<8} {'WR%':<8} {'PF':<6}")
print("-" * 70)
for i, (name, pnl, trades, wr, pf) in enumerate(top_strats, 1):
print(f"{i:<6} {name[:30]:<30} ${pnl:<11.2f} {trades:<8} {wr:<7.1f}% {pf:<6.2f}")
else:
print("\n⏳ No completed strategies yet...")
# Current baseline
print("\n📊 BASELINE COMPARISON:")
print(f" v9 baseline: $192.00/1k (current production)")
if top_strats:
best_pnl = top_strats[0][1]
improvement = ((best_pnl - 192) / 192) * 100
if improvement > 0:
print(f" Best found: ${best_pnl:.2f}/1k ({improvement:+.1f}% improvement) ✅")
else:
print(f" Best found: ${best_pnl:.2f}/1k ({improvement:+.1f}%)")
conn.close()
else:
print("\n⚠️ Database not initialized. Run setup_cluster.sh first.")
print("\n" + "="*70)
if __name__ == '__main__':
try:
show_status()
except KeyboardInterrupt:
print("\n")