Stage 07.3.4 - monitoring screen and journal migration

This commit is contained in:
2026-04-29 15:15:07 +03:00
parent 51659037bb
commit 41c332d9cb
15 changed files with 455 additions and 70 deletions

View File

@@ -19,7 +19,7 @@ router = Router(name="trade_main")
def _trade_screen(title: str) -> str:
return (
f"<b>📊 Торговля — {title}</b>\n"
f"<b>💹 Торговля — {title}</b>\n"
f"{mode_line()}"
"Выбери раздел"
)
@@ -41,14 +41,14 @@ def _trade_home_keyboard() -> InlineKeyboardMarkup:
def _trade_home_button() -> InlineKeyboardMarkup:
builder = InlineKeyboardBuilder()
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
return builder.as_markup()
def _orders_menu_keyboard() -> InlineKeyboardMarkup:
builder = InlineKeyboardBuilder()
builder.button(text="📂 Черновики", callback_data="trade:orders:drafts")
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
builder.adjust(2)
return builder.as_markup()
@@ -57,7 +57,7 @@ def _history_menu_keyboard() -> InlineKeyboardMarkup:
builder = InlineKeyboardBuilder()
builder.button(text="✅ Исполненные", callback_data="trade:history:filled")
builder.button(text="🚫 Отменённые", callback_data="trade:history:canceled")
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
builder.adjust(2, 1)
return builder.as_markup()
@@ -67,7 +67,7 @@ def _settings_menu_keyboard() -> InlineKeyboardMarkup:
builder.button(text="⚙️ Параметры", callback_data="trade:settings:params")
builder.button(text="🔁 Режим", callback_data="trade:settings:mode")
builder.button(text=" Справка", callback_data="trade:settings:help")
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
builder.adjust(2, 2)
return builder.as_markup()
@@ -95,7 +95,7 @@ def _trade_settings_text() -> str:
# ENTRY
# =========================
@router.message(F.text.in_({"📊 Торговля", "⚡ Торговля", "Торговля"}))
@router.message(F.text.in_({"💹 Торговля"}))
async def open_trade(message: Message) -> None:
AutoTradeRunner.set_current_screen("trade")
@@ -180,7 +180,7 @@ async def open_filled_history(callback: CallbackQuery) -> None:
await callback.answer()
if callback.message is not None:
await callback.message.edit_text(
"<b>📊 Торговля — История</b>\n\n"
"<b>💹 Торговля — История</b>\n\n"
"Шаг 1/1: Исполненные\n"
"Раздел в разработке.",
reply_markup=_trade_home_button(),
@@ -192,7 +192,7 @@ async def open_canceled_history(callback: CallbackQuery) -> None:
await callback.answer()
if callback.message is not None:
await callback.message.edit_text(
"<b>📊 Торговля — История</b>\n\n"
"<b>💹 Торговля — История</b>\n\n"
"Шаг 1/1: Отменённые\n"
"Раздел в разработке.",
reply_markup=_trade_home_button(),
@@ -220,7 +220,7 @@ async def open_trade_settings_params(callback: CallbackQuery) -> None:
await callback.answer()
if callback.message is not None:
await callback.message.edit_text(
"<b>📊 Торговля — Настройки</b>\n\n"
"<b>💹 Торговля — Настройки</b>\n\n"
"Шаг 1/1: Параметры ордера\n"
"Раздел в разработке.",
reply_markup=_trade_home_button(),
@@ -232,7 +232,7 @@ async def open_trade_settings_mode(callback: CallbackQuery) -> None:
await callback.answer()
if callback.message is not None:
await callback.message.edit_text(
"<b>📊 Торговля — Настройки</b>\n\n"
"<b>💹 Торговля — Настройки</b>\n\n"
"Шаг 1/1: Режим работы\n"
"Текущий режим: <b>demo</b>",
reply_markup=_trade_home_button(),
@@ -244,7 +244,7 @@ async def open_trade_settings_help(callback: CallbackQuery) -> None:
await callback.answer()
if callback.message is not None:
await callback.message.edit_text(
"<b>📊 Торговля — Справка</b>\n\n"
"<b>💹 Торговля — Справка</b>\n\n"
"Шаг 1/1: Информация\n"
"Раздел в разработке.",
reply_markup=_trade_home_button(),

View File

@@ -51,13 +51,10 @@ MAIN_MENU_BUTTONS = {
"🏠 Главная",
"📈 Рынок",
"💼 Портфель",
"📊 Торговля",
"⚡ Торговля",
"Торговля",
"💹 Торговля",
"🤖 Авто",
"📒 Журнал",
" Система",
"⚙ Система",
"🖥 Система",
"Меню",
}
@@ -275,7 +272,7 @@ async def cancel_order_builder(message: Message, state: FSMContext) -> None:
)
await message.answer(
"<b>📊 Торговля — Новый ордер</b>\n"
"<b>💹 Торговля — Новый ордер</b>\n"
f"{mode_line()}"
"<b>⛔ Создание черновика отменено</b>",
reply_markup=_trade_back_home_keyboard(),
@@ -298,7 +295,7 @@ async def start_new_order_draft(
context = service.get_entry_context(side="BUY", order_type="MARKET")
text = (
"<b>📊 Торговля — Новый ордер</b>\n"
"<b>💹 Торговля — Новый ордер</b>\n"
f"{mode_line()}"
f"{context.symbol}\n\n"
"Шаг 1/4. Выбери сторону"
@@ -331,7 +328,7 @@ async def start_new_order_draft(
)
await show_message_exchange_error(
message,
title="<b>📊 Торговля — Новый ордер</b>",
title="<b>💹 Торговля — Новый ордер</b>",
exc=exc,
retry_callback_data="trade:new_order_retry",
)
@@ -357,7 +354,7 @@ async def process_order_side_callback(
context = service.get_entry_context(side=side, order_type="MARKET")
text = (
"<b>📊 Торговля — Новый ордер</b>\n"
"<b>💹 Торговля — Новый ордер</b>\n"
f"{mode_line()}"
f"{context.symbol}\n\n"
f"{path}\n\n"
@@ -390,7 +387,7 @@ async def process_order_side_callback(
)
await show_callback_exchange_error(
callback,
title="<b>📊 Торговля — Новый ордер</b>",
title="<b>💹 Торговля — Новый ордер</b>",
exc=exc,
retry_callback_data=callback.data,
)
@@ -1251,7 +1248,7 @@ async def confirm_order(callback: CallbackQuery, state: FSMContext) -> None:
await show_callback_exchange_error(
callback,
title="<b>📊 Торговля — Подтверждение черновика</b>",
title="<b>💹 Торговля — Подтверждение черновика</b>",
exc=exc,
retry_callback_data=callback.data,
drafts_page=data.get("draft_edit_page"),

View File

@@ -38,7 +38,7 @@ async def _return_to_draft_detail(
if not draft:
await callback.message.edit_text(
"<b>📊 Торговля</b>\n\n"
"<b>💹 Торговля</b>\n\n"
"Черновик не найден.",
reply_markup=_trade_back_home_keyboard(),
)
@@ -94,7 +94,7 @@ async def go_back_to_side(callback: CallbackQuery, state: FSMContext) -> None:
await state.set_state(NewOrderDraftStates.waiting_side)
text = (
"<b>📊 Торговля — Новый ордер</b>\n"
"<b>💹 Торговля — Новый ордер</b>\n"
f"{mode_line()}"
f"{context.symbol}\n\n"
"Шаг 1/4. Выбери сторону"
@@ -104,7 +104,7 @@ async def go_back_to_side(callback: CallbackQuery, state: FSMContext) -> None:
except ExchangeError as exc:
await _show_navigation_exchange_error(
callback,
title="<b>📊 Торговля — Новый ордер</b>",
title="<b>💹 Торговля — Новый ордер</b>",
exc=exc,
)
@@ -133,7 +133,7 @@ async def go_back_to_type(callback: CallbackQuery, state: FSMContext) -> None:
await state.set_state(NewOrderDraftStates.waiting_type)
text = (
"<b>📊 Торговля — Новый ордер</b>\n"
"<b>💹 Торговля — Новый ордер</b>\n"
f"{mode_line()}"
f"{context.symbol}\n\n"
f"{path}\n\n"
@@ -144,7 +144,7 @@ async def go_back_to_type(callback: CallbackQuery, state: FSMContext) -> None:
except ExchangeError as exc:
await _show_navigation_exchange_error(
callback,
title="<b>📊 Торговля — Новый ордер</b>",
title="<b>💹 Торговля — Новый ордер</b>",
exc=exc,
)
@@ -213,7 +213,7 @@ async def go_back_from_confirm(callback: CallbackQuery, state: FSMContext) -> No
if not confirm_draft:
await state.clear()
await callback.message.edit_text(
"<b>📊 Торговля</b>\n\n"
"<b>💹 Торговля</b>\n\n"
"Не удалось восстановить шаг подтверждения.",
reply_markup=_trade_back_home_keyboard(),
)

View File

@@ -159,7 +159,7 @@ def _side_keyboard() -> InlineKeyboardMarkup:
builder = InlineKeyboardBuilder()
builder.button(text="🟢 BUY", callback_data="order_side:BUY")
builder.button(text="🔴 SELL", callback_data="order_side:SELL")
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
builder.adjust(2, 1)
return builder.as_markup()
@@ -169,7 +169,7 @@ def _type_keyboard() -> InlineKeyboardMarkup:
builder.button(text="⚡ MARKET", callback_data="order_type:MARKET")
builder.button(text="🎯 LIMIT", callback_data="order_type:LIMIT")
builder.button(text="⬅️ Назад", callback_data="order_back:side")
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
builder.adjust(2, 2)
return builder.as_markup()
@@ -192,7 +192,7 @@ def _quantity_keyboard(
if drafts_page is not None:
builder.button(text="📚 К черновикам", callback_data=f"drafts:{drafts_page}")
else:
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
if len(presets) == 0:
builder.adjust(1, 2)
@@ -215,7 +215,7 @@ def _quantity_manual_keyboard(
if drafts_page is not None:
builder.button(text="📚 К черновикам", callback_data=f"drafts:{drafts_page}")
else:
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
builder.adjust(2)
return builder.as_markup()
@@ -237,7 +237,7 @@ def _price_keyboard(
if drafts_page is not None:
builder.button(text="📚 К черновикам", callback_data=f"drafts:{drafts_page}")
else:
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
builder.adjust(2, 2, 2)
return builder.as_markup()
@@ -252,7 +252,7 @@ def _price_manual_keyboard(
if drafts_page is not None:
builder.button(text="📚 К черновикам", callback_data=f"drafts:{drafts_page}")
else:
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
builder.adjust(2)
return builder.as_markup()
@@ -268,7 +268,7 @@ def _confirm_keyboard(
if drafts_page is not None:
builder.button(text="📚 К черновикам", callback_data=f"drafts:{drafts_page}")
else:
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
builder.adjust(1, 2)
return builder.as_markup()
@@ -276,7 +276,7 @@ def _confirm_keyboard(
def _trade_back_home_keyboard() -> InlineKeyboardMarkup:
builder = InlineKeyboardBuilder()
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
return builder.as_markup()
@@ -304,7 +304,7 @@ def _drafts_pagination_keyboard(page: int, total_pages: int) -> InlineKeyboardMa
if page < total_pages:
first_row_count += 1
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
builder.adjust(first_row_count, 1)
return builder.as_markup()
@@ -334,7 +334,7 @@ def _exchange_error_keyboard(
if drafts_page is not None:
builder.button(text="📚 К черновикам", callback_data=f"drafts:{drafts_page}")
else:
builder.button(text="🏠 К торговле", callback_data="trade:home")
builder.button(text="💹 К торговле", callback_data="trade:home")
builder.adjust(2 if back_callback_data else 1)
return builder.as_markup()
@@ -386,7 +386,7 @@ def _render_draft_summary(
success_text = "✅ <b>Черновик изменён</b>" if is_edit_mode else "✅ <b>Черновик создан</b>"
lines = [
"<b>📊 Торговля — Черновик ордера</b>",
"<b>💹 Торговля — Черновик ордера</b>",
mode_line().rstrip(),
"",
f"{symbol}",
@@ -468,7 +468,7 @@ def _render_confirm(
def _render_validation_error(errors: list[str]) -> str:
lines = [
"<b>📊 Торговля — Ошибка валидации</b>",
"<b>💹 Торговля — Ошибка валидации</b>",
mode_line().rstrip(),
"Шаг 4/4. Проверь параметры черновика",
"",
@@ -603,7 +603,7 @@ def _render_draft_detail(
order_type = str(draft["order_type"]).upper()
lines = [
"<b>📊 Торговля — Черновик</b>",
"<b>💹 Торговля — Черновик</b>",
mode_line().rstrip(),
"",
f"<b>{draft['symbol']}</b>",
@@ -642,8 +642,8 @@ def _format_draft_quantity(value: str) -> str:
def _screen_title(is_edit_mode: bool) -> str:
if is_edit_mode:
return "<b>📊 Торговля — Редактирование черновика</b>"
return "<b>📊 Торговля — Новый ордер</b>"
return "<b>💹 Торговля — Редактирование черновика</b>"
return "<b>💹 Торговля — Новый ордер</b>"
# Рендерит экран выбора количества.
@@ -908,7 +908,7 @@ async def show_recent_drafts(
if not drafts:
text = (
"<b>📊 Торговля — Черновики</b>\n"
"<b>💹 Торговля — Черновики</b>\n"
f"{mode_line()}"
"<b>Список пуст</b>\n\n"
"Черновиков пока нет."
@@ -920,7 +920,7 @@ async def show_recent_drafts(
return
lines = [
"<b>📊 Торговля — Черновики</b>",
"<b>💹 Торговля — Черновики</b>",
mode_line().rstrip(),
"",
]