Stage 07.4.3.8 — Telegram execution alerts

This commit is contained in:
2026-05-04 19:52:35 +03:00
parent d8c077d066
commit 1253cda003
6 changed files with 358 additions and 122 deletions

View File

@@ -52,6 +52,34 @@ def format_usd_amount(value: float) -> str:
return f"{value:,.2f}".replace(",", " ")
def format_usd_price(value: float | int | str | None) -> str:
if value is None:
return ""
try:
return f"{float(value):,.2f}".replace(",", " ")
except (TypeError, ValueError):
return ""
def format_usd_pnl(value: float | int | str | None) -> str:
if value is None:
return ""
try:
pnl = float(value)
except (TypeError, ValueError):
return ""
if pnl > 0:
return f"🟢 +{format_usd_price(pnl)} USD"
if pnl < 0:
return f"🔴 -{format_usd_price(abs(pnl))} USD"
return f"{format_usd_price(0)} USD"
def render_currency_line(
*,
currency: str,