Skip to content

Commit

Permalink
Check if value is none first
Browse files Browse the repository at this point in the history
  • Loading branch information
brndnmtthws committed Dec 19, 2024
1 parent dcb6c38 commit 6d39df4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion thetagang/portfolio_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ async def close_positions(self, right: str, positions: List[PortfolioItem]) -> N
except RequiredFieldValidationError:
# no market price was available, fallback to minimum tick
pass
if util.isNan(price) or math.isnan(price) or not price:
if not price or util.isNan(price) or math.isnan(price):
# if the price is near zero or NaN, use the minimum price
log.warning(
f"Market price data unavailable for {position.contract.localSymbol}, using ticker.minTick={ticker.minTick}"
Expand Down

0 comments on commit 6d39df4

Please sign in to comment.