feat: add 5 dashboard features — dark mode, trade history, backtests, model insights, alerts

- Dark mode: class-based theme toggle with localStorage persistence and flash prevention
- Trade History (/trades): paginated table, stats cards, equity curve chart with DB API endpoints
- Backtest Viewer (/backtests): log parser for 35 backtest results, sidebar + detail + comparison tabs
- Model Insights: dashboard card + dialog showing feature importance, regime distribution, training history
- Alert/Signal Log (/alerts): signal stats, filterable table with execution tracking
- API: 8 new endpoints with psycopg2 DB connection pool
- Dark mode sweep across books page, about dialog, and all dashboard components
- Architecture docs rewritten with Mermaid diagrams (23 docs)
- README and FEATURES.md rewritten bilingual (Indonesian + English)
- main_live.py: write model_metrics.json on startup and retrain

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
GifariKemal
2026-02-09 05:46:54 +07:00
parent b2dc2dacd7
commit e8355b3f62
230 changed files with 69573 additions and 5673 deletions
+2 -5
View File
@@ -716,12 +716,9 @@ class SmartRiskManager:
if guard.reversal_warnings >= 3 and current_profit < -10:
return True, ExitReason.TREND_REVERSAL, f"[WARN] Multiple reversal warnings ({guard.reversal_warnings}x) - Loss: ${current_profit:.2f}"
# === CHECK 5: MAXIMUM LOSS PER TRADE (LEBIH KETAT) ===
# Close jika loss sudah 50%+ dari max (sebelumnya 80%)
# === CHECK 5: MAXIMUM LOSS PER TRADE ===
# Close jika loss sudah 50%+ dari max — no exceptions
if current_profit <= -(self.max_loss_per_trade * 0.50):
# Hanya hold jika golden time SANGAT dekat (1 jam) dan momentum tidak terlalu buruk
if hours_to_golden <= 1 and hours_to_golden > 0 and momentum > -40:
return False, None, f"LAST CHANCE HOLD: Loss ${abs(current_profit):.2f} | Golden in {hours_to_golden}h - waiting for recovery"
return True, ExitReason.POSITION_LIMIT, f"[S/L] Position loss limit: ${current_profit:.2f} (50% of ${self.max_loss_per_trade:.2f})"
# === CHECK 5: STALL DETECTION ===