Fix duplicate return, add defensive null checks for bid/ask prices, and protect PnL calculation

This commit is contained in:
Justin Oros
2026-02-04 16:47:03 -07:00
parent e615473d22
commit 6c878c4e63
3 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -1076,7 +1076,7 @@ def main():
status_msg = f"⏱️ {current_time} | {position_status} | {regime.upper()}"
if position_active:
if entry_price > 0:
if entry_price > 0 and current_price > 0:
pnl_pct = ((current_price - entry_price) / entry_price) * 100 if position_type == 'long' else ((entry_price - current_price) / entry_price) * 100
else:
pnl_pct = 0