pmxt-core 2.48.1 → 2.48.3
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 +1 -0
- package/dist/exchanges/kalshi/normalizer.js +33 -1
- package/dist/exchanges/limitless/api.d.ts +1 -1
- package/dist/exchanges/limitless/api.js +1 -1
- package/dist/exchanges/limitless/client.js +2 -1
- package/dist/exchanges/limitless/index.js +1 -1
- package/dist/exchanges/limitless/utils.d.ts +4 -0
- package/dist/exchanges/limitless/utils.js +18 -0
- 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/dist/utils/market-utils.js +2 -2
- 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-
|
|
3
|
+
* Generated at: 2026-06-01T13:55:44.662Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T13:55:44.662Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.kalshiApiSpec = {
|
|
@@ -24,6 +24,7 @@ export declare class KalshiNormalizer implements IExchangeNormalizer<KalshiRawEv
|
|
|
24
24
|
private deriveEventDescription;
|
|
25
25
|
private deriveEventTitle;
|
|
26
26
|
private shouldUseSeriesTitle;
|
|
27
|
+
private extractTickerTail;
|
|
27
28
|
private deriveCommonEventTitle;
|
|
28
29
|
private extractEventTitleFromMarketTitle;
|
|
29
30
|
private composeSeriesTitle;
|
|
@@ -361,14 +361,46 @@ class KalshiNormalizer {
|
|
|
361
361
|
return false;
|
|
362
362
|
const normalizedTitle = this.normalizeTitleText(rawTitle);
|
|
363
363
|
const containedLabels = new Set();
|
|
364
|
-
|
|
364
|
+
const addIfContained = (label) => {
|
|
365
|
+
if (!label)
|
|
366
|
+
return;
|
|
365
367
|
const normalizedLabel = this.normalizeTitleText(label);
|
|
366
368
|
if (normalizedLabel && normalizedTitle.includes(normalizedLabel)) {
|
|
367
369
|
containedLabels.add(normalizedLabel);
|
|
368
370
|
}
|
|
371
|
+
};
|
|
372
|
+
for (const label of candidateLabels) {
|
|
373
|
+
addIfContained(label);
|
|
374
|
+
}
|
|
375
|
+
// Sub-market tickers often carry the outcome's short identifier or
|
|
376
|
+
// abbreviation (e.g. KXUCL-26-PSG for "Paris Saint-Germain"). Title
|
|
377
|
+
// contamination commonly uses these abbreviations ("PSG vs Arsenal")
|
|
378
|
+
// rather than the full outcome label, so count ticker tails as
|
|
379
|
+
// additional candidate matches.
|
|
380
|
+
const tickerPrefix = typeof event.event_ticker === 'string' ? event.event_ticker : '';
|
|
381
|
+
for (const market of markets) {
|
|
382
|
+
const tail = this.extractTickerTail(market.ticker, tickerPrefix);
|
|
383
|
+
if (tail && tail.length >= 3) {
|
|
384
|
+
addIfContained(tail);
|
|
385
|
+
}
|
|
369
386
|
}
|
|
370
387
|
return containedLabels.size >= 2;
|
|
371
388
|
}
|
|
389
|
+
extractTickerTail(ticker, eventTicker) {
|
|
390
|
+
if (typeof ticker !== 'string' || !ticker)
|
|
391
|
+
return null;
|
|
392
|
+
let tail = ticker;
|
|
393
|
+
if (eventTicker && tail.startsWith(eventTicker)) {
|
|
394
|
+
tail = tail.slice(eventTicker.length);
|
|
395
|
+
}
|
|
396
|
+
// Strip any leading separators left over from the event_ticker prefix
|
|
397
|
+
// and take the last dash-separated segment as the outcome identifier.
|
|
398
|
+
tail = tail.replace(/^[-_:]+/, '');
|
|
399
|
+
const segments = tail.split(/[-_]/).filter((s) => s.length > 0);
|
|
400
|
+
if (segments.length === 0)
|
|
401
|
+
return null;
|
|
402
|
+
return segments[segments.length - 1];
|
|
403
|
+
}
|
|
372
404
|
deriveCommonEventTitle(event, markets) {
|
|
373
405
|
const eventTitlePrefix = this.extractEventTitlePrefix(event.title);
|
|
374
406
|
if (eventTitlePrefix) {
|
|
@@ -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-
|
|
3
|
+
* Generated at: 2026-06-01T13:55:44.697Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T13:55:44.697Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.limitlessApiSpec = {
|
|
@@ -4,6 +4,7 @@ exports.LimitlessClient = void 0;
|
|
|
4
4
|
const sdk_1 = require("@limitless-exchange/sdk");
|
|
5
5
|
const ethers_1 = require("ethers");
|
|
6
6
|
const config_1 = require("./config");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
7
8
|
const DEFAULT_LIMITLESS_API_URL = process.env.LIMITLESS_BASE_URL || 'https://api.limitless.exchange';
|
|
8
9
|
/**
|
|
9
10
|
* Wrapper client for Limitless Exchange using the official SDK.
|
|
@@ -315,7 +316,7 @@ class LimitlessClient {
|
|
|
315
316
|
}
|
|
316
317
|
const balance = await contract.balanceOf(this.signer.address);
|
|
317
318
|
const decimals = await contract.decimals(); // Should be 6
|
|
318
|
-
return
|
|
319
|
+
return (0, utils_1.scaledIntegerToNumber)(balance, Number(decimals));
|
|
319
320
|
}
|
|
320
321
|
}
|
|
321
322
|
exports.LimitlessClient = LimitlessClient;
|
|
@@ -510,7 +510,7 @@ class LimitlessExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
510
510
|
const usdcContract = new ethers_1.Contract(usdcAddress, ['function balanceOf(address) view returns (uint256)'], provider);
|
|
511
511
|
const rawBalance = await usdcContract.balanceOf(targetAddress);
|
|
512
512
|
const USDC_DECIMALS = 6;
|
|
513
|
-
const total =
|
|
513
|
+
const total = (0, utils_1.scaledIntegerToNumber)(rawBalance, USDC_DECIMALS);
|
|
514
514
|
return [{
|
|
515
515
|
currency: 'USDC',
|
|
516
516
|
total,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { UnifiedMarket, CandleInterval } from '../../types';
|
|
2
2
|
export declare const DEFAULT_LIMITLESS_API_URL = "https://api.limitless.exchange";
|
|
3
|
+
export declare function scaledIntegerToNumber(value: bigint | {
|
|
4
|
+
toBigInt?: () => bigint;
|
|
5
|
+
toString(): string;
|
|
6
|
+
}, decimals: number): number;
|
|
3
7
|
export interface LimitlessMarketContext {
|
|
4
8
|
eventId?: string;
|
|
5
9
|
eventTitle?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_LIMITLESS_API_URL = void 0;
|
|
4
|
+
exports.scaledIntegerToNumber = scaledIntegerToNumber;
|
|
4
5
|
exports.mapMarketToUnified = mapMarketToUnified;
|
|
5
6
|
exports.mapIntervalToFidelity = mapIntervalToFidelity;
|
|
6
7
|
exports.paginateLimitlessMarkets = paginateLimitlessMarkets;
|
|
@@ -22,6 +23,23 @@ const LIMITLESS_PROMOTED_MARKET_KEYS = [
|
|
|
22
23
|
'__pmxtEventId', '__pmxtEventTitle', '__pmxtEventDescription',
|
|
23
24
|
'__pmxtCategories', '__pmxtTags',
|
|
24
25
|
];
|
|
26
|
+
function scaledIntegerToNumber(value, decimals) {
|
|
27
|
+
if (!Number.isInteger(decimals) || decimals < 0) {
|
|
28
|
+
throw new Error(`[limitless] Invalid token decimals: ${decimals}`);
|
|
29
|
+
}
|
|
30
|
+
const raw = typeof value === 'bigint'
|
|
31
|
+
? value
|
|
32
|
+
: typeof value.toBigInt === 'function'
|
|
33
|
+
? value.toBigInt()
|
|
34
|
+
: BigInt(value.toString());
|
|
35
|
+
const sign = raw < 0n ? -1 : 1;
|
|
36
|
+
const abs = raw < 0n ? -raw : raw;
|
|
37
|
+
const scale = 10n ** BigInt(decimals);
|
|
38
|
+
const whole = abs / scale;
|
|
39
|
+
const fraction = abs % scale;
|
|
40
|
+
const amount = Number(whole) + (Number(fraction) / Number(scale));
|
|
41
|
+
return sign * amount;
|
|
42
|
+
}
|
|
25
43
|
function mapMarketToUnified(market, context = {}) {
|
|
26
44
|
if (!market)
|
|
27
45
|
return null;
|
|
@@ -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-
|
|
3
|
+
* Generated at: 2026-06-01T13:55:44.709Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T13:55:44.709Z
|
|
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-
|
|
3
|
+
* Generated at: 2026-06-01T13:55:44.714Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T13:55:44.714Z
|
|
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-
|
|
3
|
+
* Generated at: 2026-06-01T13:55:44.668Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T13:55:44.668Z
|
|
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-
|
|
3
|
+
* Generated at: 2026-06-01T13:55:44.680Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T13:55:44.680Z
|
|
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-
|
|
3
|
+
* Generated at: 2026-06-01T13:55:44.678Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T13:55:44.678Z
|
|
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-
|
|
3
|
+
* Generated at: 2026-06-01T13:55:44.702Z
|
|
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-
|
|
6
|
+
* Generated at: 2026-06-01T13:55:44.702Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.probableApiSpec = {
|
|
@@ -47,10 +47,10 @@ function addBinaryOutcomes(market) {
|
|
|
47
47
|
const yesLabel = market.yes?.label.toLowerCase();
|
|
48
48
|
const noLabel = market.no?.label.toLowerCase();
|
|
49
49
|
if (market.title && market.yes && yesLabel === 'yes') {
|
|
50
|
-
market.yes =
|
|
50
|
+
market.yes.label = market.title;
|
|
51
51
|
}
|
|
52
52
|
if (market.title && market.no && noLabel === 'no') {
|
|
53
|
-
market.no =
|
|
53
|
+
market.no.label = `Not ${market.title}`;
|
|
54
54
|
}
|
|
55
55
|
market.up = market.yes;
|
|
56
56
|
market.down = market.no;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxt-core",
|
|
3
|
-
"version": "2.48.
|
|
3
|
+
"version": "2.48.3",
|
|
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.48.
|
|
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.48.
|
|
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.48.3,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.48.3,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",
|