Improve market & order fetching clarity and update README#260
Improve market & order fetching clarity and update README#260SatoshiZKMO wants to merge 3 commits intoPolymarket:mainfrom
Conversation
|
Fixed |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| next_cursor = None | ||
|
|
||
| while True: | ||
| response = client.get_markets(next_cursor=next_cursor) |
There was a problem hiding this comment.
Passing None as cursor creates invalid API URL
Medium Severity
The pagination loop initializes next_cursor to None and passes it explicitly to client.get_markets(next_cursor=next_cursor). Since get_markets doesn't guard against None like other methods do, None gets string-interpolated into the URL as the literal "None", creating an invalid request like ?next_cursor=None. The first iteration will fail or return unexpected results. The fix is to either omit next_cursor on the first call or initialize it to "MA==".


Overview
This PR improves the clarity and usability of the early Polymarket market intelligence MVP, with a focus on making market and order data fetching easier to understand and extend.
Description
What changed
fetch_markets.py.get_orders.pyto expose orderbook and liquidity-related data.README.mdto better describe:All changes are non-breaking and focused on developer experience and faster iteration.
Testing instructions
Run the scripts locally:
python fetch_markets.py
python get_orders.py
Expected behavior
Types of changes
Notes
Status
[WIP]if necessaryNote
Low Risk
Low risk: documentation and example-script updates only; no library/runtime behavior changes beyond how sample code is invoked.
Overview
Adds a new Examples section to
README.mdthat points users to minimal Python scripts for fetching markets, orderbooks, and open orders.Introduces
examples/fetch_markets.py(cursor-based market listing) and tightens existing example scripts with clearer docstrings and properif __name__ == "__main__":entrypoints forget_orderbook.py,get_orderbooks.py, andget_orders.py.Written by Cursor Bugbot for commit fdfc70b. This will update automatically on new commits. Configure here.