From 33cdfdb656fabb77020c69e333ea8d62fe1cf05d Mon Sep 17 00:00:00 2001 From: Xavier Salaices Date: Sat, 26 Sep 2026 17:13:27 -0500 Subject: [PATCH] docs(router): add Python and TypeScript examples to search page --- docs/llms-full.txt | 74 ++++++++++++++++++++++++++++++++++++++++ docs/router/search.mdx | 77 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 143 insertions(+), 8 deletions(-) diff --git a/docs/llms-full.txt b/docs/llms-full.txt index ab3c596e..b2e2d43e 100644 --- a/docs/llms-full.txt +++ b/docs/llms-full.txt @@ -2413,13 +2413,54 @@ Authorization: Bearer pmxt_live_... | `category` | `string` | — | Exact match on normalized category. | | `exchange` | `string` | — | Filter to a single venue (`polymarket`, `kalshi`, ...). | + +> **Note:** + The SDK methods accept the same filters as the query parameters above: + `query`, `limit`, `offset`, `category`, and `exchange`. For + `fetch_markets` / `fetchMarkets`, pass `status="closed"` (Python) or + `status: "closed"` (TypeScript) to include closed markets. + + #### Events shape + + +**Python:** + +```python +import pmxt + +router = pmxt.Router(pmxt_api_key="pmxt_live_...") + +events = router.fetch_events(query="election", limit=2) +for event in events: + print(event.title, event.volume_24h) +``` + + +**TypeScript:** + +```typescript +import pmxt from "pmxtjs"; + +const router = new pmxt.Router({ pmxtApiKey: "pmxt_live_..." }); + +const events = await router.fetchEvents({ query: "election", limit: 2 }); +for (const event of events) { + console.log(event.title, event.volume24h); +} +``` + + +**curl:** + ```bash curl "https://api.pmxt.dev/v0/events?query=election&limit=2" \ -H "Authorization: Bearer pmxt_live_..." ``` + + ```json { "data": [ @@ -2447,11 +2488,44 @@ Exactly the same shape as [`UnifiedEvent`](https://pmxt.dev/docs/concepts/unifie #### Markets shape + + +**Python:** + +```python +import pmxt + +router = pmxt.Router(pmxt_api_key="pmxt_live_...") + +markets = router.fetch_markets(query="election", limit=3) +for market in markets: + print(market.title, market.volume_24h) +``` + + +**TypeScript:** + +```typescript +import pmxt from "pmxtjs"; + +const router = new pmxt.Router({ pmxtApiKey: "pmxt_live_..." }); + +const markets = await router.fetchMarkets({ query: "election", limit: 3 }); +for (const market of markets) { + console.log(market.title, market.volume24h); +} +``` + + +**curl:** + ```bash curl "https://api.pmxt.dev/v0/markets?query=election&limit=3" \ -H "Authorization: Bearer pmxt_live_..." ``` + + ```json { "data": [ diff --git a/docs/router/search.mdx b/docs/router/search.mdx index 007fc8fa..e06e2504 100644 --- a/docs/router/search.mdx +++ b/docs/router/search.mdx @@ -35,12 +35,46 @@ Authorization: Bearer pmxt_live_... | `category` | `string` | — | Exact match on normalized category. | | `exchange` | `string` | — | Filter to a single venue (`polymarket`, `kalshi`, ...). | + + The SDK methods accept the same filters as the query parameters above: + `query`, `limit`, `offset`, `category`, and `exchange`. For + `fetch_markets` / `fetchMarkets`, pass `status="closed"` (Python) or + `status: "closed"` (TypeScript) to include closed markets. + + ## Events shape -```bash -curl "https://api.pmxt.dev/v0/events?query=election&limit=2" \ - -H "Authorization: Bearer pmxt_live_..." -``` + + + ```python + import pmxt + + router = pmxt.Router(pmxt_api_key="pmxt_live_...") + + events = router.fetch_events(query="election", limit=2) + for event in events: + print(event.title, event.volume_24h) + ``` + + + ```typescript + import pmxt from "pmxtjs"; + + const router = new pmxt.Router({ pmxtApiKey: "pmxt_live_..." }); + + const events = await router.fetchEvents({ query: "election", limit: 2 }); + for (const event of events) { + console.log(event.title, event.volume24h); + } + ``` + + + ```bash + curl "https://api.pmxt.dev/v0/events?query=election&limit=2" \ + -H "Authorization: Bearer pmxt_live_..." + ``` + + ```json { @@ -69,10 +103,37 @@ Exactly the same shape as [`UnifiedEvent`](/concepts/unified-schema#unifiedevent ## Markets shape -```bash -curl "https://api.pmxt.dev/v0/markets?query=election&limit=3" \ - -H "Authorization: Bearer pmxt_live_..." -``` + + + ```python + import pmxt + + router = pmxt.Router(pmxt_api_key="pmxt_live_...") + + markets = router.fetch_markets(query="election", limit=3) + for market in markets: + print(market.title, market.volume_24h) + ``` + + + ```typescript + import pmxt from "pmxtjs"; + + const router = new pmxt.Router({ pmxtApiKey: "pmxt_live_..." }); + + const markets = await router.fetchMarkets({ query: "election", limit: 3 }); + for (const market of markets) { + console.log(market.title, market.volume24h); + } + ``` + + + ```bash + curl "https://api.pmxt.dev/v0/markets?query=election&limit=3" \ + -H "Authorization: Bearer pmxt_live_..." + ``` + + ```json {