pmxt-core 2.27.10 → 2.28.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.d.ts +8 -0
- package/dist/BaseExchange.js +9 -0
- package/dist/exchanges/baozi/index.d.ts +1 -0
- package/dist/exchanges/baozi/index.js +1 -0
- package/dist/exchanges/kalshi/api.d.ts +1 -1
- package/dist/exchanges/kalshi/api.js +1 -1
- package/dist/exchanges/kalshi/index.d.ts +1 -0
- package/dist/exchanges/kalshi/index.js +1 -0
- package/dist/exchanges/limitless/api.d.ts +1 -1
- package/dist/exchanges/limitless/api.js +1 -1
- package/dist/exchanges/limitless/index.d.ts +1 -0
- package/dist/exchanges/limitless/index.js +1 -0
- package/dist/exchanges/metaculus/index.d.ts +1 -0
- package/dist/exchanges/metaculus/index.js +1 -0
- package/dist/exchanges/myriad/api.d.ts +1 -1
- package/dist/exchanges/myriad/api.js +1 -1
- package/dist/exchanges/myriad/index.d.ts +1 -0
- package/dist/exchanges/myriad/index.js +1 -0
- package/dist/exchanges/opinion/api.d.ts +1 -1
- package/dist/exchanges/opinion/api.js +1 -1
- package/dist/exchanges/opinion/index.d.ts +1 -0
- package/dist/exchanges/opinion/index.js +1 -0
- 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/index.d.ts +2 -0
- package/dist/exchanges/polymarket/index.js +4 -0
- package/dist/exchanges/polymarket/websocket.d.ts +1 -0
- package/dist/exchanges/polymarket/websocket.js +15 -0
- package/dist/exchanges/polymarket_us/index.d.ts +1 -0
- package/dist/exchanges/polymarket_us/index.js +1 -0
- package/dist/exchanges/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- package/dist/exchanges/probable/index.d.ts +1 -0
- package/dist/exchanges/probable/index.js +1 -0
- package/dist/exchanges/smarkets/index.d.ts +1 -0
- package/dist/exchanges/smarkets/index.js +1 -0
- package/dist/server/method-verbs.json +10 -0
- package/dist/server/openapi.yaml +31 -0
- package/package.json +3 -3
package/dist/BaseExchange.d.ts
CHANGED
|
@@ -201,6 +201,8 @@ export interface ExchangeHas {
|
|
|
201
201
|
unwatchAddress: ExchangeCapability;
|
|
202
202
|
/** Whether this exchange supports streaming order book updates. */
|
|
203
203
|
watchOrderBook: ExchangeCapability;
|
|
204
|
+
/** Whether this exchange supports unsubscribing from an order book stream. */
|
|
205
|
+
unwatchOrderBook: ExchangeCapability;
|
|
204
206
|
/** Whether this exchange supports streaming trade updates. */
|
|
205
207
|
watchTrades: ExchangeCapability;
|
|
206
208
|
/** Whether this exchange supports fetching the authenticated user's trade history. */
|
|
@@ -492,6 +494,12 @@ export declare abstract class PredictionMarketExchange {
|
|
|
492
494
|
* @returns Promise that resolves with the current orderbook state
|
|
493
495
|
*/
|
|
494
496
|
watchOrderBook(id: string, limit?: number): Promise<OrderBook>;
|
|
497
|
+
/**
|
|
498
|
+
* Unsubscribe from a previously watched order book stream.
|
|
499
|
+
*
|
|
500
|
+
* @param id - The Outcome ID to stop watching
|
|
501
|
+
*/
|
|
502
|
+
unwatchOrderBook(id: string): Promise<void>;
|
|
495
503
|
/**
|
|
496
504
|
* Watch trade executions in real-time via WebSocket.
|
|
497
505
|
* Returns a promise that resolves with the next trade(s). Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
package/dist/BaseExchange.js
CHANGED
|
@@ -34,6 +34,7 @@ class PredictionMarketExchange {
|
|
|
34
34
|
watchAddress: false,
|
|
35
35
|
unwatchAddress: false,
|
|
36
36
|
watchOrderBook: false,
|
|
37
|
+
unwatchOrderBook: false,
|
|
37
38
|
watchTrades: false,
|
|
38
39
|
fetchMyTrades: false,
|
|
39
40
|
fetchClosedOrders: false,
|
|
@@ -668,6 +669,14 @@ class PredictionMarketExchange {
|
|
|
668
669
|
async watchOrderBook(id, limit) {
|
|
669
670
|
throw new Error(`watchOrderBook() is not supported by ${this.name}`);
|
|
670
671
|
}
|
|
672
|
+
/**
|
|
673
|
+
* Unsubscribe from a previously watched order book stream.
|
|
674
|
+
*
|
|
675
|
+
* @param id - The Outcome ID to stop watching
|
|
676
|
+
*/
|
|
677
|
+
async unwatchOrderBook(id) {
|
|
678
|
+
throw new Error(`unwatchOrderBook() is not supported by ${this.name}`);
|
|
679
|
+
}
|
|
671
680
|
// ----------------------------------------------------------------------------
|
|
672
681
|
// WebSocket Streaming Methods
|
|
673
682
|
// ----------------------------------------------------------------------------
|
|
@@ -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-11T09:
|
|
3
|
+
* Generated at: 2026-04-11T09:59:33.711Z
|
|
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-11T09:
|
|
6
|
+
* Generated at: 2026-04-11T09:59:33.711Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.kalshiApiSpec = {
|
|
@@ -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-11T09:
|
|
3
|
+
* Generated at: 2026-04-11T09:59:33.748Z
|
|
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-11T09:
|
|
6
|
+
* Generated at: 2026-04-11T09:59:33.748Z
|
|
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-11T09:
|
|
3
|
+
* Generated at: 2026-04-11T09:59:33.759Z
|
|
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-11T09:
|
|
6
|
+
* Generated at: 2026-04-11T09:59:33.759Z
|
|
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-11T09:
|
|
3
|
+
* Generated at: 2026-04-11T09:59:33.763Z
|
|
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-11T09:
|
|
6
|
+
* Generated at: 2026-04-11T09:59:33.763Z
|
|
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-11T09:
|
|
3
|
+
* Generated at: 2026-04-11T09:59:33.718Z
|
|
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-11T09:
|
|
6
|
+
* Generated at: 2026-04-11T09:59:33.718Z
|
|
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-11T09:
|
|
3
|
+
* Generated at: 2026-04-11T09:59:33.732Z
|
|
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-11T09:
|
|
6
|
+
* Generated at: 2026-04-11T09:59:33.732Z
|
|
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-11T09:
|
|
3
|
+
* Generated at: 2026-04-11T09:59:33.729Z
|
|
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-11T09:
|
|
6
|
+
* Generated at: 2026-04-11T09:59:33.729Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.polymarketGammaSpec = {
|
|
@@ -26,6 +26,7 @@ export declare class PolymarketExchange extends PredictionMarketExchange {
|
|
|
26
26
|
watchAddress: true;
|
|
27
27
|
unwatchAddress: true;
|
|
28
28
|
watchOrderBook: true;
|
|
29
|
+
unwatchOrderBook: true;
|
|
29
30
|
watchTrades: true;
|
|
30
31
|
fetchMyTrades: true;
|
|
31
32
|
fetchClosedOrders: false;
|
|
@@ -72,6 +73,7 @@ export declare class PolymarketExchange extends PredictionMarketExchange {
|
|
|
72
73
|
fetchPositions(address?: string): Promise<Position[]>;
|
|
73
74
|
fetchBalance(address?: string): Promise<Balance[]>;
|
|
74
75
|
watchOrderBook(id: string, limit?: number): Promise<OrderBook>;
|
|
76
|
+
unwatchOrderBook(id: string): Promise<void>;
|
|
75
77
|
watchTrades(id: string, address?: string, since?: number, limit?: number): Promise<Trade[]>;
|
|
76
78
|
watchAddress(address: string, types?: SubscriptionOption[]): Promise<SubscribedAddressSnapshot>;
|
|
77
79
|
unwatchAddress(address: string): Promise<void>;
|
|
@@ -34,6 +34,7 @@ class PolymarketExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
34
34
|
watchAddress: true,
|
|
35
35
|
unwatchAddress: true,
|
|
36
36
|
watchOrderBook: true,
|
|
37
|
+
unwatchOrderBook: true,
|
|
37
38
|
watchTrades: true,
|
|
38
39
|
fetchMyTrades: true,
|
|
39
40
|
fetchClosedOrders: false,
|
|
@@ -438,6 +439,9 @@ class PolymarketExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
438
439
|
async watchOrderBook(id, limit) {
|
|
439
440
|
return this.ensureWs().watchOrderBook(id);
|
|
440
441
|
}
|
|
442
|
+
async unwatchOrderBook(id) {
|
|
443
|
+
return this.ensureWs().unwatchOrderBook(id);
|
|
444
|
+
}
|
|
441
445
|
async watchTrades(id, address, since, limit) {
|
|
442
446
|
return this.ensureWs().watchTrades(id, address);
|
|
443
447
|
}
|
|
@@ -30,6 +30,7 @@ export declare class PolymarketWebSocket {
|
|
|
30
30
|
private initializationPromise?;
|
|
31
31
|
constructor(callApi: (operationId: string, params?: Record<string, any>) => Promise<any>, config?: PolymarketWebSocketConfig);
|
|
32
32
|
watchOrderBook(id: string): Promise<OrderBook>;
|
|
33
|
+
unwatchOrderBook(id: string): Promise<void>;
|
|
33
34
|
watchTrades(id: string, address?: string): Promise<Trade[]>;
|
|
34
35
|
watchAddress(address: string, types: SubscriptionOption[]): Promise<SubscribedAddressSnapshot>;
|
|
35
36
|
unwatchAddress(address: string): Promise<void>;
|
|
@@ -82,6 +82,21 @@ class PolymarketWebSocket {
|
|
|
82
82
|
this.orderBookResolvers.get(id).push({ resolve, reject });
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
+
async unwatchOrderBook(id) {
|
|
86
|
+
if (!this.manager) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
await this.manager.removeSubscriptions([id]);
|
|
90
|
+
// Clear any pending resolvers for this asset
|
|
91
|
+
const resolvers = this.orderBookResolvers.get(id);
|
|
92
|
+
if (resolvers) {
|
|
93
|
+
this.orderBookResolvers = new Map([...this.orderBookResolvers].filter(([key]) => key !== id));
|
|
94
|
+
}
|
|
95
|
+
// Remove the cached orderbook for this asset
|
|
96
|
+
if (this.orderBooks.has(id)) {
|
|
97
|
+
this.orderBooks = new Map([...this.orderBooks].filter(([key]) => key !== id));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
85
100
|
async watchTrades(id, address) {
|
|
86
101
|
if (address) {
|
|
87
102
|
return this.watcher.watch(address, ['trades'], 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-04-11T09:
|
|
3
|
+
* Generated at: 2026-04-11T09:59:33.754Z
|
|
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-11T09:
|
|
6
|
+
* Generated at: 2026-04-11T09:59:33.754Z
|
|
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
|
@@ -1360,6 +1360,37 @@ paths:
|
|
|
1360
1360
|
description: >-
|
|
1361
1361
|
Watch order book updates in real-time via WebSocket. Returns a promise that resolves with the next order book
|
|
1362
1362
|
update. Call repeatedly in a loop to stream updates (CCXT Pro pattern).
|
|
1363
|
+
'/api/{exchange}/unwatchOrderBook':
|
|
1364
|
+
post:
|
|
1365
|
+
summary: Unwatch Order Book
|
|
1366
|
+
operationId: unwatchOrderBook
|
|
1367
|
+
parameters:
|
|
1368
|
+
- $ref: '#/components/parameters/ExchangeParam'
|
|
1369
|
+
requestBody:
|
|
1370
|
+
content:
|
|
1371
|
+
application/json:
|
|
1372
|
+
schema:
|
|
1373
|
+
title: UnwatchOrderBookRequest
|
|
1374
|
+
type: object
|
|
1375
|
+
properties:
|
|
1376
|
+
args:
|
|
1377
|
+
type: array
|
|
1378
|
+
maxItems: 1
|
|
1379
|
+
items:
|
|
1380
|
+
type: string
|
|
1381
|
+
minItems: 1
|
|
1382
|
+
credentials:
|
|
1383
|
+
$ref: '#/components/schemas/ExchangeCredentials'
|
|
1384
|
+
required:
|
|
1385
|
+
- args
|
|
1386
|
+
responses:
|
|
1387
|
+
'200':
|
|
1388
|
+
description: Unwatch Order Book response
|
|
1389
|
+
content:
|
|
1390
|
+
application/json:
|
|
1391
|
+
schema:
|
|
1392
|
+
$ref: '#/components/schemas/BaseResponse'
|
|
1393
|
+
description: Unsubscribe from a previously watched order book stream.
|
|
1363
1394
|
'/api/{exchange}/watchTrades':
|
|
1364
1395
|
post:
|
|
1365
1396
|
summary: Watch Trades
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxt-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.28.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.28.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.28.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",
|