Skip to content

refactor: handle error in fetch_order_book() in the same way#67

Merged
realfishsam merged 4 commits intopmxt-dev:mainfrom
psyberck:refactor/order-book-fetch
Mar 23, 2026
Merged

refactor: handle error in fetch_order_book() in the same way#67
realfishsam merged 4 commits intopmxt-dev:mainfrom
psyberck:refactor/order-book-fetch

Conversation

@psyberck
Copy link
Contributor

What this PR adds (Close Issue #66 )

When an OrderNotFound exception is caught, it now returns an empty OrderBook(bids=[], asks=[]) instead of re-raising the error — making it consistent with how other fetch methods handle "not found" cases.

Other exceptions will still be re-raised

Testing result

exchange = pmxt.Polymarket()
p = exchange.fetch_order_book('non-existing-orderbook')
print(p)

OrderBook(bids=[], asks=[], timestamp=None)

@realfishsam realfishsam merged commit 4c71a18 into pmxt-dev:main Mar 23, 2026
2 of 4 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.

2 participants