From a9e185c00f0c4caed019eabccb838ece534f4ee5 Mon Sep 17 00:00:00 2001 From: PolyOrderbooks Date: Wed, 5 Aug 2026 14:42:22 +0530 Subject: [PATCH 1/2] Document list_markets response shape in README quickstart. Show a trimmed markets["data"] example so developers know slug, question, and status without opening the API docs. Co-authored-by: Cursor --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 7c37005..f43035e 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,13 @@ client = PolyOrderbooksClient(api_key=os.environ["POLYORDERBOOKS_API_KEY"]) # client = PolyOrderbooksClient() markets = client.list_markets(search="bitcoin", limit=5) + +# markets["data"] looks like: +# [ +# {"slug": "will-bitcoin-hit-150k-in-2026", "question": "Will Bitcoin hit $150k in 2026?", "status": "active"}, +# {"slug": "fed-rate-cut-september-2026", "question": "Will the Fed cut rates in September 2026?", "status": "active"}, +# ] + slug = markets["data"][0]["slug"] end = datetime.now(timezone.utc) From 1145045bdc19ae646ba87748dfa2116d6ad0b5ed Mon Sep 17 00:00:00 2001 From: PolyOrderbooks Date: Wed, 5 Aug 2026 14:44:42 +0530 Subject: [PATCH 2/2] Show markets["data"] as a separate JSON example with three fields. Keep slug, question, and status only; note that more fields exist without listing them all. Co-authored-by: Cursor --- README.md | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f43035e..6e7d6a9 100644 --- a/README.md +++ b/README.md @@ -32,13 +32,6 @@ client = PolyOrderbooksClient(api_key=os.environ["POLYORDERBOOKS_API_KEY"]) # client = PolyOrderbooksClient() markets = client.list_markets(search="bitcoin", limit=5) - -# markets["data"] looks like: -# [ -# {"slug": "will-bitcoin-hit-150k-in-2026", "question": "Will Bitcoin hit $150k in 2026?", "status": "active"}, -# {"slug": "fed-rate-cut-september-2026", "question": "Will the Fed cut rates in September 2026?", "status": "active"}, -# ] - slug = markets["data"][0]["slug"] end = datetime.now(timezone.utc) @@ -63,6 +56,23 @@ for outcome, points in books["data"].items(): client.close() ``` +`markets["data"]` is a list of market objects. Each item includes more fields (`public_id`, `volume`, `event_slug`, …); the essentials look like: + +```json +[ + { + "slug": "will-bitcoin-hit-150k-in-2026", + "question": "Will Bitcoin hit $150k in 2026?", + "status": "active" + }, + { + "slug": "fed-rate-cut-september-2026", + "question": "Will the Fed cut rates in September 2026?", + "status": "active" + } +] +``` + Context manager usage: ```python