feat: команда /report и кнопка «Отчёт» в Telegram боте

- /report — утренний отчёт по запросу (сделки, PnL, milestones валидации)
- Кнопка 📋 Отчёт в persistent keyboard
- Обновлена справка /help

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
anor
2026-03-10 14:04:32 +10:00
co-authored by Claude Opus 4.6
parent 538c43f62b
commit 1496a9fee3
+10 -3
View File
@@ -290,8 +290,8 @@ def _send_with_keyboard(cfg, text: str, keyboard=None):
# Persistent reply keyboard (bottom of screen)
_REPLY_KEYBOARD = {
"keyboard": [
[{"text": "\U0001f4ca Статус"}, {"text": "\U0001f4b0 Баланс"}],
[{"text": "\u2696\ufe0f Плечо"}, {"text": "\u2753 Помощь"}],
[{"text": "\U0001f4ca Статус"}, {"text": "\U0001f4cb Отчёт"}],
[{"text": "\U0001f4b0 Баланс"}, {"text": "\u2696\ufe0f Плечо"}, {"text": "\u2753 Помощь"}],
],
"resize_keyboard": True,
"is_persistent": True,
@@ -304,6 +304,7 @@ def _send_help(cfg):
"\U0001f916 <b>RemizovTrader — Команды</b>\n"
"\n"
"/status — портфель, позиции, статистика\n"
"/report — утренний отчёт (сделки, PnL, валидация)\n"
"/balance — баланс на бирже\n"
"/leverage — текущее плечо\n"
"/leverage N — установить плечо (1-10)\n"
@@ -365,7 +366,7 @@ def _start_telegram_listener(cfg, get_db_fn):
import httpx
from .notify import format_status_report, send_telegram
from .notify import format_morning_report, format_status_report, send_telegram
# Map button text to commands
_button_map = {
@@ -373,6 +374,7 @@ def _start_telegram_listener(cfg, get_db_fn):
"\U0001f4b0 баланс": "/balance",
"\u2696\ufe0f плечо": "/leverage",
"\u2753 помощь": "/help",
"\U0001f4cb отчёт": "/report",
}
def handle_command(text: str):
@@ -384,6 +386,11 @@ def _start_telegram_listener(cfg, get_db_fn):
report = format_status_report(cfg, conn)
conn.close()
send_telegram(cfg.telegram, report)
elif cmd == "/report":
conn = get_db_fn()
report = format_morning_report(cfg, conn)
conn.close()
send_telegram(cfg.telegram, report)
elif cmd == "/leverage":
_handle_leverage(cfg, mapped, send_telegram)
elif cmd == "/balance":