|
@@ -425,14 +425,18 @@ class NotificationManager:
|
|
|
if entry_price > 0:
|
|
|
if position_side == 'long':
|
|
|
pnl = amount * (price - entry_price)
|
|
|
- pnl_percent = ((price - entry_price) / entry_price) * 100
|
|
|
+ # Get ROE directly from exchange data
|
|
|
+ info_data = stop_loss_info.get('info', {})
|
|
|
+ position_info = info_data.get('position', {})
|
|
|
+ roe_raw = position_info.get('returnOnEquity')
|
|
|
+ roe = float(roe_raw) * 100 if roe_raw is not None else 0.0
|
|
|
else: # short
|
|
|
pnl = amount * (entry_price - price)
|
|
|
- pnl_percent = ((entry_price - price) / entry_price) * 100
|
|
|
-
|
|
|
- # Calculate ROE (Return on Equity) more clearly
|
|
|
- cost_basis = amount * entry_price
|
|
|
- roe = (pnl / cost_basis) * 100
|
|
|
+ # Get ROE directly from exchange data
|
|
|
+ info_data = stop_loss_info.get('info', {})
|
|
|
+ position_info = info_data.get('position', {})
|
|
|
+ roe_raw = position_info.get('returnOnEquity')
|
|
|
+ roe = float(roe_raw) * 100 if roe_raw is not None else 0.0
|
|
|
|
|
|
pnl_emoji = "🟢" if pnl >= 0 else "🔴"
|
|
|
pnl_info = f"""
|