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
+6
View File
@@ -61,6 +61,12 @@ class AlpacaClient:
return None
bid_price = getattr(quote, 'bid_price', None)
ask_price = getattr(quote, 'ask_price', None)
if bid_price is None or ask_price is None:
return None
if bid_price <= 0 or ask_price <= 0:
return None
if limit_price:
price_source = limit_price
else: