pmxt-core 2.41.3 → 2.41.4
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/websocket.js +5 -3
- 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/myriad/auth.js +7 -6
- package/dist/exchanges/myriad/index.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/websocket.d.ts +6 -3
- package/dist/exchanges/polymarket/websocket.js +79 -64
- package/dist/exchanges/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- package/dist/server/openapi.yaml +0 -319
- 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-15T20:14:37.286Z
|
|
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-15T20:14:37.286Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.kalshiApiSpec = {
|
|
@@ -341,10 +341,12 @@ class KalshiWebSocket {
|
|
|
341
341
|
const trade = {
|
|
342
342
|
id: data.trade_id || `${timestamp}-${Math.random()}`,
|
|
343
343
|
timestamp,
|
|
344
|
-
price: data.
|
|
345
|
-
? (data.
|
|
344
|
+
price: data.yes_price_dollars != null
|
|
345
|
+
? parseFloat(data.yes_price_dollars)
|
|
346
346
|
: 0.5,
|
|
347
|
-
amount: data.
|
|
347
|
+
amount: data.count_fp != null
|
|
348
|
+
? parseFloat(data.count_fp)
|
|
349
|
+
: 0,
|
|
348
350
|
side: data.taker_side === "yes" || data.side === "buy"
|
|
349
351
|
? "buy"
|
|
350
352
|
: data.taker_side === "no" || data.side === "sell"
|
|
@@ -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-15T20:14:37.326Z
|
|
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-15T20:14:37.326Z
|
|
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-15T20:14:37.339Z
|
|
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-15T20:14:37.339Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.myriadApiSpec = {
|
|
@@ -8,15 +8,16 @@ class MyriadAuth {
|
|
|
8
8
|
this.validateCredentials();
|
|
9
9
|
}
|
|
10
10
|
validateCredentials() {
|
|
11
|
-
if (!this.credentials.apiKey) {
|
|
12
|
-
throw new Error('Myriad requires an apiKey for authentication');
|
|
11
|
+
if (!this.credentials.apiKey && !this.credentials.privateKey) {
|
|
12
|
+
throw new Error('Myriad requires an apiKey or privateKey for authentication');
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
getHeaders() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
'
|
|
19
|
-
}
|
|
16
|
+
const headers = { 'Content-Type': 'application/json' };
|
|
17
|
+
if (this.credentials.apiKey) {
|
|
18
|
+
headers['x-api-key'] = this.credentials.apiKey;
|
|
19
|
+
}
|
|
20
|
+
return headers;
|
|
20
21
|
}
|
|
21
22
|
get walletAddress() {
|
|
22
23
|
return this.credentials.privateKey;
|
|
@@ -29,7 +29,7 @@ class MyriadExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
29
29
|
constructor(credentials) {
|
|
30
30
|
super(credentials);
|
|
31
31
|
this.rateLimit = 500;
|
|
32
|
-
if (credentials?.apiKey) {
|
|
32
|
+
if (credentials?.apiKey || credentials?.privateKey) {
|
|
33
33
|
this.auth = new auth_1.MyriadAuth(credentials);
|
|
34
34
|
}
|
|
35
35
|
const myriadBaseUrl = credentials?.baseUrl || utils_1.DEFAULT_BASE_URL;
|
|
@@ -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-15T20:14:37.344Z
|
|
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-15T20:14:37.344Z
|
|
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-15T20:14:37.291Z
|
|
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-15T20:14:37.291Z
|
|
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-15T20:14:37.308Z
|
|
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-15T20:14:37.308Z
|
|
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-15T20:14:37.304Z
|
|
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-15T20:14:37.304Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.polymarketGammaSpec = {
|
|
@@ -49,14 +49,16 @@ export interface PolymarketWebSocketConfig {
|
|
|
49
49
|
userChannelCreds?: PolymarketUserChannelCreds;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
52
|
+
* Native WebSocket implementation for Polymarket market data.
|
|
53
|
+
* Replaces the @nevuamarkets/poly-websockets dependency.
|
|
54
54
|
*/
|
|
55
55
|
export declare class PolymarketWebSocket {
|
|
56
|
-
private
|
|
56
|
+
private ws;
|
|
57
|
+
private subscribedAssets;
|
|
57
58
|
private readonly watcher;
|
|
58
59
|
private orderBookResolvers;
|
|
59
60
|
private tradeResolvers;
|
|
61
|
+
private pendingTrades;
|
|
60
62
|
private orderBooks;
|
|
61
63
|
private config;
|
|
62
64
|
private initializationPromise?;
|
|
@@ -88,6 +90,7 @@ export declare class PolymarketWebSocket {
|
|
|
88
90
|
private scheduleUserReconnect;
|
|
89
91
|
private closeUserChannel;
|
|
90
92
|
close(): Promise<void>;
|
|
93
|
+
private subscribe;
|
|
91
94
|
private ensureInitialized;
|
|
92
95
|
private handleBookSnapshot;
|
|
93
96
|
private handlePriceChange;
|
|
@@ -44,15 +44,18 @@ exports.PolymarketWebSocket = void 0;
|
|
|
44
44
|
const goldsky_1 = require("../../subscriber/external/goldsky");
|
|
45
45
|
const watcher_1 = require("../../subscriber/watcher");
|
|
46
46
|
const watch_timeout_1 = require("../../utils/watch-timeout");
|
|
47
|
+
const POLYMARKET_MARKET_WS_URL = 'wss://ws-subscriptions-clob.polymarket.com/ws/market';
|
|
47
48
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
49
|
+
* Native WebSocket implementation for Polymarket market data.
|
|
50
|
+
* Replaces the @nevuamarkets/poly-websockets dependency.
|
|
50
51
|
*/
|
|
51
52
|
class PolymarketWebSocket {
|
|
52
|
-
|
|
53
|
+
ws;
|
|
54
|
+
subscribedAssets = new Set();
|
|
53
55
|
watcher;
|
|
54
56
|
orderBookResolvers = new Map();
|
|
55
57
|
tradeResolvers = new Map();
|
|
58
|
+
pendingTrades = new Map();
|
|
56
59
|
orderBooks = new Map();
|
|
57
60
|
config;
|
|
58
61
|
initializationPromise;
|
|
@@ -70,11 +73,7 @@ class PolymarketWebSocket {
|
|
|
70
73
|
}
|
|
71
74
|
async watchOrderBook(outcomeId) {
|
|
72
75
|
await this.ensureInitialized();
|
|
73
|
-
|
|
74
|
-
const currentAssets = this.manager.getAssetIds();
|
|
75
|
-
if (!currentAssets.includes(outcomeId)) {
|
|
76
|
-
await this.manager.addSubscriptions([outcomeId]);
|
|
77
|
-
}
|
|
76
|
+
await this.subscribe([outcomeId]);
|
|
78
77
|
// Return a promise that resolves on the next orderbook update
|
|
79
78
|
const dataPromise = new Promise((resolve, reject) => {
|
|
80
79
|
if (!this.orderBookResolvers.has(outcomeId)) {
|
|
@@ -85,10 +84,7 @@ class PolymarketWebSocket {
|
|
|
85
84
|
return (0, watch_timeout_1.withWatchTimeout)(dataPromise, this.config.watchTimeoutMs ?? watch_timeout_1.DEFAULT_WATCH_TIMEOUT_MS, `watchOrderBook('${outcomeId}')`);
|
|
86
85
|
}
|
|
87
86
|
async unwatchOrderBook(outcomeId) {
|
|
88
|
-
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
await this.manager.removeSubscriptions([outcomeId]);
|
|
87
|
+
this.subscribedAssets.delete(outcomeId);
|
|
92
88
|
// Clear any pending resolvers for this asset
|
|
93
89
|
const resolvers = this.orderBookResolvers.get(outcomeId);
|
|
94
90
|
if (resolvers) {
|
|
@@ -104,12 +100,15 @@ class PolymarketWebSocket {
|
|
|
104
100
|
return this.watcher.watch(address, ['trades'], outcomeId);
|
|
105
101
|
}
|
|
106
102
|
await this.ensureInitialized();
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
await this.subscribe([outcomeId]);
|
|
104
|
+
// Return accumulated trades immediately if any arrived between calls
|
|
105
|
+
const accumulated = this.pendingTrades.get(outcomeId);
|
|
106
|
+
if (accumulated && accumulated.length > 0) {
|
|
107
|
+
const result = [...accumulated];
|
|
108
|
+
this.pendingTrades.set(outcomeId, []);
|
|
109
|
+
return result;
|
|
111
110
|
}
|
|
112
|
-
//
|
|
111
|
+
// Otherwise wait for the next trade
|
|
113
112
|
const dataPromise = new Promise((resolve, reject) => {
|
|
114
113
|
if (!this.tradeResolvers.has(outcomeId)) {
|
|
115
114
|
this.tradeResolvers.set(outcomeId, []);
|
|
@@ -249,52 +248,62 @@ class PolymarketWebSocket {
|
|
|
249
248
|
}
|
|
250
249
|
}
|
|
251
250
|
async close() {
|
|
252
|
-
if (this.
|
|
253
|
-
|
|
251
|
+
if (this.ws) {
|
|
252
|
+
this.ws.close();
|
|
253
|
+
this.ws = null;
|
|
254
254
|
}
|
|
255
|
+
this.subscribedAssets.clear();
|
|
255
256
|
this.closeUserChannel();
|
|
256
257
|
this.watcher.close();
|
|
257
258
|
}
|
|
259
|
+
async subscribe(assetIds) {
|
|
260
|
+
const newIds = assetIds.filter((id) => !this.subscribedAssets.has(id));
|
|
261
|
+
if (newIds.length === 0)
|
|
262
|
+
return;
|
|
263
|
+
for (const id of newIds)
|
|
264
|
+
this.subscribedAssets.add(id);
|
|
265
|
+
if (this.ws && this.ws.readyState === 1) {
|
|
266
|
+
this.ws.send(JSON.stringify({
|
|
267
|
+
assets_ids: newIds,
|
|
268
|
+
type: 'market',
|
|
269
|
+
custom_feature_enabled: true,
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
}
|
|
258
273
|
async ensureInitialized() {
|
|
259
274
|
if (this.initializationPromise)
|
|
260
275
|
return this.initializationPromise;
|
|
261
|
-
this.initializationPromise = (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
this.handleTrade(
|
|
279
|
-
|
|
280
|
-
},
|
|
281
|
-
onError: async (error) => {
|
|
282
|
-
console.error('Polymarket WebSocket error:', error.message);
|
|
283
|
-
},
|
|
284
|
-
}, {
|
|
285
|
-
reconnectAndCleanupIntervalMs: this.config.reconnectIntervalMs ?? 5000,
|
|
286
|
-
pendingFlushIntervalMs: this.config.flushIntervalMs ?? 100,
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
catch (e) {
|
|
290
|
-
const error = e;
|
|
291
|
-
if (error.message.includes('Cannot find module')) {
|
|
292
|
-
throw new Error('Polymarket WebSocket support requires the "@nevuamarkets/poly-websockets" package.\n' +
|
|
293
|
-
'To use this feature, please install it: npm install @nevuamarkets/poly-websockets');
|
|
276
|
+
this.initializationPromise = new Promise((resolve, reject) => {
|
|
277
|
+
const WebSocket = require('ws');
|
|
278
|
+
this.ws = new WebSocket(POLYMARKET_MARKET_WS_URL);
|
|
279
|
+
this.ws.on('open', () => {
|
|
280
|
+
resolve();
|
|
281
|
+
});
|
|
282
|
+
this.ws.on('message', (raw) => {
|
|
283
|
+
try {
|
|
284
|
+
const msgs = JSON.parse(raw.toString());
|
|
285
|
+
const arr = Array.isArray(msgs) ? msgs : [msgs];
|
|
286
|
+
for (const msg of arr) {
|
|
287
|
+
const type = msg.event_type;
|
|
288
|
+
if (type === 'book')
|
|
289
|
+
this.handleBookSnapshot(msg);
|
|
290
|
+
else if (type === 'price_change')
|
|
291
|
+
this.handlePriceChange(msg);
|
|
292
|
+
else if (type === 'last_trade_price')
|
|
293
|
+
this.handleTrade(msg);
|
|
294
|
+
}
|
|
294
295
|
}
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
296
|
+
catch { }
|
|
297
|
+
});
|
|
298
|
+
this.ws.on('error', (err) => {
|
|
299
|
+
console.error('Polymarket WebSocket error:', err.message);
|
|
300
|
+
reject(err);
|
|
301
|
+
});
|
|
302
|
+
this.ws.on('close', () => {
|
|
303
|
+
this.initializationPromise = undefined;
|
|
304
|
+
this.ws = null;
|
|
305
|
+
});
|
|
306
|
+
});
|
|
298
307
|
return this.initializationPromise;
|
|
299
308
|
}
|
|
300
309
|
handleBookSnapshot(event) {
|
|
@@ -316,17 +325,16 @@ class PolymarketWebSocket {
|
|
|
316
325
|
this.resolveOrderBook(id, orderBook);
|
|
317
326
|
}
|
|
318
327
|
handlePriceChange(event) {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}
|
|
328
|
+
const id = event.asset_id;
|
|
329
|
+
const existing = this.orderBooks.get(id);
|
|
330
|
+
if (!existing)
|
|
331
|
+
return;
|
|
332
|
+
// Native API sends individual price_change events (not wrapped in an array)
|
|
333
|
+
const changes = event.price_changes || [event];
|
|
334
|
+
for (const change of changes) {
|
|
327
335
|
const price = parseFloat(change.price);
|
|
328
336
|
const size = parseFloat(change.size);
|
|
329
|
-
const side = change.side.toUpperCase();
|
|
337
|
+
const side = (change.side || '').toUpperCase();
|
|
330
338
|
const levels = side === 'BUY' ? existing.bids : existing.asks;
|
|
331
339
|
const existingIndex = levels.findIndex((l) => l.price === price);
|
|
332
340
|
if (size === 0) {
|
|
@@ -364,11 +372,18 @@ class PolymarketWebSocket {
|
|
|
364
372
|
amount: parseFloat(event.size),
|
|
365
373
|
side: event.side.toLowerCase(),
|
|
366
374
|
};
|
|
375
|
+
// Resolve waiting promises if any, otherwise buffer for next watchTrades call
|
|
367
376
|
const resolvers = this.tradeResolvers.get(id);
|
|
368
377
|
if (resolvers && resolvers.length > 0) {
|
|
369
378
|
resolvers.forEach((r) => r.resolve([trade]));
|
|
370
379
|
this.tradeResolvers.set(id, []);
|
|
371
380
|
}
|
|
381
|
+
else {
|
|
382
|
+
if (!this.pendingTrades.has(id)) {
|
|
383
|
+
this.pendingTrades.set(id, []);
|
|
384
|
+
}
|
|
385
|
+
this.pendingTrades.get(id).push(trade);
|
|
386
|
+
}
|
|
372
387
|
}
|
|
373
388
|
resolveOrderBook(id, orderBook) {
|
|
374
389
|
const resolvers = this.orderBookResolvers.get(id);
|
|
@@ -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-15T20:14:37.331Z
|
|
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-15T20:14:37.331Z
|
|
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
|
@@ -1294,325 +1294,6 @@ paths:
|
|
|
1294
1294
|
description: >-
|
|
1295
1295
|
Filter a list of events by criteria. Can filter by string query, structured criteria object, or custom filter
|
|
1296
1296
|
function.
|
|
1297
|
-
'/api/{exchange}/watchOrderBook':
|
|
1298
|
-
post:
|
|
1299
|
-
summary: Watch Order Book
|
|
1300
|
-
operationId: watchOrderBook
|
|
1301
|
-
parameters:
|
|
1302
|
-
- $ref: '#/components/parameters/ExchangeParam'
|
|
1303
|
-
description: >-
|
|
1304
|
-
Watch order book updates in real-time via WebSocket. Returns a promise that resolves with the next order book
|
|
1305
|
-
update. Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
**Transport:** WebSocket
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
| Environment | URL |
|
|
1312
|
-
|
|
1313
|
-
|---|---|
|
|
1314
|
-
|
|
1315
|
-
| Local sidecar | `ws://localhost:3847/ws` |
|
|
1316
|
-
|
|
1317
|
-
| Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` |
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
**Subscribe:**
|
|
1321
|
-
|
|
1322
|
-
```json
|
|
1323
|
-
|
|
1324
|
-
{ "id": "req-1", "action": "subscribe", "method": "watchOrderBook", "args": [...] }
|
|
1325
|
-
|
|
1326
|
-
```
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
**Server response:**
|
|
1330
|
-
|
|
1331
|
-
```json
|
|
1332
|
-
|
|
1333
|
-
{ "event": "data", "id": "req-1", "method": "watchOrderBook", "symbol": "...", "data": { ... } }
|
|
1334
|
-
|
|
1335
|
-
```
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
**Unsubscribe:**
|
|
1339
|
-
|
|
1340
|
-
```json
|
|
1341
|
-
|
|
1342
|
-
{ "id": "req-1", "action": "unsubscribe" }
|
|
1343
|
-
|
|
1344
|
-
```
|
|
1345
|
-
responses:
|
|
1346
|
-
'200':
|
|
1347
|
-
description: Watch Order Book response
|
|
1348
|
-
content:
|
|
1349
|
-
application/json:
|
|
1350
|
-
schema:
|
|
1351
|
-
allOf:
|
|
1352
|
-
- $ref: '#/components/schemas/BaseResponse'
|
|
1353
|
-
- type: object
|
|
1354
|
-
properties:
|
|
1355
|
-
data:
|
|
1356
|
-
$ref: '#/components/schemas/OrderBook'
|
|
1357
|
-
'/api/{exchange}/watchOrderBooks':
|
|
1358
|
-
post:
|
|
1359
|
-
summary: Watch Order Books
|
|
1360
|
-
operationId: watchOrderBooks
|
|
1361
|
-
parameters:
|
|
1362
|
-
- $ref: '#/components/parameters/ExchangeParam'
|
|
1363
|
-
description: >-
|
|
1364
|
-
Watch multiple order books simultaneously via WebSocket. Returns a promise that resolves with a record of order
|
|
1365
|
-
book snapshots keyed by ID. Exchanges with native batch support (e.g. Kalshi) send a single subscribe message
|
|
1366
|
-
for all tickers; others fall back to individual watchOrderBook calls.
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
**Transport:** WebSocket
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
| Environment | URL |
|
|
1373
|
-
|
|
1374
|
-
|---|---|
|
|
1375
|
-
|
|
1376
|
-
| Local sidecar | `ws://localhost:3847/ws` |
|
|
1377
|
-
|
|
1378
|
-
| Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` |
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
**Subscribe:**
|
|
1382
|
-
|
|
1383
|
-
```json
|
|
1384
|
-
|
|
1385
|
-
{ "id": "req-1", "action": "subscribe", "method": "watchOrderBooks", "args": [...] }
|
|
1386
|
-
|
|
1387
|
-
```
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
**Server response:**
|
|
1391
|
-
|
|
1392
|
-
```json
|
|
1393
|
-
|
|
1394
|
-
{ "event": "data", "id": "req-1", "method": "watchOrderBooks", "symbol": "...", "data": { ... } }
|
|
1395
|
-
|
|
1396
|
-
```
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
**Unsubscribe:**
|
|
1400
|
-
|
|
1401
|
-
```json
|
|
1402
|
-
|
|
1403
|
-
{ "id": "req-1", "action": "unsubscribe" }
|
|
1404
|
-
|
|
1405
|
-
```
|
|
1406
|
-
responses:
|
|
1407
|
-
'200':
|
|
1408
|
-
description: Watch Order Books response
|
|
1409
|
-
content:
|
|
1410
|
-
application/json:
|
|
1411
|
-
schema:
|
|
1412
|
-
allOf:
|
|
1413
|
-
- $ref: '#/components/schemas/BaseResponse'
|
|
1414
|
-
- type: object
|
|
1415
|
-
properties:
|
|
1416
|
-
data:
|
|
1417
|
-
type: object
|
|
1418
|
-
additionalProperties:
|
|
1419
|
-
$ref: '#/components/schemas/OrderBook'
|
|
1420
|
-
'/api/{exchange}/unwatchOrderBook':
|
|
1421
|
-
post:
|
|
1422
|
-
summary: Unwatch Order Book
|
|
1423
|
-
operationId: unwatchOrderBook
|
|
1424
|
-
parameters:
|
|
1425
|
-
- $ref: '#/components/parameters/ExchangeParam'
|
|
1426
|
-
description: |-
|
|
1427
|
-
Unsubscribe from a previously watched order book stream.
|
|
1428
|
-
|
|
1429
|
-
**Transport:** WebSocket
|
|
1430
|
-
|
|
1431
|
-
| Environment | URL |
|
|
1432
|
-
|---|---|
|
|
1433
|
-
| Local sidecar | `ws://localhost:3847/ws` |
|
|
1434
|
-
| Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` |
|
|
1435
|
-
|
|
1436
|
-
**Subscribe:**
|
|
1437
|
-
```json
|
|
1438
|
-
{ "id": "req-1", "action": "subscribe", "method": "unwatchOrderBook", "args": [...] }
|
|
1439
|
-
```
|
|
1440
|
-
|
|
1441
|
-
**Server response:**
|
|
1442
|
-
```json
|
|
1443
|
-
{ "event": "data", "id": "req-1", "method": "unwatchOrderBook", "symbol": "...", "data": { ... } }
|
|
1444
|
-
```
|
|
1445
|
-
|
|
1446
|
-
**Unsubscribe:**
|
|
1447
|
-
```json
|
|
1448
|
-
{ "id": "req-1", "action": "unsubscribe" }
|
|
1449
|
-
```
|
|
1450
|
-
responses:
|
|
1451
|
-
'200':
|
|
1452
|
-
description: Unwatch Order Book response
|
|
1453
|
-
content:
|
|
1454
|
-
application/json:
|
|
1455
|
-
schema:
|
|
1456
|
-
$ref: '#/components/schemas/BaseResponse'
|
|
1457
|
-
'/api/{exchange}/watchTrades':
|
|
1458
|
-
post:
|
|
1459
|
-
summary: Watch Trades
|
|
1460
|
-
operationId: watchTrades
|
|
1461
|
-
parameters:
|
|
1462
|
-
- $ref: '#/components/parameters/ExchangeParam'
|
|
1463
|
-
description: >-
|
|
1464
|
-
Watch trade executions in real-time via WebSocket. Returns a promise that resolves with the next trade(s). Call
|
|
1465
|
-
repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
**Transport:** WebSocket
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
| Environment | URL |
|
|
1472
|
-
|
|
1473
|
-
|---|---|
|
|
1474
|
-
|
|
1475
|
-
| Local sidecar | `ws://localhost:3847/ws` |
|
|
1476
|
-
|
|
1477
|
-
| Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` |
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
**Subscribe:**
|
|
1481
|
-
|
|
1482
|
-
```json
|
|
1483
|
-
|
|
1484
|
-
{ "id": "req-1", "action": "subscribe", "method": "watchTrades", "args": [...] }
|
|
1485
|
-
|
|
1486
|
-
```
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
**Server response:**
|
|
1490
|
-
|
|
1491
|
-
```json
|
|
1492
|
-
|
|
1493
|
-
{ "event": "data", "id": "req-1", "method": "watchTrades", "symbol": "...", "data": { ... } }
|
|
1494
|
-
|
|
1495
|
-
```
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
**Unsubscribe:**
|
|
1499
|
-
|
|
1500
|
-
```json
|
|
1501
|
-
|
|
1502
|
-
{ "id": "req-1", "action": "unsubscribe" }
|
|
1503
|
-
|
|
1504
|
-
```
|
|
1505
|
-
responses:
|
|
1506
|
-
'200':
|
|
1507
|
-
description: Watch Trades response
|
|
1508
|
-
content:
|
|
1509
|
-
application/json:
|
|
1510
|
-
schema:
|
|
1511
|
-
allOf:
|
|
1512
|
-
- $ref: '#/components/schemas/BaseResponse'
|
|
1513
|
-
- type: object
|
|
1514
|
-
properties:
|
|
1515
|
-
data:
|
|
1516
|
-
type: array
|
|
1517
|
-
items:
|
|
1518
|
-
$ref: '#/components/schemas/Trade'
|
|
1519
|
-
'/api/{exchange}/watchAddress':
|
|
1520
|
-
post:
|
|
1521
|
-
summary: Watch Address
|
|
1522
|
-
operationId: watchAddress
|
|
1523
|
-
parameters:
|
|
1524
|
-
- $ref: '#/components/parameters/ExchangeParam'
|
|
1525
|
-
description: >-
|
|
1526
|
-
Stream activity for a public wallet address Returns a promise that resolves with the next activity snapshot
|
|
1527
|
-
whenever a change is detected. Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
**Transport:** WebSocket
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
| Environment | URL |
|
|
1534
|
-
|
|
1535
|
-
|---|---|
|
|
1536
|
-
|
|
1537
|
-
| Local sidecar | `ws://localhost:3847/ws` |
|
|
1538
|
-
|
|
1539
|
-
| Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` |
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
**Subscribe:**
|
|
1543
|
-
|
|
1544
|
-
```json
|
|
1545
|
-
|
|
1546
|
-
{ "id": "req-1", "action": "subscribe", "method": "watchAddress", "args": [...] }
|
|
1547
|
-
|
|
1548
|
-
```
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
**Server response:**
|
|
1552
|
-
|
|
1553
|
-
```json
|
|
1554
|
-
|
|
1555
|
-
{ "event": "data", "id": "req-1", "method": "watchAddress", "symbol": "...", "data": { ... } }
|
|
1556
|
-
|
|
1557
|
-
```
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
**Unsubscribe:**
|
|
1561
|
-
|
|
1562
|
-
```json
|
|
1563
|
-
|
|
1564
|
-
{ "id": "req-1", "action": "unsubscribe" }
|
|
1565
|
-
|
|
1566
|
-
```
|
|
1567
|
-
responses:
|
|
1568
|
-
'200':
|
|
1569
|
-
description: Watch Address response
|
|
1570
|
-
content:
|
|
1571
|
-
application/json:
|
|
1572
|
-
schema:
|
|
1573
|
-
allOf:
|
|
1574
|
-
- $ref: '#/components/schemas/BaseResponse'
|
|
1575
|
-
- type: object
|
|
1576
|
-
properties:
|
|
1577
|
-
data:
|
|
1578
|
-
type: object
|
|
1579
|
-
'/api/{exchange}/unwatchAddress':
|
|
1580
|
-
post:
|
|
1581
|
-
summary: Unwatch Address
|
|
1582
|
-
operationId: unwatchAddress
|
|
1583
|
-
parameters:
|
|
1584
|
-
- $ref: '#/components/parameters/ExchangeParam'
|
|
1585
|
-
description: |-
|
|
1586
|
-
Stop watching a previously registered wallet address and release its resource updates.
|
|
1587
|
-
|
|
1588
|
-
**Transport:** WebSocket
|
|
1589
|
-
|
|
1590
|
-
| Environment | URL |
|
|
1591
|
-
|---|---|
|
|
1592
|
-
| Local sidecar | `ws://localhost:3847/ws` |
|
|
1593
|
-
| Hosted API | `wss://api.pmxt.dev/ws?apiKey=YOUR_KEY` |
|
|
1594
|
-
|
|
1595
|
-
**Subscribe:**
|
|
1596
|
-
```json
|
|
1597
|
-
{ "id": "req-1", "action": "subscribe", "method": "unwatchAddress", "args": [...] }
|
|
1598
|
-
```
|
|
1599
|
-
|
|
1600
|
-
**Server response:**
|
|
1601
|
-
```json
|
|
1602
|
-
{ "event": "data", "id": "req-1", "method": "unwatchAddress", "symbol": "...", "data": { ... } }
|
|
1603
|
-
```
|
|
1604
|
-
|
|
1605
|
-
**Unsubscribe:**
|
|
1606
|
-
```json
|
|
1607
|
-
{ "id": "req-1", "action": "unsubscribe" }
|
|
1608
|
-
```
|
|
1609
|
-
responses:
|
|
1610
|
-
'200':
|
|
1611
|
-
description: Unwatch Address response
|
|
1612
|
-
content:
|
|
1613
|
-
application/json:
|
|
1614
|
-
schema:
|
|
1615
|
-
$ref: '#/components/schemas/BaseResponse'
|
|
1616
1297
|
'/api/{exchange}/testDummyMethod':
|
|
1617
1298
|
post:
|
|
1618
1299
|
summary: Test Dummy Method
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxt-core",
|
|
3
|
-
"version": "2.41.
|
|
3
|
+
"version": "2.41.4",
|
|
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.41.
|
|
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.41.
|
|
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.41.4,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.41.4,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",
|