pmxt-core 2.14.1 → 2.16.0
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/BaseExchange.d.ts +1 -0
- package/dist/exchanges/kalshi/api.d.ts +1 -1
- package/dist/exchanges/kalshi/api.js +1 -1
- package/dist/exchanges/kalshi/utils.js +1 -0
- package/dist/exchanges/limitless/api.d.ts +1 -1
- package/dist/exchanges/limitless/api.js +1 -1
- package/dist/exchanges/limitless/utils.js +1 -0
- package/dist/exchanges/myriad/api.d.ts +1 -1
- package/dist/exchanges/myriad/api.js +1 -1
- package/dist/exchanges/myriad/utils.js +1 -0
- 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/fetchEvents.js +40 -27
- package/dist/exchanges/polymarket/utils.js +1 -0
- package/dist/exchanges/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- package/dist/exchanges/probable/utils.js +1 -0
- package/dist/types.d.ts +1 -0
- package/package.json +3 -3
package/dist/BaseExchange.d.ts
CHANGED
|
@@ -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-02-
|
|
3
|
+
* Generated at: 2026-02-24T09:29:00.308Z
|
|
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-02-
|
|
6
|
+
* Generated at: 2026-02-24T09:29:00.308Z
|
|
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-02-
|
|
3
|
+
* Generated at: 2026-02-24T09:29:00.373Z
|
|
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-02-
|
|
6
|
+
* Generated at: 2026-02-24T09:29:00.373Z
|
|
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-02-
|
|
3
|
+
* Generated at: 2026-02-24T09:29:00.389Z
|
|
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-02-
|
|
6
|
+
* Generated at: 2026-02-24T09:29:00.389Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.myriadApiSpec = {
|
|
@@ -65,6 +65,7 @@ function mapMarketToUnified(market) {
|
|
|
65
65
|
}));
|
|
66
66
|
const um = {
|
|
67
67
|
marketId: `${market.networkId}:${market.id}`,
|
|
68
|
+
eventId: market.questionId ? String(market.questionId) : undefined,
|
|
68
69
|
title: market.title || '',
|
|
69
70
|
description: market.description || '',
|
|
70
71
|
outcomes,
|
|
@@ -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-02-
|
|
3
|
+
* Generated at: 2026-02-24T09:29:00.318Z
|
|
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-02-
|
|
6
|
+
* Generated at: 2026-02-24T09:29:00.318Z
|
|
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-02-
|
|
3
|
+
* Generated at: 2026-02-24T09:29:00.341Z
|
|
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-02-
|
|
6
|
+
* Generated at: 2026-02-24T09:29:00.341Z
|
|
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-02-
|
|
3
|
+
* Generated at: 2026-02-24T09:29:00.337Z
|
|
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-02-
|
|
6
|
+
* Generated at: 2026-02-24T09:29:00.337Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.polymarketGammaSpec = {
|
|
@@ -9,15 +9,51 @@ const utils_1 = require("./utils");
|
|
|
9
9
|
const errors_1 = require("./errors");
|
|
10
10
|
async function fetchEvents(params, http = axios_1.default) {
|
|
11
11
|
try {
|
|
12
|
-
if (!params.query) {
|
|
13
|
-
throw new Error("Query is required for Polymarket event search");
|
|
12
|
+
if (!params.query && !params.eventId && !params.slug) {
|
|
13
|
+
throw new Error("Query, eventId, or slug is required for Polymarket event search");
|
|
14
14
|
}
|
|
15
15
|
const limit = params.limit || 10000;
|
|
16
16
|
const status = params.status || 'active';
|
|
17
|
+
// Helper to map a raw event to a UnifiedEvent
|
|
18
|
+
const mapRawEventToUnified = (event) => {
|
|
19
|
+
const markets = [];
|
|
20
|
+
if (event.markets && Array.isArray(event.markets)) {
|
|
21
|
+
for (const market of event.markets) {
|
|
22
|
+
const unifiedMarket = (0, utils_1.mapMarketToUnified)(event, market, { useQuestionAsCandidateFallback: true });
|
|
23
|
+
if (unifiedMarket) {
|
|
24
|
+
markets.push(unifiedMarket);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
id: event.id || event.slug,
|
|
30
|
+
title: event.title,
|
|
31
|
+
description: event.description || '',
|
|
32
|
+
slug: event.slug,
|
|
33
|
+
markets: markets,
|
|
34
|
+
url: `https://polymarket.com/event/${event.slug}`,
|
|
35
|
+
image: event.image || `https://polymarket.com/api/og?slug=${event.slug}`,
|
|
36
|
+
category: event.category || event.tags?.[0]?.label,
|
|
37
|
+
tags: event.tags?.map((t) => t.label) || []
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
if (params.eventId || params.slug) {
|
|
41
|
+
const queryParams = params.eventId ? { id: params.eventId } : { slug: params.slug };
|
|
42
|
+
const response = await http.get(utils_1.GAMMA_API_URL, { params: queryParams });
|
|
43
|
+
const events = response.data;
|
|
44
|
+
if (!events || events.length === 0)
|
|
45
|
+
return [];
|
|
46
|
+
return events.map(mapRawEventToUnified).slice(0, limit);
|
|
47
|
+
}
|
|
48
|
+
let sortParam = 'volume';
|
|
49
|
+
if (params.sort === 'newest')
|
|
50
|
+
sortParam = 'startDate';
|
|
51
|
+
if (params.sort === 'liquidity')
|
|
52
|
+
sortParam = 'liquidity';
|
|
17
53
|
const queryParams = {
|
|
18
54
|
q: params.query,
|
|
19
55
|
limit_per_type: 50,
|
|
20
|
-
sort:
|
|
56
|
+
sort: sortParam,
|
|
21
57
|
ascending: false
|
|
22
58
|
};
|
|
23
59
|
const fetchWithStatus = async (eventStatus) => {
|
|
@@ -67,30 +103,7 @@ async function fetchEvents(params, http = axios_1.default) {
|
|
|
67
103
|
return descMatch;
|
|
68
104
|
return titleMatch || descMatch; // 'both'
|
|
69
105
|
});
|
|
70
|
-
|
|
71
|
-
const unifiedEvents = filteredEvents.map((event) => {
|
|
72
|
-
const markets = [];
|
|
73
|
-
if (event.markets && Array.isArray(event.markets)) {
|
|
74
|
-
for (const market of event.markets) {
|
|
75
|
-
const unifiedMarket = (0, utils_1.mapMarketToUnified)(event, market, { useQuestionAsCandidateFallback: true });
|
|
76
|
-
if (unifiedMarket) {
|
|
77
|
-
markets.push(unifiedMarket);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const unifiedEvent = {
|
|
82
|
-
id: event.id || event.slug,
|
|
83
|
-
title: event.title,
|
|
84
|
-
description: event.description || '',
|
|
85
|
-
slug: event.slug,
|
|
86
|
-
markets: markets,
|
|
87
|
-
url: `https://polymarket.com/event/${event.slug}`,
|
|
88
|
-
image: event.image || `https://polymarket.com/api/og?slug=${event.slug}`,
|
|
89
|
-
category: event.category || event.tags?.[0]?.label,
|
|
90
|
-
tags: event.tags?.map((t) => t.label) || []
|
|
91
|
-
};
|
|
92
|
-
return unifiedEvent;
|
|
93
|
-
});
|
|
106
|
+
const unifiedEvents = filteredEvents.map(mapRawEventToUnified);
|
|
94
107
|
return unifiedEvents.slice(0, limit);
|
|
95
108
|
}
|
|
96
109
|
catch (error) {
|
|
@@ -76,6 +76,7 @@ function mapMarketToUnified(event, market, options = {}) {
|
|
|
76
76
|
const um = {
|
|
77
77
|
id: market.id,
|
|
78
78
|
marketId: market.id,
|
|
79
|
+
eventId: event.id || event.slug,
|
|
79
80
|
title: market.question ? `${event.title} - ${market.question}` : event.title,
|
|
80
81
|
description: market.description || event.description,
|
|
81
82
|
outcomes: outcomes,
|
|
@@ -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-02-
|
|
3
|
+
* Generated at: 2026-02-24T09:29:00.381Z
|
|
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-02-
|
|
6
|
+
* Generated at: 2026-02-24T09:29:00.381Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.probableApiSpec = {
|
|
@@ -29,6 +29,7 @@ function mapMarketToUnified(market, event) {
|
|
|
29
29
|
}
|
|
30
30
|
const um = {
|
|
31
31
|
marketId: String(market.id),
|
|
32
|
+
eventId: event ? String(event.id) : (market.event_id ? String(market.event_id) : undefined),
|
|
32
33
|
title: market.question || market.title || '',
|
|
33
34
|
description: market.description || '',
|
|
34
35
|
outcomes,
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxt-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0",
|
|
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.
|
|
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.
|
|
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.16.0,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.16.0,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",
|