feat: добавить milestones валидации в утренний отчёт

- День live-торговли с 08.03.2026
- Всего сделок / WR (cumulative)
- Обратный отсчёт: 50 trades (статзначимость), 90д (Sharpe), 180д (полный цикл)
- Счётчик до 100 trades

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
anor
2026-03-10 13:57:35 +10:00
co-authored by Claude Opus 4.6
parent fece3052b0
commit c5f786c116
+41
View File
@@ -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 <b>Валидация</b> (день {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)