diff --git a/src/remizov_trader/notify.py b/src/remizov_trader/notify.py
index 4c074c5..c4f3425 100644
--- a/src/remizov_trader/notify.py
+++ b/src/remizov_trader/notify.py
@@ -74,28 +74,34 @@ def format_status_report(cfg, conn) -> str:
total_equity = sum(a["equity"] for a in assets)
total_initial = cfg.initial_capital * len(assets) if assets else cfg.initial_capital
- total_pnl = total_equity - total_initial
- total_pct = (total_equity / total_initial - 1) * 100 if total_initial > 0 else 0
+
+ # Collect open positions and calculate unrealized PnL
+ open_positions = []
+ total_unrealized = 0.0
+ for a in assets:
+ pos = get_open_position(conn, a["ticker"])
+ if pos:
+ cur_price = _get_current_price(cfg, a["ticker"])
+ open_positions.append((a, pos, cur_price))
+ if cur_price:
+ total_unrealized += pos["pos_size"] * (cur_price - pos["entry_price"]) * pos["direction"]
+
+ total_balance = total_equity + total_unrealized
+ total_pnl = total_balance - total_initial
+ total_pct = (total_balance / total_initial - 1) * 100 if total_initial > 0 else 0
lines = ["\U0001f4ca RemizovTrader"]
lines.append("")
# --- Portfolio ---
lines.append(f"\U0001f4b0 Портфель")
- lines.append(f" Капитал: ${total_equity:,.2f} ({total_pct:+.1f}%)")
+ lines.append(f" Баланс: ${total_balance:,.2f} ({total_pct:+.1f}%)")
lines.append(f" PnL: ${total_pnl:+,.2f}")
lines.append("")
- # --- Open positions with unrealized PnL ---
- open_positions = []
- for a in assets:
- pos = get_open_position(conn, a["ticker"])
- if pos:
- open_positions.append((a, pos))
-
if open_positions:
lines.append(f"\U0001f4c8 Позиции ({len(open_positions)}/{cfg.risk.max_open_positions})")
- for a, pos in open_positions:
+ for a, pos, cur_price in open_positions:
d = "\U0001f7e2 LONG" if pos["direction"] == 1 else "\U0001f534 SHORT"
entry = pos["entry_price"]
stop = pos["stop_price"]
@@ -103,8 +109,6 @@ def format_status_report(cfg, conn) -> str:
pos_size = pos["pos_size"]
risk_pct = abs(entry - stop) / entry * 100
- # Fetch current price for unrealized PnL
- cur_price = _get_current_price(cfg, a["ticker"])
if cur_price:
upnl = pos_size * (cur_price - entry) * pos["direction"]
upnl_pct = (cur_price / entry - 1) * 100 * pos["direction"]