From 57e027fe653a1d3963f51b10268666f19b5ff6a9 Mon Sep 17 00:00:00 2001 From: anor Date: Mon, 9 Mar 2026 06:40:21 +1000 Subject: [PATCH] =?UTF-8?q?fix:=20/balance=20=D0=BF=D0=BE=D0=BA=D0=B0?= =?UTF-8?q?=D0=B7=D1=8B=D0=B2=D0=B0=D0=B5=D1=82=20=D1=8D=D0=BA=D0=B2=D0=B8?= =?UTF-8?q?=D0=B2=D0=B0=D0=BB=D0=B5=D0=BD=D1=82=20=D0=BA=D0=B0=D0=B6=D0=B4?= =?UTF-8?q?=D0=BE=D0=B9=20=D0=BC=D0=BE=D0=BD=D0=B5=D1=82=D1=8B=20=D0=B8=20?= =?UTF-8?q?=D0=B8=D1=82=D0=BE=D0=B3=D0=BE=20=D0=B2=20USDC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- src/remizov_trader/cli.py | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/remizov_trader/cli.py b/src/remizov_trader/cli.py index 24f41bc..a3636e5 100644 --- a/src/remizov_trader/cli.py +++ b/src/remizov_trader/cli.py @@ -291,14 +291,34 @@ def _send_balance(cfg): spot = SpotExecutor(cfg.exchange, leverage=cfg.risk.leverage) spot._ensure_markets() b = spot.exchange.fetch_balance() - lines = ["\U0001f4b0 Баланс на бирже", ""] - for coin in ["USDC", "USDT", "BTC", "ETH", "SOL"]: + + # Collect balances and convert to USDC + total_usdc = 0.0 + coin_lines = [] + for coin in ["USDC", "USDT", "BTC", "ETH", "SOL", "AVAX", "LINK", "XRP"]: free = float(b.get(coin, {}).get("free", 0) or 0) total = float(b.get(coin, {}).get("total", 0) or 0) - if total > 0.0001: - locked = total - free - lock_str = f" (заблокировано: {locked:.6f})" if locked > 0.0001 else "" - lines.append(f" {coin}: {free:.6f}{lock_str}") + if total < 0.0001: + continue + # Convert to USDC + if coin == "USDC": + val_usdc = total + elif coin == "USDT": + val_usdc = total # ~1:1 + else: + price = spot.get_price(f"{coin}/USDC") + val_usdc = total * price if price else 0 + total_usdc += val_usdc + locked = total - free + lock_str = f" (locked: {locked:.6f})" if locked > 0.0001 else "" + coin_lines.append(f" {coin}: {free:.6f}{lock_str}" + f" ≈ ${val_usdc:,.2f}") + + lines = ["\U0001f4b0 Баланс на бирже", ""] + lines.extend(coin_lines) + lines.append("") + lines.append(f" Итого: ${total_usdc:,.2f}") + from .notify import send_telegram send_telegram(cfg.telegram, "\n".join(lines)) except Exception as e: