pmxt-core 2.48.5 → 2.49.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.js +2 -0
- package/dist/exchanges/baozi/normalizer.js +3 -3
- package/dist/exchanges/gemini-titan/normalizer.js +9 -3
- package/dist/exchanges/gemini-titan/websocket.js +17 -5
- package/dist/exchanges/hyperliquid/normalizer.js +2 -0
- package/dist/exchanges/interfaces.d.ts +2 -2
- package/dist/exchanges/kalshi/api.d.ts +1 -1
- package/dist/exchanges/kalshi/api.js +2 -2
- package/dist/exchanges/kalshi/config.d.ts +6 -6
- package/dist/exchanges/kalshi/config.js +8 -8
- package/dist/exchanges/kalshi/fetcher.d.ts +2 -0
- package/dist/exchanges/kalshi/fetcher.js +6 -7
- package/dist/exchanges/kalshi/normalizer.js +6 -1
- package/dist/exchanges/kalshi/websocket.js +21 -9
- package/dist/exchanges/limitless/api.d.ts +1 -1
- package/dist/exchanges/limitless/api.js +1 -1
- package/dist/exchanges/limitless/client.js +2 -2
- package/dist/exchanges/limitless/config.d.ts +2 -0
- package/dist/exchanges/limitless/config.js +3 -1
- package/dist/exchanges/limitless/fetcher.d.ts +10 -0
- package/dist/exchanges/limitless/fetcher.js +2 -1
- package/dist/exchanges/limitless/index.js +1 -1
- package/dist/exchanges/limitless/utils.js +3 -3
- package/dist/exchanges/limitless/websocket.js +8 -11
- package/dist/exchanges/metaculus/utils.js +0 -1
- package/dist/exchanges/myriad/api.d.ts +1 -1
- package/dist/exchanges/myriad/api.js +17 -2
- package/dist/exchanges/myriad/normalizer.js +10 -5
- package/dist/exchanges/myriad/utils.js +2 -0
- package/dist/exchanges/opinion/api.d.ts +16 -1
- package/dist/exchanges/opinion/api.js +20 -1
- package/dist/exchanges/opinion/normalizer.js +9 -5
- package/dist/exchanges/opinion/utils.d.ts +1 -1
- package/dist/exchanges/opinion/utils.js +3 -1
- package/dist/exchanges/opinion/websocket.js +21 -14
- package/dist/exchanges/polymarket/api-clob.d.ts +13 -1
- package/dist/exchanges/polymarket/api-clob.js +26 -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/auth.js +3 -3
- package/dist/exchanges/polymarket/config.d.ts +1 -0
- package/dist/exchanges/polymarket/config.js +4 -0
- package/dist/exchanges/polymarket/index.js +2 -1
- package/dist/exchanges/polymarket_us/websocket.js +3 -2
- package/dist/exchanges/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- package/dist/exchanges/probable/auth.js +5 -4
- package/dist/exchanges/probable/config.d.ts +2 -0
- package/dist/exchanges/probable/config.js +5 -0
- package/dist/exchanges/probable/websocket.js +2 -1
- package/dist/exchanges/suibets/api.d.ts +1 -1
- package/dist/exchanges/suibets/api.js +1 -1
- package/dist/exchanges/suibets/config.d.ts +1 -1
- package/dist/exchanges/suibets/config.js +2 -2
- package/dist/exchanges/suibets/errors.js +9 -0
- package/dist/exchanges/suibets/fetcher.d.ts +22 -2
- package/dist/exchanges/suibets/fetcher.js +23 -5
- package/dist/exchanges/suibets/index.d.ts +1 -1
- package/dist/exchanges/suibets/index.js +1 -1
- package/dist/exchanges/suibets/normalizer.js +2 -22
- package/dist/feeds/binance/binance-feed.js +6 -3
- package/dist/feeds/chainlink/chainlink-feed.js +5 -2
- package/dist/server/openapi.yaml +5 -2
- package/dist/types.d.ts +5 -2
- package/dist/utils/throttler.js +3 -5
- package/package.json +4 -4
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SuibetsNormalizer = void 0;
|
|
4
|
-
const metadata_1 = require("../../utils/metadata");
|
|
5
4
|
const utils_1 = require("./utils");
|
|
6
|
-
// Raw SuiBets offer fields already promoted to first-class UnifiedMarket columns.
|
|
7
|
-
// Omit these from sourceMetadata to capture only vendor-specific data not
|
|
8
|
-
// represented by the unified shape.
|
|
9
|
-
const SUIBETS_PROMOTED_OFFER_KEYS = [
|
|
10
|
-
'id', 'matchId', 'matchName', 'homeTeam', 'awayTeam',
|
|
11
|
-
'creatorOdds', 'creatorStake', 'remainingStake', 'totalMatched',
|
|
12
|
-
'matchDate', 'expiresAt', 'status', 'onchainOfferId',
|
|
13
|
-
'leagueName', 'sport', 'isOnchain',
|
|
14
|
-
];
|
|
15
|
-
// Raw SuiBets event fields already promoted to first-class UnifiedEvent columns.
|
|
16
|
-
const SUIBETS_PROMOTED_EVENT_KEYS = [
|
|
17
|
-
'id', 'name', 'homeTeam', 'awayTeam', 'sport', 'leagueName', 'offers',
|
|
18
|
-
];
|
|
19
5
|
function liquidity(offer) {
|
|
20
6
|
const remaining = offer.remainingStake ?? offer.creatorStake;
|
|
21
7
|
return (0, utils_1.mistToSui)(remaining);
|
|
@@ -64,16 +50,13 @@ class SuibetsNormalizer {
|
|
|
64
50
|
resolutionDate: new Date(dateSource),
|
|
65
51
|
volume24h,
|
|
66
52
|
liquidity: liq,
|
|
67
|
-
url: 'https://suibets.
|
|
53
|
+
url: 'https://www.suibets.com/p2p',
|
|
68
54
|
status: (0, utils_1.mapStatus)(raw.status),
|
|
69
55
|
category: 'Sports',
|
|
70
56
|
tags: ['Sports', 'P2P', raw.sport, raw.leagueName].filter((t) => Boolean(t)),
|
|
71
57
|
contractAddress: raw.onchainOfferId,
|
|
72
58
|
yes: creatorOutcome,
|
|
73
59
|
no: takerOutcome,
|
|
74
|
-
// Retains creatorWallet, creatorTeam, takerStake, currency \u2014 fields
|
|
75
|
-
// that are vendor-specific and not promoted to any unified column.
|
|
76
|
-
sourceMetadata: (0, metadata_1.buildSourceMetadata)(raw, SUIBETS_PROMOTED_OFFER_KEYS),
|
|
77
60
|
};
|
|
78
61
|
return market;
|
|
79
62
|
}
|
|
@@ -98,12 +81,9 @@ class SuibetsNormalizer {
|
|
|
98
81
|
markets,
|
|
99
82
|
volume24h: totalVolume,
|
|
100
83
|
volume: totalVolume,
|
|
101
|
-
url: 'https://suibets.
|
|
84
|
+
url: 'https://www.suibets.com/p2p',
|
|
102
85
|
category: 'Sports',
|
|
103
86
|
tags: ['Sports', 'P2P', 'Sui', raw.sport, raw.leagueName].filter((t) => Boolean(t)),
|
|
104
|
-
// Retains matchDate and status \u2014 event-level fields not promoted to
|
|
105
|
-
// any first-class UnifiedEvent column.
|
|
106
|
-
sourceMetadata: (0, metadata_1.buildSourceMetadata)(raw, SUIBETS_PROMOTED_EVENT_KEYS),
|
|
107
87
|
};
|
|
108
88
|
}
|
|
109
89
|
normalizePosition(raw) {
|
|
@@ -115,7 +115,7 @@ class BinanceFeed extends base_feed_1.BaseDataFeed {
|
|
|
115
115
|
}
|
|
116
116
|
watchTickerImpl(symbol, callback) {
|
|
117
117
|
const sub = { symbol, callback };
|
|
118
|
-
this.subscriptions
|
|
118
|
+
this.subscriptions.push(sub);
|
|
119
119
|
this.ensureConnected().catch((err) => {
|
|
120
120
|
logger_1.logger.error('[BinanceFeed] initial connect failed in watchTickerImpl', {
|
|
121
121
|
error: err instanceof Error ? err.message : String(err),
|
|
@@ -185,14 +185,17 @@ class BinanceFeed extends base_feed_1.BaseDataFeed {
|
|
|
185
185
|
try {
|
|
186
186
|
msg = JSON.parse(text);
|
|
187
187
|
}
|
|
188
|
-
catch {
|
|
188
|
+
catch (error) {
|
|
189
|
+
logger_1.logger.debug('[BinanceFeed] failed to parse relay message', {
|
|
190
|
+
error: error instanceof Error ? error.message : String(error),
|
|
191
|
+
});
|
|
189
192
|
return;
|
|
190
193
|
}
|
|
191
194
|
if (msg.op !== 'event')
|
|
192
195
|
return;
|
|
193
196
|
const event = msg;
|
|
194
197
|
const ticker = (0, normalizer_1.normalizeTradeToTicker)(event);
|
|
195
|
-
this.latestTickers
|
|
198
|
+
this.latestTickers.set(ticker.symbol, ticker);
|
|
196
199
|
for (const sub of this.subscriptions) {
|
|
197
200
|
if (sub.symbol === ticker.symbol) {
|
|
198
201
|
sub.callback(ticker);
|
|
@@ -139,7 +139,7 @@ class ChainlinkFeed extends base_feed_1.BaseDataFeed {
|
|
|
139
139
|
// -- CCXT: watchTicker --
|
|
140
140
|
watchTickerImpl(symbol, callback) {
|
|
141
141
|
const sub = { symbol: symbol.toUpperCase(), callback };
|
|
142
|
-
this.subscriptions
|
|
142
|
+
this.subscriptions.push(sub);
|
|
143
143
|
this.ensureConnected().catch((err) => {
|
|
144
144
|
logger_1.logger.error('[ChainlinkFeed] initial connect failed in watchTickerImpl', { error: err instanceof Error ? err.message : String(err) });
|
|
145
145
|
});
|
|
@@ -281,7 +281,10 @@ class ChainlinkFeed extends base_feed_1.BaseDataFeed {
|
|
|
281
281
|
try {
|
|
282
282
|
msg = JSON.parse(text);
|
|
283
283
|
}
|
|
284
|
-
catch {
|
|
284
|
+
catch (error) {
|
|
285
|
+
logger_1.logger.debug('[ChainlinkFeed] failed to parse relay message', {
|
|
286
|
+
error: error instanceof Error ? error.message : String(error),
|
|
287
|
+
});
|
|
285
288
|
return;
|
|
286
289
|
}
|
|
287
290
|
if (msg.op !== 'event')
|
package/dist/server/openapi.yaml
CHANGED
|
@@ -2655,7 +2655,9 @@ components:
|
|
|
2655
2655
|
resolutionDate:
|
|
2656
2656
|
type: string
|
|
2657
2657
|
format: date-time
|
|
2658
|
-
description:
|
|
2658
|
+
description: >-
|
|
2659
|
+
When the market is scheduled to resolve. Optional because some venues do not publish a cutoff for every
|
|
2660
|
+
market (e.g. Opinion categorical children) — emit `undefined` rather than coercing to epoch.
|
|
2659
2661
|
volume24h:
|
|
2660
2662
|
type: number
|
|
2661
2663
|
description: Trading volume over the past 24 hours (USD).
|
|
@@ -2728,7 +2730,6 @@ components:
|
|
|
2728
2730
|
- title
|
|
2729
2731
|
- description
|
|
2730
2732
|
- outcomes
|
|
2731
|
-
- resolutionDate
|
|
2732
2733
|
- volume24h
|
|
2733
2734
|
- liquidity
|
|
2734
2735
|
- url
|
|
@@ -2938,6 +2939,8 @@ components:
|
|
|
2938
2939
|
size:
|
|
2939
2940
|
type: number
|
|
2940
2941
|
description: contracts/shares
|
|
2942
|
+
orderCount:
|
|
2943
|
+
type: number
|
|
2941
2944
|
required:
|
|
2942
2945
|
- price
|
|
2943
2946
|
- size
|
package/dist/types.d.ts
CHANGED
|
@@ -55,8 +55,10 @@ export interface UnifiedMarket {
|
|
|
55
55
|
slug?: string;
|
|
56
56
|
/** The possible outcomes for this market. */
|
|
57
57
|
outcomes: MarketOutcome[];
|
|
58
|
-
/** When the market is scheduled to resolve.
|
|
59
|
-
|
|
58
|
+
/** When the market is scheduled to resolve. Optional because some venues
|
|
59
|
+
* do not publish a cutoff for every market (e.g. Opinion categorical
|
|
60
|
+
* children) — emit `undefined` rather than coercing to epoch. */
|
|
61
|
+
resolutionDate?: Date;
|
|
60
62
|
/** Trading volume over the past 24 hours (USD). */
|
|
61
63
|
volume24h: number;
|
|
62
64
|
volume?: number;
|
|
@@ -146,6 +148,7 @@ export interface PriceCandle {
|
|
|
146
148
|
export interface OrderLevel {
|
|
147
149
|
price: number;
|
|
148
150
|
size: number;
|
|
151
|
+
orderCount?: number;
|
|
149
152
|
}
|
|
150
153
|
export interface OrderBook {
|
|
151
154
|
/** Order book bid levels, sorted by price descending. */
|
package/dist/utils/throttler.js
CHANGED
|
@@ -17,12 +17,10 @@ class Throttler {
|
|
|
17
17
|
this.maxQueueDepth = config.maxQueueDepth ?? 1000;
|
|
18
18
|
}
|
|
19
19
|
async throttle(cost = 1) {
|
|
20
|
-
return new Promise((resolve) => {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
21
|
if (this.queue.length >= this.maxQueueDepth) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
dropped.resolve();
|
|
25
|
-
}
|
|
22
|
+
reject(new Error(`Throttler queue full (max depth ${this.maxQueueDepth})`));
|
|
23
|
+
return;
|
|
26
24
|
}
|
|
27
25
|
this.queue.push({ resolve, cost });
|
|
28
26
|
if (!this.running) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxt-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.49.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.49.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.49.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",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@polymarket/clob-client-v2": "^1.0.5",
|
|
51
51
|
"@prob/clob": "0.5.0",
|
|
52
52
|
"@solana/web3.js": "^1.98.4",
|
|
53
|
-
"axios": "^1.
|
|
53
|
+
"axios": "^1.17.0",
|
|
54
54
|
"bs58": "^6.0.0",
|
|
55
55
|
"cors": "^2.8.5",
|
|
56
56
|
"dotenv": "^17.2.3",
|