pmxt-core 2.27.5 → 2.27.6
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/kalshi/normalizer.d.ts +3 -0
- package/dist/exchanges/kalshi/normalizer.js +57 -23
- package/dist/exchanges/kalshi/utils.js +11 -5
- 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/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- 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-04-
|
|
3
|
+
* Generated at: 2026-04-09T15:36:23.083Z
|
|
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-04-
|
|
6
|
+
* Generated at: 2026-04-09T15:36:23.083Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.kalshiApiSpec = {
|
|
@@ -21,5 +21,8 @@ export declare class KalshiNormalizer implements IExchangeNormalizer<KalshiRawEv
|
|
|
21
21
|
}): Balance[];
|
|
22
22
|
private mapOrderStatus;
|
|
23
23
|
private deriveEventDescription;
|
|
24
|
+
private deriveOutcomeLabel;
|
|
25
|
+
private cleanLabel;
|
|
26
|
+
private templateRule;
|
|
24
27
|
}
|
|
25
28
|
export declare function sortRawEvents(events: any[], sort: string): any[];
|
|
@@ -34,10 +34,7 @@ class KalshiNormalizer {
|
|
|
34
34
|
else if (market.yes_ask) {
|
|
35
35
|
price = (0, price_1.fromKalshiCents)(market.yes_ask);
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
if (market.subtitle || market.yes_sub_title) {
|
|
39
|
-
candidateName = (market.subtitle || market.yes_sub_title);
|
|
40
|
-
}
|
|
37
|
+
const candidateName = this.deriveOutcomeLabel(market);
|
|
41
38
|
let priceChange = 0;
|
|
42
39
|
if (market.previous_price_dollars !== undefined && market.last_price_dollars !== undefined) {
|
|
43
40
|
priceChange = market.last_price_dollars - market.previous_price_dollars;
|
|
@@ -261,27 +258,64 @@ class KalshiNormalizer {
|
|
|
261
258
|
return '';
|
|
262
259
|
if (texts.length === 1)
|
|
263
260
|
return texts[0];
|
|
264
|
-
|
|
265
|
-
for (const
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
261
|
+
const templates = new Map();
|
|
262
|
+
for (const market of markets) {
|
|
263
|
+
const rawRule = typeof market?.rules_primary === 'string' ? market.rules_primary : '';
|
|
264
|
+
if (!rawRule)
|
|
265
|
+
continue;
|
|
266
|
+
const candidate = this.deriveOutcomeLabel(market);
|
|
267
|
+
const templated = this.templateRule(rawRule, candidate);
|
|
268
|
+
templates.set(templated, (templates.get(templated) ?? 0) + 1);
|
|
270
269
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
270
|
+
// Only consider templates that actually contain the {x} placeholder so
|
|
271
|
+
// that a rule we failed to template (e.g. candidate name missing) can
|
|
272
|
+
// never win the vote and leak a specific name into the event description.
|
|
273
|
+
if (templates.size > 0) {
|
|
274
|
+
let bestTemplate = null;
|
|
275
|
+
let bestCount = 0;
|
|
276
|
+
for (const [template, count] of templates.entries()) {
|
|
277
|
+
if (!template.includes('{x}'))
|
|
278
|
+
continue;
|
|
279
|
+
if (count > bestCount) {
|
|
280
|
+
bestTemplate = template;
|
|
281
|
+
bestCount = count;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (bestTemplate)
|
|
285
|
+
return bestTemplate;
|
|
278
286
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
287
|
+
return texts[0];
|
|
288
|
+
}
|
|
289
|
+
deriveOutcomeLabel(market) {
|
|
290
|
+
const yesSubtitle = this.cleanLabel(market.yes_sub_title);
|
|
291
|
+
if (yesSubtitle)
|
|
292
|
+
return yesSubtitle;
|
|
293
|
+
const subtitle = this.cleanLabel(market.subtitle);
|
|
294
|
+
if (subtitle)
|
|
295
|
+
return subtitle;
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
cleanLabel(value) {
|
|
299
|
+
if (typeof value !== 'string')
|
|
300
|
+
return null;
|
|
301
|
+
const trimmed = value.trim();
|
|
302
|
+
if (!trimmed)
|
|
303
|
+
return null;
|
|
304
|
+
// Some Kalshi markets use structural subtitles like ":: Democratic".
|
|
305
|
+
if (trimmed.startsWith('::'))
|
|
306
|
+
return null;
|
|
307
|
+
return trimmed;
|
|
308
|
+
}
|
|
309
|
+
templateRule(rule, candidateName) {
|
|
310
|
+
if (!candidateName)
|
|
311
|
+
return rule;
|
|
312
|
+
const escaped = candidateName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
313
|
+
// Unicode-aware word boundaries so non-ASCII candidate names (Jose,
|
|
314
|
+
// Muller, O'Brien, etc.) still template correctly. JavaScript's \b is
|
|
315
|
+
// ASCII-only and would silently fail on such names.
|
|
316
|
+
const matcher = new RegExp(`(?<![\\p{L}\\p{N}])${escaped}(?![\\p{L}\\p{N}])`, 'gu');
|
|
317
|
+
const replaced = rule.replace(matcher, '{x}');
|
|
318
|
+
return replaced === rule ? rule : replaced;
|
|
285
319
|
}
|
|
286
320
|
}
|
|
287
321
|
exports.KalshiNormalizer = KalshiNormalizer;
|
|
@@ -18,11 +18,17 @@ function mapMarketToUnified(event, market) {
|
|
|
18
18
|
else if (market.yes_ask) {
|
|
19
19
|
price = (0, price_1.fromKalshiCents)(market.yes_ask);
|
|
20
20
|
}
|
|
21
|
-
// Extract candidate name
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
// Extract candidate name. Prefer explicit outcome subtitle and ignore
|
|
22
|
+
// structural labels such as ":: Democratic".
|
|
23
|
+
const cleanLabel = (value) => {
|
|
24
|
+
if (typeof value !== "string")
|
|
25
|
+
return null;
|
|
26
|
+
const trimmed = value.trim();
|
|
27
|
+
if (!trimmed || trimmed.startsWith("::"))
|
|
28
|
+
return null;
|
|
29
|
+
return trimmed;
|
|
30
|
+
};
|
|
31
|
+
const candidateName = cleanLabel(market.yes_sub_title) ?? cleanLabel(market.subtitle);
|
|
26
32
|
// Calculate 24h change
|
|
27
33
|
let priceChange = 0;
|
|
28
34
|
if (market.previous_price_dollars !== undefined &&
|
|
@@ -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-04-
|
|
3
|
+
* Generated at: 2026-04-09T15:36:23.133Z
|
|
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-04-
|
|
6
|
+
* Generated at: 2026-04-09T15:36:23.133Z
|
|
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-04-
|
|
3
|
+
* Generated at: 2026-04-09T15:36:23.142Z
|
|
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-04-
|
|
6
|
+
* Generated at: 2026-04-09T15:36:23.142Z
|
|
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-04-
|
|
3
|
+
* Generated at: 2026-04-09T15:36:23.147Z
|
|
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-04-
|
|
6
|
+
* Generated at: 2026-04-09T15:36:23.147Z
|
|
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-04-
|
|
3
|
+
* Generated at: 2026-04-09T15:36:23.092Z
|
|
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-04-
|
|
6
|
+
* Generated at: 2026-04-09T15:36:23.092Z
|
|
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-04-
|
|
3
|
+
* Generated at: 2026-04-09T15:36:23.112Z
|
|
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-04-
|
|
6
|
+
* Generated at: 2026-04-09T15:36:23.112Z
|
|
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-04-
|
|
3
|
+
* Generated at: 2026-04-09T15:36:23.107Z
|
|
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-04-
|
|
6
|
+
* Generated at: 2026-04-09T15:36:23.107Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.polymarketGammaSpec = {
|
|
@@ -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-04-
|
|
3
|
+
* Generated at: 2026-04-09T15:36:23.137Z
|
|
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-04-
|
|
6
|
+
* Generated at: 2026-04-09T15:36:23.137Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.probableApiSpec = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxt-core",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.6",
|
|
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.27.
|
|
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.27.
|
|
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.27.6,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.27.6,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",
|