diff --git a/core/src/server/openapi.yaml b/core/src/server/openapi.yaml
index 5081b901..a5edbca4 100644
--- a/core/src/server/openapi.yaml
+++ b/core/src/server/openapi.yaml
@@ -72,26 +72,7 @@ paths:
summary: Fetch Markets
operationId: fetchMarkets
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - limitless
- - probable
- - baozi
- - myriad
- - opinion
- - metaculus
- - smarkets
- - polymarket_us
- - suibets
- - router
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
- in: query
name: limit
required: false
@@ -277,26 +258,7 @@ paths:
summary: Fetch Events
operationId: fetchEvents
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - limitless
- - probable
- - baozi
- - myriad
- - opinion
- - metaculus
- - smarkets
- - polymarket_us
- - suibets
- - router
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
- in: query
name: query
required: false
@@ -421,19 +383,7 @@ paths:
summary: Fetch Series
operationId: fetchSeries
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - opinion
- - polymarket_us
- - router
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
responses:
'200':
description: Fetch Series response
@@ -687,21 +637,7 @@ paths:
summary: Fetch OHLCV
operationId: fetchOHLCV
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - limitless
- - probable
- - baozi
- - myriad
- - opinion
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
- in: query
name: outcomeId
required: true
@@ -753,25 +689,7 @@ paths:
summary: Fetch Order Book
operationId: fetchOrderBook
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - limitless
- - probable
- - baozi
- - myriad
- - opinion
- - smarkets
- - polymarket_us
- - suibets
- - router
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
- in: query
name: outcomeId
required: true
@@ -839,16 +757,7 @@ paths:
summary: Fetch Order Books
operationId: fetchOrderBooks
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
requestBody:
content:
application/json:
@@ -890,21 +799,7 @@ paths:
summary: Fetch Trades
operationId: fetchTrades
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - limitless
- - probable
- - baozi
- - myriad
- - smarkets
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
- in: query
name: outcomeId
required: true
@@ -950,24 +845,7 @@ paths:
summary: Create Order
operationId: createOrder
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - limitless
- - probable
- - baozi
- - myriad
- - opinion
- - metaculus
- - smarkets
- - polymarket_us
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
requestBody:
content:
application/json:
@@ -1003,19 +881,7 @@ paths:
summary: Build Order
operationId: buildOrder
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - opinion
- - smarkets
- - polymarket_us
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
requestBody:
content:
application/json:
@@ -1053,19 +919,7 @@ paths:
summary: Submit Order
operationId: submitOrder
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - opinion
- - smarkets
- - polymarket_us
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
requestBody:
content:
application/json:
@@ -1101,22 +955,7 @@ paths:
summary: Cancel Order
operationId: cancelOrder
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - limitless
- - probable
- - opinion
- - metaculus
- - smarkets
- - polymarket_us
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
requestBody:
content:
application/json:
@@ -1152,21 +991,7 @@ paths:
summary: Fetch Order
operationId: fetchOrder
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - probable
- - baozi
- - opinion
- - smarkets
- - polymarket_us
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
- in: query
name: orderId
required: true
@@ -1190,23 +1015,7 @@ paths:
summary: Fetch Open Orders
operationId: fetchOpenOrders
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - limitless
- - probable
- - baozi
- - myriad
- - opinion
- - smarkets
- - polymarket_us
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
- in: query
name: marketId
required: false
@@ -1232,22 +1041,7 @@ paths:
summary: Fetch My Trades
operationId: fetchMyTrades
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - limitless
- - probable
- - myriad
- - opinion
- - smarkets
- - polymarket_us
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
- in: query
name: outcomeId
required: false
@@ -1305,18 +1099,7 @@ paths:
summary: Fetch Closed Orders
operationId: fetchClosedOrders
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - kalshi
- - kalshi-demo
- - limitless
- - opinion
- - smarkets
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
- in: query
name: marketId
required: false
@@ -1368,18 +1151,7 @@ paths:
summary: Fetch All Orders
operationId: fetchAllOrders
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - kalshi
- - kalshi-demo
- - limitless
- - opinion
- - smarkets
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
- in: query
name: marketId
required: false
@@ -1431,24 +1203,7 @@ paths:
summary: Fetch Positions
operationId: fetchPositions
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - limitless
- - probable
- - baozi
- - myriad
- - opinion
- - smarkets
- - polymarket_us
- - suibets
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
- in: query
name: address
required: false
@@ -1474,22 +1229,7 @@ paths:
summary: Fetch Balance
operationId: fetchBalance
parameters:
- - in: path
- name: exchange
- schema:
- type: string
- enum:
- - polymarket
- - kalshi
- - kalshi-demo
- - limitless
- - probable
- - baozi
- - myriad
- - smarkets
- - polymarket_us
- required: true
- description: The prediction market exchange to target.
+ - $ref: '#/components/parameters/ExchangeParam'
- in: query
name: address
required: false
diff --git a/docs/api-reference/fetch-order-book.mdx b/docs/api-reference/fetch-order-book.mdx
index 1aea6e43..55b0cb4d 100644
--- a/docs/api-reference/fetch-order-book.mdx
+++ b/docs/api-reference/fetch-order-book.mdx
@@ -7,7 +7,11 @@ openapi: GET /api/{exchange}/fetchOrderBook
### Live order book
-Fetch the current L2 order book for an outcome. If you already have an outcome token ID, pass it directly:
+Fetch the current L2 order book for an outcome from the exchange's live order book endpoint. For Polymarket this is a live CLOB call: pass the outcome token ID directly and omit historical params.
+
+
+`poly.fetch_order_book(token_id)` without `params.since` or `params.until` is live-only. It does not read PMXT Archive data and may fail for closed, resolved, or otherwise inactive Polymarket markets with an error such as `No orderbook exists`.
+
```python Python
@@ -28,15 +32,15 @@ console.log(`${book.bids.length} bids, ${book.asks.length} asks`);
```bash curl
curl "https://api.pmxt.dev/api/polymarket/fetchOrderBook?outcomeId=104932610032177696635191871147557737718087870958469629338467406422339967452218" \
- -H "Authorization: Bearer $PMXT_API_KEY"
+ -H "Authorization: Bearer ***"
```
### Historical snapshot
-Get the order book at a specific point in time. Pass `since` as a Unix timestamp in milliseconds — returns the nearest snapshot at or before that time.
+Get the order book at a specific point in time by passing `since` as a Unix timestamp in milliseconds. Historical Polymarket queries are served from the PMXT Archive and return the nearest reconstructed snapshot at or before that time.
-For binary markets, you can pass the market ID and choose the side with `params.outcome`. Use `"yes"` or `"no"` instead of copying the long outcome token ID:
+For binary markets, you can pass the Polymarket condition ID as the first argument and choose the side with `params.outcome`. Use `"yes"` or `"no"` instead of copying the long outcome token ID.
```python Python
@@ -44,12 +48,9 @@ import pmxt
poly = pmxt.Polymarket(pmxt_api_key="pmxt_...")
-market = poly.fetch_market(
- slug="will-spacex-starship-flight-test-12-launch-by-may-22-354-721"
-)
-
+# Historical lookup against PMXT Archive, not the live CLOB.
book = poly.fetch_order_book(
- market.market_id,
+ "0xc704f74e2f9dfae70f770cb253ffadde10768eeab41233098bf5ac67995a94b5",
params={"since": 1779487200000, "outcome": "yes"},
)
@@ -63,12 +64,9 @@ import { Polymarket } from "pmxtjs";
const poly = new Polymarket({ pmxtApiKey: "pmxt_..." });
-const market = await poly.fetchMarket({
- slug: "will-spacex-starship-flight-test-12-launch-by-may-22-354-721",
-});
-
+// Historical lookup against PMXT Archive, not the live CLOB.
const book = await poly.fetchOrderBook(
- market.marketId,
+ "0xc704f74e2f9dfae70f770cb253ffadde10768eeab41233098bf5ac67995a94b5",
undefined,
{ since: 1779487200000, outcome: "yes" }
);
@@ -79,9 +77,51 @@ console.log(` best ask: ${Math.min(...book.asks.map((a) => a.price)).toFixed(3)
```bash curl
curl -X POST "https://api.pmxt.dev/api/polymarket/fetchOrderBook" \
- -H "Authorization: Bearer $PMXT_API_KEY" \
+ -H "Authorization: Bearer ***" \
+ -H "Content-Type: application/json" \
+ -d '{"args":["0xc704f74e2f9dfae70f770cb253ffadde10768eeab41233098bf5ac67995a94b5", null, {"since": 1779487200000, "outcome": "yes"}]}'
+```
+
+
+### Historical crypto 5m events
+
+Polymarket crypto 5-minute slugs such as `btc-updown-5m-1779481500` are event slugs. Use `fetch_event(slug=...)`, then select the nested market you want. Do not use `fetch_market(slug=...)` for these event-level slugs.
+
+
+```python Python
+import pmxt
+
+poly = pmxt.Polymarket(pmxt_api_key="pmxt_...")
+event = poly.fetch_event(slug="btc-updown-5m-1779481500")
+market = event.markets[0]
+
+book = poly.fetch_order_book(
+ market.market_id,
+ params={"since": 1779487200000, "outcome": "yes"},
+)
+print(f"{market.title}: {book.dt}")
+```
+
+```javascript JavaScript
+import { Polymarket } from "pmxtjs";
+
+const poly = new Polymarket({ pmxtApiKey: "pmxt_..." });
+const event = await poly.fetchEvent({ slug: "btc-updown-5m-1779481500" });
+const market = event.markets[0];
+
+const book = await poly.fetchOrderBook(
+ market.marketId,
+ undefined,
+ { since: 1779487200000, outcome: "yes" }
+);
+console.log(`${market.title}: ${book.datetime}`);
+```
+
+```bash curl
+curl -X POST "https://api.pmxt.dev/api/polymarket/fetchEvent" \
+ -H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
- -d '{"args":["61b0ed20-7f42-41fd-af15-7b86153f6bb7", null, {"since": 1779487200000, "outcome": "yes"}]}'
+ -d '{"kwargs":{"slug":"btc-updown-5m-1779481500"}}'
```
@@ -89,17 +129,15 @@ curl -X POST "https://api.pmxt.dev/api/polymarket/fetchOrderBook" \
Pass both `since` and `until` to get an array of fully reconstructed L2 order book snapshots. Each snapshot is a complete book at that moment in time — not deltas.
-Default 100 snapshots per request, max 1000.
+The API returns up to `limit` snapshots from the PMXT Archive. Defaults to 100 snapshots per request, max 1000. For raw bulk downloads, use the Parquet files in the [PMXT Archive](https://archive.pmxt.dev) instead of trying to stream bulk data through the live order book endpoint.
```python Python
import pmxt
poly = pmxt.Polymarket(pmxt_api_key="pmxt_...")
-
-market = poly.fetch_market(
- slug="will-spacex-starship-flight-test-12-launch-by-may-22-354-721"
-)
+event = poly.fetch_event(slug="btc-updown-5m-1779481500")
+market = event.markets[0]
books = poly.fetch_order_book(
market.market_id,
@@ -107,6 +145,7 @@ books = poly.fetch_order_book(
"since": 1779480000000,
"until": 1779487200000,
"outcome": "yes",
+ "limit": 100,
}
)
print(f"{len(books)} snapshots")
@@ -118,15 +157,13 @@ for ob in books[:3]:
import { Polymarket } from "pmxtjs";
const poly = new Polymarket({ pmxtApiKey: "pmxt_..." });
-
-const market = await poly.fetchMarket({
- slug: "will-spacex-starship-flight-test-12-launch-by-may-22-354-721",
-});
+const event = await poly.fetchEvent({ slug: "btc-updown-5m-1779481500" });
+const market = event.markets[0];
const books = await poly.fetchOrderBook(
market.marketId,
undefined,
- { since: 1779480000000, until: 1779487200000, outcome: "yes" }
+ { since: 1779480000000, until: 1779487200000, outcome: "yes", limit: 100 }
);
console.log(`${books.length} snapshots`);
books.slice(0, 3).forEach((ob) =>
@@ -136,12 +173,12 @@ books.slice(0, 3).forEach((ob) =>
```bash curl
curl -X POST "https://api.pmxt.dev/api/polymarket/fetchOrderBook" \
- -H "Authorization: Bearer $PMXT_API_KEY" \
+ -H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
- -d '{"args":["61b0ed20-7f42-41fd-af15-7b86153f6bb7", null, {"since": 1779480000000, "until": 1779487200000, "outcome": "yes"}]}'
+ -d '{"args":["0xc704f74e2f9dfae70f770cb253ffadde10768eeab41233098bf5ac67995a94b5", null, {"since": 1779480000000, "until": 1779487200000, "outcome": "yes", "limit": 100}]}'
```
-Historical order book data is backed by the [PMXT Archive](https://archive.pmxt.dev) — the same tick-level data available as Parquet files, but queryable directly from the API without downloading or parsing files. Supports Polymarket, Kalshi, Limitless, and Opinion.
+Historical order book data is backed by the [PMXT Archive](https://archive.pmxt.dev) — the same tick-level data available as Parquet files, but queryable directly from the API without downloading or parsing files. Historical `fetchOrderBook` supports Polymarket, Kalshi, Limitless, and Opinion.
diff --git a/docs/api-reference/openapi.json b/docs/api-reference/openapi.json
index a3456ec6..c4653974 100644
--- a/docs/api-reference/openapi.json
+++ b/docs/api-reference/openapi.json
@@ -3,7 +3,7 @@
"info": {
"title": "PMXT Hosted API",
"description": "One API for every prediction market. Cross-venue search in under 10ms, a single unified schema, and the complete venue surface from reads to trades.",
- "version": "2.48.4"
+ "version": "2.17.1"
},
"servers": [
{
diff --git a/docs/concepts/venues.mdx b/docs/concepts/venues.mdx
index 797f6cb1..f8e346ac 100644
--- a/docs/concepts/venues.mdx
+++ b/docs/concepts/venues.mdx
@@ -7,7 +7,7 @@ description: "Every venue PMXT currently speaks."
AUTO-GENERATED from pmxt-core's openapi spec (ExchangeParam enum).
Do not edit by hand — run `npm run generate:mintlify` to regenerate.
Source: docs/api-reference/openapi.json
- pmxt-core version at last sync: 2.48.4
+ pmxt-core version at last sync: 2.17.1
*/}
PMXT Hosted currently supports the following venues. The **wire key** is
diff --git a/docs/llms-full.txt b/docs/llms-full.txt
index 55c492dc..bbf82c1f 100644
--- a/docs/llms-full.txt
+++ b/docs/llms-full.txt
@@ -3274,7 +3274,12 @@ Source: https://pmxt.dev/docs/api-reference/fetch-order-book
##### Live order book
-Fetch the current L2 order book for an outcome. If you already have an outcome token ID, pass it directly:
+Fetch the current L2 order book for an outcome from the exchange's live order book endpoint. For Polymarket this is a live CLOB call: pass the outcome token ID directly and omit historical params.
+
+
+> **Warning:**
+`poly.fetch_order_book(token_id)` without `params.since` or `params.until` is live-only. It does not read PMXT Archive data and may fail for closed, resolved, or otherwise inactive Polymarket markets with an error such as `No orderbook exists`.
+
```python Python
@@ -3295,15 +3300,15 @@ console.log(`${book.bids.length} bids, ${book.asks.length} asks`);
```bash curl
curl "https://api.pmxt.dev/api/polymarket/fetchOrderBook?outcomeId=104932610032177696635191871147557737718087870958469629338467406422339967452218" \
- -H "Authorization: Bearer $PMXT_API_KEY"
+ -H "Authorization: Bearer ***"
```
##### Historical snapshot
-Get the order book at a specific point in time. Pass `since` as a Unix timestamp in milliseconds — returns the nearest snapshot at or before that time.
+Get the order book at a specific point in time by passing `since` as a Unix timestamp in milliseconds. Historical Polymarket queries are served from the PMXT Archive and return the nearest reconstructed snapshot at or before that time.
-For binary markets, you can pass the market ID and choose the side with `params.outcome`. Use `"yes"` or `"no"` instead of copying the long outcome token ID:
+For binary markets, you can pass the Polymarket condition ID as the first argument and choose the side with `params.outcome`. Use `"yes"` or `"no"` instead of copying the long outcome token ID.
```python Python
@@ -3311,12 +3316,9 @@ import pmxt
poly = pmxt.Polymarket(pmxt_api_key="pmxt_...")
-market = poly.fetch_market(
-slug="will-spacex-starship-flight-test-12-launch-by-may-22-354-721"
-)
-
+# Historical lookup against PMXT Archive, not the live CLOB.
book = poly.fetch_order_book(
-market.market_id,
+"0xc704f74e2f9dfae70f770cb253ffadde10768eeab41233098bf5ac67995a94b5",
params={"since": 1779487200000, "outcome": "yes"},
)
@@ -3330,12 +3332,9 @@ import { Polymarket } from "pmxtjs";
const poly = new Polymarket({ pmxtApiKey: "pmxt_..." });
-const market = await poly.fetchMarket({
- slug: "will-spacex-starship-flight-test-12-launch-by-may-22-354-721",
-});
-
+// Historical lookup against PMXT Archive, not the live CLOB.
const book = await poly.fetchOrderBook(
- market.marketId,
+ "0xc704f74e2f9dfae70f770cb253ffadde10768eeab41233098bf5ac67995a94b5",
undefined,
{ since: 1779487200000, outcome: "yes" }
);
@@ -3346,9 +3345,51 @@ console.log(` best ask: ${Math.min(...book.asks.map((a) => a.price)).toFixed(3)
```bash curl
curl -X POST "https://api.pmxt.dev/api/polymarket/fetchOrderBook" \
- -H "Authorization: Bearer $PMXT_API_KEY" \
+ -H "Authorization: Bearer ***" \
+ -H "Content-Type: application/json" \
+ -d '{"args":["0xc704f74e2f9dfae70f770cb253ffadde10768eeab41233098bf5ac67995a94b5", null, {"since": 1779487200000, "outcome": "yes"}]}'
+```
+
+
+##### Historical crypto 5m events
+
+Polymarket crypto 5-minute slugs such as `btc-updown-5m-1779481500` are event slugs. Use `fetch_event(slug=...)`, then select the nested market you want. Do not use `fetch_market(slug=...)` for these event-level slugs.
+
+
+```python Python
+import pmxt
+
+poly = pmxt.Polymarket(pmxt_api_key="pmxt_...")
+event = poly.fetch_event(slug="btc-updown-5m-1779481500")
+market = event.markets[0]
+
+book = poly.fetch_order_book(
+market.market_id,
+params={"since": 1779487200000, "outcome": "yes"},
+)
+print(f"{market.title}: {book.dt}")
+```
+
+```javascript JavaScript
+import { Polymarket } from "pmxtjs";
+
+const poly = new Polymarket({ pmxtApiKey: "pmxt_..." });
+const event = await poly.fetchEvent({ slug: "btc-updown-5m-1779481500" });
+const market = event.markets[0];
+
+const book = await poly.fetchOrderBook(
+ market.marketId,
+ undefined,
+ { since: 1779487200000, outcome: "yes" }
+);
+console.log(`${market.title}: ${book.datetime}`);
+```
+
+```bash curl
+curl -X POST "https://api.pmxt.dev/api/polymarket/fetchEvent" \
+ -H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
- -d '{"args":["61b0ed20-7f42-41fd-af15-7b86153f6bb7", null, {"since": 1779487200000, "outcome": "yes"}]}'
+ -d '{"kwargs":{"slug":"btc-updown-5m-1779481500"}}'
```
@@ -3356,17 +3397,15 @@ curl -X POST "https://api.pmxt.dev/api/polymarket/fetchOrderBook" \
Pass both `since` and `until` to get an array of fully reconstructed L2 order book snapshots. Each snapshot is a complete book at that moment in time — not deltas.
-Default 100 snapshots per request, max 1000.
+The API returns up to `limit` snapshots from the PMXT Archive. Defaults to 100 snapshots per request, max 1000. For raw bulk downloads, use the Parquet files in the [PMXT Archive](https://archive.pmxt.dev) instead of trying to stream bulk data through the live order book endpoint.
```python Python
import pmxt
poly = pmxt.Polymarket(pmxt_api_key="pmxt_...")
-
-market = poly.fetch_market(
-slug="will-spacex-starship-flight-test-12-launch-by-may-22-354-721"
-)
+event = poly.fetch_event(slug="btc-updown-5m-1779481500")
+market = event.markets[0]
books = poly.fetch_order_book(
market.market_id,
@@ -3374,6 +3413,7 @@ params={
"since": 1779480000000,
"until": 1779487200000,
"outcome": "yes",
+ "limit": 100,
}
)
print(f"{len(books)} snapshots")
@@ -3385,15 +3425,13 @@ print(f" {ob.dt} bid={ob.bids[0].price} ask={ob.asks[0].price}")
import { Polymarket } from "pmxtjs";
const poly = new Polymarket({ pmxtApiKey: "pmxt_..." });
-
-const market = await poly.fetchMarket({
- slug: "will-spacex-starship-flight-test-12-launch-by-may-22-354-721",
-});
+const event = await poly.fetchEvent({ slug: "btc-updown-5m-1779481500" });
+const market = event.markets[0];
const books = await poly.fetchOrderBook(
market.marketId,
undefined,
- { since: 1779480000000, until: 1779487200000, outcome: "yes" }
+ { since: 1779480000000, until: 1779487200000, outcome: "yes", limit: 100 }
);
console.log(`${books.length} snapshots`);
books.slice(0, 3).forEach((ob) =>
@@ -3403,15 +3441,15 @@ books.slice(0, 3).forEach((ob) =>
```bash curl
curl -X POST "https://api.pmxt.dev/api/polymarket/fetchOrderBook" \
- -H "Authorization: Bearer $PMXT_API_KEY" \
+ -H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
- -d '{"args":["61b0ed20-7f42-41fd-af15-7b86153f6bb7", null, {"since": 1779480000000, "until": 1779487200000, "outcome": "yes"}]}'
+ -d '{"args":["0xc704f74e2f9dfae70f770cb253ffadde10768eeab41233098bf5ac67995a94b5", null, {"since": 1779480000000, "until": 1779487200000, "outcome": "yes", "limit": 100}]}'
```
> **Note:**
-Historical order book data is backed by the [PMXT Archive](https://archive.pmxt.dev) — the same tick-level data available as Parquet files, but queryable directly from the API without downloading or parsing files. Supports Polymarket, Kalshi, Limitless, and Opinion.
+Historical order book data is backed by the [PMXT Archive](https://archive.pmxt.dev) — the same tick-level data available as Parquet files, but queryable directly from the API without downloading or parsing files. Historical `fetchOrderBook` supports Polymarket, Kalshi, Limitless, and Opinion.
### Fetch Order Books