Skip to content

Fix IB 0.0 sentinel handling and add warnings to quote response#7

Merged
brycedbjork merged 1 commit into
mainfrom
bryce/fix-aapl-quote
Feb 23, 2026
Merged

Fix IB 0.0 sentinel handling and add warnings to quote response#7
brycedbjork merged 1 commit into
mainfrom
bryce/fix-aapl-quote

Conversation

@brycedbjork
Copy link
Copy Markdown
Collaborator

Summary

Treat 0.0 as an IB sentinel value for price fields (bid, ask, last). IB returns 0.0 during off-hours when market data is unavailable; no exchange-traded instrument trades at $0.00. This ensures the delayed/delayed_frozen fallback cascade triggers instead of showing a nonsensical $0.00 price.

Additionally adds warnings to the JSON response envelope so clients can programmatically access warning messages alongside stderr output.

Changes

  • Add reject_zero parameter to _to_float_or_none() to filter 0.0 sentinel for price fields
  • Apply reject_zero=True to bid, ask, last in _ticker_to_quote()
  • Apply reject_zero=True to underlying price lookups in option_chain()
  • Add test cases for zero sentinel detection and fallback triggering
  • Add warnings field to quote JSON response

🤖 Generated with Claude Code

Treat 0.0 as an IB sentinel value for price fields (bid, ask, last).
IB returns 0.0 during off-hours when market data is unavailable; no
exchange-traded instrument trades at $0.00. This fix ensures the
delayed/delayed_frozen fallback cascade triggers instead of showing
a nonsensical $0.00 price.

Changes:
- Add reject_zero parameter to _to_float_or_none() for price field handling
- Apply reject_zero=True to bid, ask, last in _ticker_to_quote()
- Apply reject_zero=True to underlying price lookups in option_chain()
- Add test cases for zero sentinel detection and fallback triggering

Additionally, add warnings to JSON response envelope so clients can
programmatically access warning messages alongside stderr output.

Co-authored-by: Bryce Bjork <brycedbjork@gmail.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
broker-cli Ready Ready Preview Feb 23, 2026 4:57am

Request Review

@brycedbjork brycedbjork merged commit 7af42d5 into main Feb 23, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant