Fix duplicate return, add defensive null checks for bid/ask prices, and protect PnL calculation
This commit is contained in:
1 parent
e615473d22
commit
6c878c4e63
3 files changed
+7
-2
No files matched your search
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user