pmxt-core 2.42.4 → 2.42.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exchanges/kalshi/api.d.ts +1 -1
- package/dist/exchanges/kalshi/api.js +1 -1
- package/dist/exchanges/limitless/api.d.ts +1 -1
- package/dist/exchanges/limitless/api.js +1 -1
- package/dist/exchanges/myriad/api.d.ts +1 -1
- package/dist/exchanges/myriad/api.js +1 -1
- package/dist/exchanges/opinion/api.d.ts +1 -1
- package/dist/exchanges/opinion/api.js +1 -1
- package/dist/exchanges/polymarket/api-clob.d.ts +1 -1
- package/dist/exchanges/polymarket/api-clob.js +1 -1
- package/dist/exchanges/polymarket/api-data.d.ts +1 -1
- package/dist/exchanges/polymarket/api-data.js +1 -1
- package/dist/exchanges/polymarket/api-gamma.d.ts +1 -1
- package/dist/exchanges/polymarket/api-gamma.js +1 -1
- package/dist/exchanges/polymarket/utils.d.ts +2 -1
- package/dist/exchanges/polymarket/utils.js +16 -7
- package/dist/exchanges/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- package/dist/server/openapi.yaml +78 -0
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/kalshi/Kalshi.yaml
|
|
3
|
-
* Generated at: 2026-05-
|
|
3
|
+
* Generated at: 2026-05-22T13:35:19.499Z
|
|
4
4
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
5
5
|
*/
|
|
6
6
|
export declare const kalshiApiSpec: {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.kalshiApiSpec = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/kalshi/Kalshi.yaml
|
|
6
|
-
* Generated at: 2026-05-
|
|
6
|
+
* Generated at: 2026-05-22T13:35:19.499Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.kalshiApiSpec = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/limitless/Limitless.yaml
|
|
3
|
-
* Generated at: 2026-05-
|
|
3
|
+
* Generated at: 2026-05-22T13:35:19.536Z
|
|
4
4
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
5
5
|
*/
|
|
6
6
|
export declare const limitlessApiSpec: {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.limitlessApiSpec = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/limitless/Limitless.yaml
|
|
6
|
-
* Generated at: 2026-05-
|
|
6
|
+
* Generated at: 2026-05-22T13:35:19.536Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.limitlessApiSpec = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/myriad/myriad.yaml
|
|
3
|
-
* Generated at: 2026-05-
|
|
3
|
+
* Generated at: 2026-05-22T13:35:19.548Z
|
|
4
4
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
5
5
|
*/
|
|
6
6
|
export declare const myriadApiSpec: {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.myriadApiSpec = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/myriad/myriad.yaml
|
|
6
|
-
* Generated at: 2026-05-
|
|
6
|
+
* Generated at: 2026-05-22T13:35:19.548Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.myriadApiSpec = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/opinion/opinion-openapi.yaml
|
|
3
|
-
* Generated at: 2026-05-
|
|
3
|
+
* Generated at: 2026-05-22T13:35:19.553Z
|
|
4
4
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
5
5
|
*/
|
|
6
6
|
export declare const opinionApiSpec: {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.opinionApiSpec = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/opinion/opinion-openapi.yaml
|
|
6
|
-
* Generated at: 2026-05-
|
|
6
|
+
* Generated at: 2026-05-22T13:35:19.553Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.opinionApiSpec = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketClobAPI.yaml
|
|
3
|
-
* Generated at: 2026-05-
|
|
3
|
+
* Generated at: 2026-05-22T13:35:19.506Z
|
|
4
4
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
5
5
|
*/
|
|
6
6
|
export declare const polymarketClobSpec: {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.polymarketClobSpec = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketClobAPI.yaml
|
|
6
|
-
* Generated at: 2026-05-
|
|
6
|
+
* Generated at: 2026-05-22T13:35:19.506Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.polymarketClobSpec = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/Polymarket_Data_API.yaml
|
|
3
|
-
* Generated at: 2026-05-
|
|
3
|
+
* Generated at: 2026-05-22T13:35:19.518Z
|
|
4
4
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
5
5
|
*/
|
|
6
6
|
export declare const polymarketDataSpec: {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.polymarketDataSpec = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/Polymarket_Data_API.yaml
|
|
6
|
-
* Generated at: 2026-05-
|
|
6
|
+
* Generated at: 2026-05-22T13:35:19.518Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.polymarketDataSpec = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketGammaAPI.yaml
|
|
3
|
-
* Generated at: 2026-05-
|
|
3
|
+
* Generated at: 2026-05-22T13:35:19.516Z
|
|
4
4
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
5
5
|
*/
|
|
6
6
|
export declare const polymarketGammaSpec: {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.polymarketGammaSpec = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/polymarket/PolymarketGammaAPI.yaml
|
|
6
|
-
* Generated at: 2026-05-
|
|
6
|
+
* Generated at: 2026-05-22T13:35:19.516Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.polymarketGammaSpec = {
|
|
@@ -9,7 +9,8 @@ export declare function mapMarketToUnified(event: any, market: any, options?: {
|
|
|
9
9
|
export declare function mapIntervalToFidelity(interval: CandleInterval): number;
|
|
10
10
|
/**
|
|
11
11
|
* Fetch all results from Gamma API using parallel pagination for best DX.
|
|
12
|
-
* Polymarket Gamma API
|
|
12
|
+
* Polymarket Gamma API silently clamps responses to 100 items per request
|
|
13
|
+
* and rejects offsets above 10,000.
|
|
13
14
|
*/
|
|
14
15
|
export declare function paginateParallel(url: string, params: any, http: any, maxResults?: number): Promise<any[]>;
|
|
15
16
|
/**
|
|
@@ -18,8 +18,11 @@ function mapMarketToUnified(event, market, options = {}) {
|
|
|
18
18
|
let outcomeLabels = [];
|
|
19
19
|
let outcomePrices = [];
|
|
20
20
|
try {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
// Polymarket returns "null" (string) for resolved markets whose prices
|
|
22
|
+
// have been cleared. JSON.parse("null") returns JS null, which bypasses
|
|
23
|
+
// the || [] fallback, so we null-coalesce after parsing.
|
|
24
|
+
outcomeLabels = (typeof market.outcomes === 'string' ? JSON.parse(market.outcomes) : market.outcomes) || [];
|
|
25
|
+
outcomePrices = (typeof market.outcomePrices === 'string' ? JSON.parse(market.outcomePrices) : market.outcomePrices) || [];
|
|
23
26
|
}
|
|
24
27
|
catch (e) {
|
|
25
28
|
console.warn(`Error parsing outcomes for market ${market.id}:`, e);
|
|
@@ -27,7 +30,7 @@ function mapMarketToUnified(event, market, options = {}) {
|
|
|
27
30
|
// Extract CLOB token IDs for granular operations
|
|
28
31
|
let clobTokenIds = [];
|
|
29
32
|
try {
|
|
30
|
-
clobTokenIds = typeof market.clobTokenIds === 'string' ? JSON.parse(market.clobTokenIds) :
|
|
33
|
+
clobTokenIds = (typeof market.clobTokenIds === 'string' ? JSON.parse(market.clobTokenIds) : market.clobTokenIds) || [];
|
|
31
34
|
}
|
|
32
35
|
catch (e) {
|
|
33
36
|
console.warn(`Error parsing clobTokenIds for market ${market.id}:`, e);
|
|
@@ -122,10 +125,11 @@ function mapIntervalToFidelity(interval) {
|
|
|
122
125
|
}
|
|
123
126
|
/**
|
|
124
127
|
* Fetch all results from Gamma API using parallel pagination for best DX.
|
|
125
|
-
* Polymarket Gamma API
|
|
128
|
+
* Polymarket Gamma API silently clamps responses to 100 items per request
|
|
129
|
+
* and rejects offsets above 10,000.
|
|
126
130
|
*/
|
|
127
131
|
async function paginateParallel(url, params, http, maxResults = 10000) {
|
|
128
|
-
const PAGE_SIZE =
|
|
132
|
+
const PAGE_SIZE = 100;
|
|
129
133
|
const initialLimit = Math.min(params.limit || PAGE_SIZE, PAGE_SIZE);
|
|
130
134
|
// 1. Fetch the first page to see if we even need more
|
|
131
135
|
const firstPageResponse = await http.get(url, {
|
|
@@ -137,11 +141,16 @@ async function paginateParallel(url, params, http, maxResults = 10000) {
|
|
|
137
141
|
return firstPage;
|
|
138
142
|
}
|
|
139
143
|
// 2. Determine how many more pages to fetch
|
|
140
|
-
|
|
144
|
+
// Gamma rejects offsets above 10,000, so cap enumerable results at ~10,100.
|
|
145
|
+
const MAX_OFFSET = 10000;
|
|
146
|
+
const targetLimit = Math.min(params.limit || maxResults, MAX_OFFSET + PAGE_SIZE);
|
|
141
147
|
const numPages = Math.ceil(targetLimit / PAGE_SIZE);
|
|
142
148
|
const offsets = [];
|
|
143
149
|
for (let i = 1; i < numPages; i++) {
|
|
144
|
-
|
|
150
|
+
const offset = i * PAGE_SIZE;
|
|
151
|
+
if (offset > MAX_OFFSET)
|
|
152
|
+
break;
|
|
153
|
+
offsets.push(offset);
|
|
145
154
|
}
|
|
146
155
|
// 3. Fetch remaining pages in parallel
|
|
147
156
|
const remainingPages = await Promise.all(offsets.map(async (offset) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/probable/probable.yaml
|
|
3
|
-
* Generated at: 2026-05-
|
|
3
|
+
* Generated at: 2026-05-22T13:35:19.540Z
|
|
4
4
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
5
5
|
*/
|
|
6
6
|
export declare const probableApiSpec: {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.probableApiSpec = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Auto-generated from /home/runner/work/pmxt/pmxt/core/specs/probable/probable.yaml
|
|
6
|
-
* Generated at: 2026-05-
|
|
6
|
+
* Generated at: 2026-05-22T13:35:19.540Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.probableApiSpec = {
|
package/dist/server/openapi.yaml
CHANGED
|
@@ -2376,6 +2376,84 @@ paths:
|
|
|
2376
2376
|
$ref: '#/components/schemas/FeedTicker'
|
|
2377
2377
|
tags:
|
|
2378
2378
|
- Data Feeds
|
|
2379
|
+
'/api/feeds/{feed}/watchTicker':
|
|
2380
|
+
get:
|
|
2381
|
+
summary: Watch Ticker (WebSocket)
|
|
2382
|
+
operationId: feedWatchTicker
|
|
2383
|
+
description: >-
|
|
2384
|
+
Stream live ticker updates for a symbol via WebSocket.
|
|
2385
|
+
|
|
2386
|
+
|
|
2387
|
+
**Transport:** WebSocket
|
|
2388
|
+
|
|
2389
|
+
|
|
2390
|
+
| Environment | URL |
|
|
2391
|
+
|
|
2392
|
+
|---|---|
|
|
2393
|
+
|
|
2394
|
+
| Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` |
|
|
2395
|
+
|
|
2396
|
+
|
|
2397
|
+
**Subscribe:**
|
|
2398
|
+
|
|
2399
|
+
```json
|
|
2400
|
+
|
|
2401
|
+
{ "id": "btc-stream", "action": "subscribe", "method": "watchTicker", "args": ["BTC/USDT"], "feed": "binance" }
|
|
2402
|
+
|
|
2403
|
+
```
|
|
2404
|
+
|
|
2405
|
+
|
|
2406
|
+
**Server response:**
|
|
2407
|
+
|
|
2408
|
+
```json
|
|
2409
|
+
|
|
2410
|
+
{ "event": "data", "id": "btc-stream", "method": "watchTicker", "symbol": "BTC/USDT", "source": "binance",
|
|
2411
|
+
"data": { "symbol": "BTC/USDT", "last": 76949.16, "timestamp": 1716148800000, ... } }
|
|
2412
|
+
|
|
2413
|
+
```
|
|
2414
|
+
|
|
2415
|
+
|
|
2416
|
+
**Unsubscribe:**
|
|
2417
|
+
|
|
2418
|
+
```json
|
|
2419
|
+
|
|
2420
|
+
{ "id": "btc-stream", "action": "unsubscribe" }
|
|
2421
|
+
|
|
2422
|
+
```
|
|
2423
|
+
|
|
2424
|
+
|
|
2425
|
+
Currently supports Binance feeds only. Tickers stream as they arrive from the Binance trade relay.
|
|
2426
|
+
parameters:
|
|
2427
|
+
- in: path
|
|
2428
|
+
name: feed
|
|
2429
|
+
schema:
|
|
2430
|
+
type: string
|
|
2431
|
+
enum:
|
|
2432
|
+
- binance
|
|
2433
|
+
- chainlink
|
|
2434
|
+
required: true
|
|
2435
|
+
description: The data feed provider.
|
|
2436
|
+
- in: query
|
|
2437
|
+
name: symbol
|
|
2438
|
+
required: true
|
|
2439
|
+
schema:
|
|
2440
|
+
type: string
|
|
2441
|
+
description: Trading pair to stream (e.g. BTC/USDT)
|
|
2442
|
+
responses:
|
|
2443
|
+
'200':
|
|
2444
|
+
description: Successful response
|
|
2445
|
+
content:
|
|
2446
|
+
application/json:
|
|
2447
|
+
schema:
|
|
2448
|
+
type: object
|
|
2449
|
+
properties:
|
|
2450
|
+
success:
|
|
2451
|
+
type: boolean
|
|
2452
|
+
example: true
|
|
2453
|
+
data:
|
|
2454
|
+
$ref: '#/components/schemas/FeedTicker'
|
|
2455
|
+
tags:
|
|
2456
|
+
- Data Feeds
|
|
2379
2457
|
components:
|
|
2380
2458
|
parameters:
|
|
2381
2459
|
ExchangeParam:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxt-core",
|
|
3
|
-
"version": "2.42.
|
|
3
|
+
"version": "2.42.7",
|
|
4
4
|
"description": "pmxt is a unified prediction market data API. The ccxt for prediction markets.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"test": "jest -c jest.config.js",
|
|
30
30
|
"server": "tsx watch src/server/index.ts",
|
|
31
31
|
"server:prod": "node dist/server/index.js",
|
|
32
|
-
"generate:sdk:python": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g python -o ../sdks/python/generated --package-name pmxt_internal --additional-properties=projectName=pmxt-internal,packageVersion=2.42.
|
|
33
|
-
"generate:sdk:typescript": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g typescript-fetch -o ../sdks/typescript/generated --additional-properties=npmName=pmxtjs,npmVersion=2.42.
|
|
32
|
+
"generate:sdk:python": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g python -o ../sdks/python/generated --package-name pmxt_internal --additional-properties=projectName=pmxt-internal,packageVersion=2.42.7,library=urllib3",
|
|
33
|
+
"generate:sdk:typescript": "npx @openapitools/openapi-generator-cli generate -i src/server/openapi.yaml -g typescript-fetch -o ../sdks/typescript/generated --additional-properties=npmName=pmxtjs,npmVersion=2.42.7,supportsES6=true,typescriptThreePlus=true && node ../sdks/typescript/scripts/fix-generated.js",
|
|
34
34
|
"fetch:openapi": "node scripts/fetch-openapi-specs.js",
|
|
35
35
|
"extract:jsdoc": "node ../scripts/extract-jsdoc.js",
|
|
36
36
|
"generate:docs": "npm run extract:jsdoc && node ../scripts/generate-api-docs.js",
|