Stage 07.4.3.8 — Telegram execution alerts
This commit is contained in:
@@ -13,6 +13,7 @@ from src.core.event_bus import EventBus
|
||||
from src.integrations.exchange.market_data_runner import MarketDataRunner
|
||||
from src.trading.auto.service import AutoTradeService
|
||||
from src.trading.journal.service import JournalService
|
||||
from src.telegram.ui.currency_ui import format_usd_pnl, format_usd_price
|
||||
|
||||
|
||||
class AutoTradeRunner:
|
||||
@@ -497,10 +498,11 @@ class AutoTradeRunner:
|
||||
|
||||
@classmethod
|
||||
def _format_price(cls, value: object) -> str:
|
||||
try:
|
||||
return f"{float(value):.2f}"
|
||||
except (TypeError, ValueError):
|
||||
return "—"
|
||||
return format_usd_price(value)
|
||||
|
||||
@classmethod
|
||||
def _format_pnl(cls, value: object) -> str:
|
||||
return format_usd_pnl(value)
|
||||
|
||||
@classmethod
|
||||
def _format_size(cls, value: object) -> str:
|
||||
@@ -509,16 +511,6 @@ class AutoTradeRunner:
|
||||
except (TypeError, ValueError):
|
||||
return "—"
|
||||
|
||||
@classmethod
|
||||
def _format_pnl(cls, value: object) -> str:
|
||||
try:
|
||||
pnl = float(value)
|
||||
except (TypeError, ValueError):
|
||||
return "—"
|
||||
|
||||
prefix = "+" if pnl > 0 else ""
|
||||
return f"{prefix}{pnl:.4f} USD"
|
||||
|
||||
@classmethod
|
||||
async def _refresh_screen(cls, *, force: bool = False) -> None:
|
||||
now = time.monotonic()
|
||||
|
||||
Reference in New Issue
Block a user