Skip to content

Commit

Permalink
Handle this failure gracefully
Browse files Browse the repository at this point in the history
I completely misunderstood the code in the previous attempt and messed
this up (in #524 and #525).
  • Loading branch information
brndnmtthws committed Dec 3, 2024
1 parent 8aede60 commit 417ffb0
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions thetagang/portfolio_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1299,15 +1299,10 @@ async def row_position_task(position: PortfolioItem) -> None:
symbol = position.contract.symbol

position.contract.exchange = self.get_order_exchange()
try:
buy_ticker = await self.ibkr.get_ticker_for_contract(
position.contract
)
except RequiredFieldValidationError:
# Likely no market price available for this contract,
# possibly because there are no bids or asks. In this case,
# treat it as a $0.00 contract.
pass
buy_ticker = await self.ibkr.get_ticker_for_contract(
position.contract,
optional_fields=[TickerField.MIDPOINT, TickerField.MARKET_PRICE],
)

strike_limit = get_strike_limit(self.config, symbol, right)
if right.startswith("C"):
Expand Down

0 comments on commit 417ffb0

Please sign in to comment.