diff --git a/src/remizov_trader/notify.py b/src/remizov_trader/notify.py index 576128b..537ceb0 100644 --- a/src/remizov_trader/notify.py +++ b/src/remizov_trader/notify.py @@ -329,6 +329,47 @@ def format_morning_report(cfg, conn) -> str: lines.append(f"\u2699\ufe0f Циклов: {cycle_rows['cnt']} | " f"Avg: {cycle_rows['avg_dur']:.1f}s") + # --- Validation milestones --- + from datetime import date + LIVE_START = date(2026, 3, 8) + today = now.date() + live_days = (today - LIVE_START).days + + # Total real trades (excluding failures/resets) + total_real = conn.execute( + "SELECT COUNT(*) as cnt, SUM(CASE WHEN pnl_net > 0 THEN 1 ELSE 0 END) as wins " + "FROM positions WHERE status='closed' " + "AND exit_reason NOT IN ('live_buy_failed', 'manual_reset', 'phantom_cleanup', 'portfolio_rebalance')" + ).fetchone() + total_trades = total_real["cnt"] if total_real else 0 + total_wins = total_real["wins"] if total_real else 0 + live_wr = total_wins / total_trades * 100 if total_trades > 0 else 0 + + lines.append("") + lines.append(f"\U0001f3af Валидация (день {live_days})") + lines.append(f"{S*3}Всего сделок: {total_trades} | WR: {live_wr:.0f}%") + + # Milestones + milestones = [ + (50, "статзначимость (50 trades)"), + (90, "Sharpe из live (3 мес)"), + (180, "полный цикл рынка (6 мес)"), + ] + for target_days, label in milestones: + remaining = target_days - live_days + if remaining > 0: + target_date = LIVE_START + timedelta(days=target_days) + lines.append(f"{S*3}\u23f3 {label}: {remaining}д ({target_date.strftime('%d.%m')})") + else: + lines.append(f"{S*3}\u2705 {label}: ГОТОВО") + + # Trade milestone + trades_remaining = max(0, 100 - total_trades) + if trades_remaining > 0: + lines.append(f"{S*3}\u23f3 100 trades: ещё {trades_remaining}") + else: + lines.append(f"{S*3}\u2705 100 trades: ГОТОВО") + return "\n".join(lines)