pmxtjs 2.46.4 → 2.46.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/esm/pmxt/client.d.ts +4 -1
- package/dist/esm/pmxt/client.js +16 -2
- package/dist/pmxt/client.d.ts +4 -1
- package/dist/pmxt/client.js +16 -2
- package/generated/package.json +1 -1
- package/package.json +2 -2
- package/pmxt/client.ts +18 -2
|
@@ -57,6 +57,7 @@ export interface ExchangeOptions {
|
|
|
57
57
|
* prediction market platforms (Polymarket, Kalshi, etc.).
|
|
58
58
|
*/
|
|
59
59
|
export declare abstract class Exchange {
|
|
60
|
+
private static readonly OBDATA_WATCH_ALL_SOURCES;
|
|
60
61
|
protected exchangeName: string;
|
|
61
62
|
protected apiKey?: string;
|
|
62
63
|
protected privateKey?: string;
|
|
@@ -116,6 +117,7 @@ export declare abstract class Exchange {
|
|
|
116
117
|
private watchViaWs;
|
|
117
118
|
private wsTransportUnavailableError;
|
|
118
119
|
private isWsTransportUnavailableError;
|
|
120
|
+
private defaultWatchAllOrderBookVenues;
|
|
119
121
|
private getWsInternals;
|
|
120
122
|
private wsSubscriptionKey;
|
|
121
123
|
private getWsSubscriptionId;
|
|
@@ -282,7 +284,8 @@ export declare abstract class Exchange {
|
|
|
282
284
|
* Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
283
285
|
* Requires hosted mode (`pmxtApiKey` set).
|
|
284
286
|
*
|
|
285
|
-
* @param venues - Optional venue filter
|
|
287
|
+
* @param venues - Optional venue filter. Defaults to this exchange's venue
|
|
288
|
+
* for venue clients (e.g. Kalshi -> ["kalshi"]); Router defaults to all venues.
|
|
286
289
|
* @returns Next event with source, symbol, and orderbook
|
|
287
290
|
*
|
|
288
291
|
* @example
|
package/dist/esm/pmxt/client.js
CHANGED
|
@@ -126,6 +126,12 @@ function convertSubscriptionSnapshot(raw) {
|
|
|
126
126
|
* prediction market platforms (Polymarket, Kalshi, etc.).
|
|
127
127
|
*/
|
|
128
128
|
export class Exchange {
|
|
129
|
+
static OBDATA_WATCH_ALL_SOURCES = new Set([
|
|
130
|
+
"polymarket",
|
|
131
|
+
"limitless",
|
|
132
|
+
"kalshi",
|
|
133
|
+
"opinion",
|
|
134
|
+
]);
|
|
129
135
|
exchangeName;
|
|
130
136
|
apiKey;
|
|
131
137
|
privateKey;
|
|
@@ -358,6 +364,12 @@ export class Exchange {
|
|
|
358
364
|
return error instanceof PmxtError
|
|
359
365
|
&& /connection failed|no websocket|websocket.*not connected/i.test(error.message);
|
|
360
366
|
}
|
|
367
|
+
defaultWatchAllOrderBookVenues() {
|
|
368
|
+
if (Exchange.OBDATA_WATCH_ALL_SOURCES.has(this.exchangeName)) {
|
|
369
|
+
return [this.exchangeName];
|
|
370
|
+
}
|
|
371
|
+
return undefined;
|
|
372
|
+
}
|
|
361
373
|
getWsInternals(ws) {
|
|
362
374
|
return ws;
|
|
363
375
|
}
|
|
@@ -1564,7 +1576,8 @@ export class Exchange {
|
|
|
1564
1576
|
* Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1565
1577
|
* Requires hosted mode (`pmxtApiKey` set).
|
|
1566
1578
|
*
|
|
1567
|
-
* @param venues - Optional venue filter
|
|
1579
|
+
* @param venues - Optional venue filter. Defaults to this exchange's venue
|
|
1580
|
+
* for venue clients (e.g. Kalshi -> ["kalshi"]); Router defaults to all venues.
|
|
1568
1581
|
* @returns Next event with source, symbol, and orderbook
|
|
1569
1582
|
*
|
|
1570
1583
|
* @example
|
|
@@ -1581,7 +1594,8 @@ export class Exchange {
|
|
|
1581
1594
|
if (!this.isHosted) {
|
|
1582
1595
|
throw new PmxtError("watchAllOrderBooks() requires hosted mode (set pmxtApiKey)");
|
|
1583
1596
|
}
|
|
1584
|
-
const
|
|
1597
|
+
const effectiveVenues = venues ?? this.defaultWatchAllOrderBookVenues();
|
|
1598
|
+
const args = effectiveVenues?.length ? [effectiveVenues] : [];
|
|
1585
1599
|
const wsData = await this.watchViaWs("watchAllOrderBooks", args);
|
|
1586
1600
|
if (wsData !== null) {
|
|
1587
1601
|
return {
|
package/dist/pmxt/client.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export interface ExchangeOptions {
|
|
|
57
57
|
* prediction market platforms (Polymarket, Kalshi, etc.).
|
|
58
58
|
*/
|
|
59
59
|
export declare abstract class Exchange {
|
|
60
|
+
private static readonly OBDATA_WATCH_ALL_SOURCES;
|
|
60
61
|
protected exchangeName: string;
|
|
61
62
|
protected apiKey?: string;
|
|
62
63
|
protected privateKey?: string;
|
|
@@ -116,6 +117,7 @@ export declare abstract class Exchange {
|
|
|
116
117
|
private watchViaWs;
|
|
117
118
|
private wsTransportUnavailableError;
|
|
118
119
|
private isWsTransportUnavailableError;
|
|
120
|
+
private defaultWatchAllOrderBookVenues;
|
|
119
121
|
private getWsInternals;
|
|
120
122
|
private wsSubscriptionKey;
|
|
121
123
|
private getWsSubscriptionId;
|
|
@@ -282,7 +284,8 @@ export declare abstract class Exchange {
|
|
|
282
284
|
* Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
283
285
|
* Requires hosted mode (`pmxtApiKey` set).
|
|
284
286
|
*
|
|
285
|
-
* @param venues - Optional venue filter
|
|
287
|
+
* @param venues - Optional venue filter. Defaults to this exchange's venue
|
|
288
|
+
* for venue clients (e.g. Kalshi -> ["kalshi"]); Router defaults to all venues.
|
|
286
289
|
* @returns Next event with source, symbol, and orderbook
|
|
287
290
|
*
|
|
288
291
|
* @example
|
package/dist/pmxt/client.js
CHANGED
|
@@ -129,6 +129,12 @@ function convertSubscriptionSnapshot(raw) {
|
|
|
129
129
|
* prediction market platforms (Polymarket, Kalshi, etc.).
|
|
130
130
|
*/
|
|
131
131
|
class Exchange {
|
|
132
|
+
static OBDATA_WATCH_ALL_SOURCES = new Set([
|
|
133
|
+
"polymarket",
|
|
134
|
+
"limitless",
|
|
135
|
+
"kalshi",
|
|
136
|
+
"opinion",
|
|
137
|
+
]);
|
|
132
138
|
exchangeName;
|
|
133
139
|
apiKey;
|
|
134
140
|
privateKey;
|
|
@@ -361,6 +367,12 @@ class Exchange {
|
|
|
361
367
|
return error instanceof errors_js_1.PmxtError
|
|
362
368
|
&& /connection failed|no websocket|websocket.*not connected/i.test(error.message);
|
|
363
369
|
}
|
|
370
|
+
defaultWatchAllOrderBookVenues() {
|
|
371
|
+
if (Exchange.OBDATA_WATCH_ALL_SOURCES.has(this.exchangeName)) {
|
|
372
|
+
return [this.exchangeName];
|
|
373
|
+
}
|
|
374
|
+
return undefined;
|
|
375
|
+
}
|
|
364
376
|
getWsInternals(ws) {
|
|
365
377
|
return ws;
|
|
366
378
|
}
|
|
@@ -1567,7 +1579,8 @@ class Exchange {
|
|
|
1567
1579
|
* Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1568
1580
|
* Requires hosted mode (`pmxtApiKey` set).
|
|
1569
1581
|
*
|
|
1570
|
-
* @param venues - Optional venue filter
|
|
1582
|
+
* @param venues - Optional venue filter. Defaults to this exchange's venue
|
|
1583
|
+
* for venue clients (e.g. Kalshi -> ["kalshi"]); Router defaults to all venues.
|
|
1571
1584
|
* @returns Next event with source, symbol, and orderbook
|
|
1572
1585
|
*
|
|
1573
1586
|
* @example
|
|
@@ -1584,7 +1597,8 @@ class Exchange {
|
|
|
1584
1597
|
if (!this.isHosted) {
|
|
1585
1598
|
throw new errors_js_1.PmxtError("watchAllOrderBooks() requires hosted mode (set pmxtApiKey)");
|
|
1586
1599
|
}
|
|
1587
|
-
const
|
|
1600
|
+
const effectiveVenues = venues ?? this.defaultWatchAllOrderBookVenues();
|
|
1601
|
+
const args = effectiveVenues?.length ? [effectiveVenues] : [];
|
|
1588
1602
|
const wsData = await this.watchViaWs("watchAllOrderBooks", args);
|
|
1589
1603
|
if (wsData !== null) {
|
|
1590
1604
|
return {
|
package/generated/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxtjs",
|
|
3
|
-
"version": "2.46.
|
|
3
|
+
"version": "2.46.6",
|
|
4
4
|
"description": "Unified prediction market data API - The ccxt for prediction markets",
|
|
5
5
|
"author": "PMXT Contributors",
|
|
6
6
|
"repository": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"unified"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"pmxt-core": "2.46.
|
|
46
|
+
"pmxt-core": "2.46.6",
|
|
47
47
|
"ws": "^8.18.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
package/pmxt/client.ts
CHANGED
|
@@ -239,6 +239,13 @@ export interface ExchangeOptions {
|
|
|
239
239
|
* prediction market platforms (Polymarket, Kalshi, etc.).
|
|
240
240
|
*/
|
|
241
241
|
export abstract class Exchange {
|
|
242
|
+
private static readonly OBDATA_WATCH_ALL_SOURCES = new Set([
|
|
243
|
+
"polymarket",
|
|
244
|
+
"limitless",
|
|
245
|
+
"kalshi",
|
|
246
|
+
"opinion",
|
|
247
|
+
]);
|
|
248
|
+
|
|
242
249
|
protected exchangeName: string;
|
|
243
250
|
protected apiKey?: string;
|
|
244
251
|
protected privateKey?: string;
|
|
@@ -509,6 +516,13 @@ export abstract class Exchange {
|
|
|
509
516
|
&& /connection failed|no websocket|websocket.*not connected/i.test(error.message);
|
|
510
517
|
}
|
|
511
518
|
|
|
519
|
+
private defaultWatchAllOrderBookVenues(): string[] | undefined {
|
|
520
|
+
if (Exchange.OBDATA_WATCH_ALL_SOURCES.has(this.exchangeName)) {
|
|
521
|
+
return [this.exchangeName];
|
|
522
|
+
}
|
|
523
|
+
return undefined;
|
|
524
|
+
}
|
|
525
|
+
|
|
512
526
|
private getWsInternals(ws: SidecarWsClient): SidecarWsClientInternals {
|
|
513
527
|
return ws as unknown as SidecarWsClientInternals;
|
|
514
528
|
}
|
|
@@ -1720,7 +1734,8 @@ export abstract class Exchange {
|
|
|
1720
1734
|
* Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1721
1735
|
* Requires hosted mode (`pmxtApiKey` set).
|
|
1722
1736
|
*
|
|
1723
|
-
* @param venues - Optional venue filter
|
|
1737
|
+
* @param venues - Optional venue filter. Defaults to this exchange's venue
|
|
1738
|
+
* for venue clients (e.g. Kalshi -> ["kalshi"]); Router defaults to all venues.
|
|
1724
1739
|
* @returns Next event with source, symbol, and orderbook
|
|
1725
1740
|
*
|
|
1726
1741
|
* @example
|
|
@@ -1739,7 +1754,8 @@ export abstract class Exchange {
|
|
|
1739
1754
|
throw new PmxtError("watchAllOrderBooks() requires hosted mode (set pmxtApiKey)");
|
|
1740
1755
|
}
|
|
1741
1756
|
|
|
1742
|
-
const
|
|
1757
|
+
const effectiveVenues = venues ?? this.defaultWatchAllOrderBookVenues();
|
|
1758
|
+
const args: any[] = effectiveVenues?.length ? [effectiveVenues] : [];
|
|
1743
1759
|
const wsData = await this.watchViaWs("watchAllOrderBooks", args);
|
|
1744
1760
|
if (wsData !== null) {
|
|
1745
1761
|
return {
|