pmxt-core 2.38.0 → 2.39.1
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 +14 -14
- package/dist/BaseExchange.js +19 -19
- package/dist/exchanges/baozi/index.d.ts +2 -2
- package/dist/exchanges/baozi/index.js +5 -5
- package/dist/exchanges/kalshi/api.d.ts +1 -1
- package/dist/exchanges/kalshi/api.js +1 -1
- package/dist/exchanges/kalshi/index.d.ts +6 -6
- package/dist/exchanges/kalshi/index.js +14 -14
- package/dist/exchanges/limitless/api.d.ts +1 -1
- package/dist/exchanges/limitless/api.js +1 -1
- package/dist/exchanges/limitless/index.d.ts +5 -5
- package/dist/exchanges/limitless/index.js +15 -12
- package/dist/exchanges/myriad/api.d.ts +1 -1
- package/dist/exchanges/myriad/api.js +1 -1
- package/dist/exchanges/myriad/index.d.ts +5 -5
- package/dist/exchanges/myriad/index.js +14 -14
- package/dist/exchanges/myriad/websocket.d.ts +2 -2
- package/dist/exchanges/myriad/websocket.js +12 -12
- package/dist/exchanges/opinion/api.d.ts +1 -1
- package/dist/exchanges/opinion/api.js +1 -1
- package/dist/exchanges/opinion/index.d.ts +4 -4
- package/dist/exchanges/opinion/index.js +9 -9
- 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 +8 -8
- package/dist/exchanges/polymarket/index.js +19 -19
- package/dist/exchanges/polymarket/websocket.d.ts +54 -3
- package/dist/exchanges/polymarket/websocket.js +146 -21
- package/dist/exchanges/polymarket_us/index.d.ts +3 -3
- package/dist/exchanges/polymarket_us/index.js +7 -7
- package/dist/exchanges/polymarket_us/websocket.d.ts +2 -2
- package/dist/exchanges/polymarket_us/websocket.js +6 -6
- package/dist/exchanges/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- package/dist/exchanges/probable/index.d.ts +4 -4
- package/dist/exchanges/probable/index.js +9 -9
- package/dist/exchanges/smarkets/index.d.ts +2 -2
- package/dist/exchanges/smarkets/index.js +5 -5
- package/dist/router/Router.d.ts +1 -1
- package/dist/router/Router.js +3 -3
- package/dist/server/method-verbs.json +7 -7
- package/dist/server/openapi.yaml +3 -3
- package/package.json +3 -3
|
@@ -27,10 +27,10 @@ export declare class ProbableExchange extends PredictionMarketExchange {
|
|
|
27
27
|
* @returns The UnifiedEvent, or null if not found
|
|
28
28
|
*/
|
|
29
29
|
getEventBySlug(slug: string): Promise<UnifiedEvent | null>;
|
|
30
|
-
fetchOrderBook(
|
|
31
|
-
fetchOHLCV(
|
|
30
|
+
fetchOrderBook(outcomeId: string): Promise<OrderBook>;
|
|
31
|
+
fetchOHLCV(outcomeId: string, params: OHLCVParams): Promise<PriceCandle[]>;
|
|
32
32
|
fetchMyTrades(params?: MyTradesParams): Promise<UserTrade[]>;
|
|
33
|
-
fetchTrades(
|
|
33
|
+
fetchTrades(outcomeId: string, params: TradesParams | HistoryFilterParams): Promise<Trade[]>;
|
|
34
34
|
createOrder(params: CreateOrderParams): Promise<Order>;
|
|
35
35
|
/**
|
|
36
36
|
* Cancel an order.
|
|
@@ -46,6 +46,6 @@ export declare class ProbableExchange extends PredictionMarketExchange {
|
|
|
46
46
|
fetchOpenOrders(marketId?: string): Promise<Order[]>;
|
|
47
47
|
fetchPositions(): Promise<Position[]>;
|
|
48
48
|
fetchBalance(): Promise<Balance[]>;
|
|
49
|
-
watchOrderBook(
|
|
49
|
+
watchOrderBook(outcomeId: string, limit?: number): Promise<OrderBook>;
|
|
50
50
|
close(): Promise<void>;
|
|
51
51
|
}
|
|
@@ -116,15 +116,15 @@ class ProbableExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
116
116
|
}
|
|
117
117
|
return event;
|
|
118
118
|
}
|
|
119
|
-
async fetchOrderBook(
|
|
120
|
-
const raw = await this.fetcher.fetchRawOrderBook(
|
|
121
|
-
return this.normalizer.normalizeOrderBook(raw,
|
|
119
|
+
async fetchOrderBook(outcomeId) {
|
|
120
|
+
const raw = await this.fetcher.fetchRawOrderBook(outcomeId);
|
|
121
|
+
return this.normalizer.normalizeOrderBook(raw, outcomeId);
|
|
122
122
|
}
|
|
123
|
-
async fetchOHLCV(
|
|
123
|
+
async fetchOHLCV(outcomeId, params) {
|
|
124
124
|
if (!params.resolution) {
|
|
125
125
|
throw new Error('fetchOHLCV requires a resolution parameter.');
|
|
126
126
|
}
|
|
127
|
-
const rawPoints = await this.fetcher.fetchRawOHLCV(
|
|
127
|
+
const rawPoints = await this.fetcher.fetchRawOHLCV(outcomeId, params);
|
|
128
128
|
return this.normalizer.normalizeOHLCV(rawPoints, params);
|
|
129
129
|
}
|
|
130
130
|
async fetchMyTrades(params) {
|
|
@@ -133,11 +133,11 @@ class ProbableExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
133
133
|
const rawTrades = await this.fetcher.fetchRawMyTrades(params || {}, address);
|
|
134
134
|
return rawTrades.map((raw, i) => this.normalizer.normalizeUserTrade(raw, i));
|
|
135
135
|
}
|
|
136
|
-
async fetchTrades(
|
|
136
|
+
async fetchTrades(outcomeId, params) {
|
|
137
137
|
const auth = this.ensureAuth();
|
|
138
138
|
const client = auth.getClobClient();
|
|
139
139
|
// Use CLOB client directly for trades (legacy behaviour preserved)
|
|
140
|
-
const queryParams = { tokenId:
|
|
140
|
+
const queryParams = { tokenId: outcomeId };
|
|
141
141
|
if (params.limit)
|
|
142
142
|
queryParams.limit = params.limit;
|
|
143
143
|
const response = await client.getTrades(queryParams);
|
|
@@ -359,11 +359,11 @@ class ProbableExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
359
359
|
// --------------------------------------------------------------------------
|
|
360
360
|
// WebSocket Streaming (public, no auth needed)
|
|
361
361
|
// --------------------------------------------------------------------------
|
|
362
|
-
async watchOrderBook(
|
|
362
|
+
async watchOrderBook(outcomeId, limit) {
|
|
363
363
|
if (!this.ws) {
|
|
364
364
|
this.ws = new websocket_1.ProbableWebSocket(this.wsConfig);
|
|
365
365
|
}
|
|
366
|
-
return this.ws.watchOrderBook(
|
|
366
|
+
return this.ws.watchOrderBook(outcomeId);
|
|
367
367
|
}
|
|
368
368
|
async close() {
|
|
369
369
|
if (this.ws) {
|
|
@@ -18,8 +18,8 @@ export declare class SmarketsExchange extends PredictionMarketExchange {
|
|
|
18
18
|
private requireAuth;
|
|
19
19
|
protected fetchMarketsImpl(params?: MarketFilterParams): Promise<UnifiedMarket[]>;
|
|
20
20
|
protected fetchEventsImpl(params: EventFetchParams): Promise<UnifiedEvent[]>;
|
|
21
|
-
fetchOrderBook(
|
|
22
|
-
fetchTrades(
|
|
21
|
+
fetchOrderBook(outcomeId: string): Promise<OrderBook>;
|
|
22
|
+
fetchTrades(outcomeId: string, params: TradesParams | HistoryFilterParams): Promise<Trade[]>;
|
|
23
23
|
fetchBalance(): Promise<Balance[]>;
|
|
24
24
|
fetchMyTrades(params?: MyTradesParams): Promise<UserTrade[]>;
|
|
25
25
|
fetchPositions(): Promise<Position[]>;
|
|
@@ -158,16 +158,16 @@ class SmarketsExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
158
158
|
.filter((e) => e !== null)
|
|
159
159
|
.slice(0, limit);
|
|
160
160
|
}
|
|
161
|
-
async fetchOrderBook(
|
|
162
|
-
const raw = await this.fetcher.fetchRawOrderBook(
|
|
163
|
-
return this.normalizer.normalizeOrderBook(raw,
|
|
161
|
+
async fetchOrderBook(outcomeId) {
|
|
162
|
+
const raw = await this.fetcher.fetchRawOrderBook(outcomeId);
|
|
163
|
+
return this.normalizer.normalizeOrderBook(raw, outcomeId);
|
|
164
164
|
}
|
|
165
|
-
async fetchTrades(
|
|
165
|
+
async fetchTrades(outcomeId, params) {
|
|
166
166
|
if ('resolution' in params && params.resolution !== undefined) {
|
|
167
167
|
console.warn('[pmxt] Warning: The "resolution" parameter is deprecated for fetchTrades() and will be ignored. ' +
|
|
168
168
|
'It will be removed in v3.0.0. Please remove it from your code.');
|
|
169
169
|
}
|
|
170
|
-
const rawActivity = await this.fetcher.fetchRawTradeActivity(
|
|
170
|
+
const rawActivity = await this.fetcher.fetchRawTradeActivity(outcomeId, params);
|
|
171
171
|
return rawActivity.map((raw, i) => this.normalizer.normalizeActivityTrade(raw, i));
|
|
172
172
|
}
|
|
173
173
|
// -------------------------------------------------------------------------
|
package/dist/router/Router.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare class Router extends PredictionMarketExchange {
|
|
|
8
8
|
get name(): string;
|
|
9
9
|
protected fetchMarketsImpl(params?: MarketFetchParams): Promise<UnifiedMarket[]>;
|
|
10
10
|
protected fetchEventsImpl(params?: EventFetchParams): Promise<UnifiedEvent[]>;
|
|
11
|
-
fetchOrderBook(
|
|
11
|
+
fetchOrderBook(outcomeId: string, side?: 'yes' | 'no'): Promise<OrderBook>;
|
|
12
12
|
fetchMarketMatches(params?: FetchMarketMatchesParams): Promise<MatchResult[]>;
|
|
13
13
|
/**
|
|
14
14
|
* Browse mode: fetch all matched market pairs from the catalog.
|
package/dist/router/Router.js
CHANGED
|
@@ -64,7 +64,7 @@ class Router extends BaseExchange_1.PredictionMarketExchange {
|
|
|
64
64
|
// -----------------------------------------------------------------------
|
|
65
65
|
// Unified orderbook (cross-exchange merge)
|
|
66
66
|
// -----------------------------------------------------------------------
|
|
67
|
-
async fetchOrderBook(
|
|
67
|
+
async fetchOrderBook(outcomeId, side) {
|
|
68
68
|
const exchangeNames = Object.keys(this.exchanges);
|
|
69
69
|
if (exchangeNames.length === 0) {
|
|
70
70
|
throw new Error('Router requires exchange instances for fetchOrderBook. Pass exchanges in RouterOptions.');
|
|
@@ -72,7 +72,7 @@ class Router extends BaseExchange_1.PredictionMarketExchange {
|
|
|
72
72
|
const resolvedSide = side ?? 'yes';
|
|
73
73
|
// Find identity matches across venues
|
|
74
74
|
const matches = await this.fetchMarketMatches({
|
|
75
|
-
marketId:
|
|
75
|
+
marketId: outcomeId,
|
|
76
76
|
relation: 'identity',
|
|
77
77
|
});
|
|
78
78
|
const fetchPromises = [];
|
|
@@ -92,7 +92,7 @@ class Router extends BaseExchange_1.PredictionMarketExchange {
|
|
|
92
92
|
for (const [name, exchange] of Object.entries(this.exchanges)) {
|
|
93
93
|
if (matchedVenues.has(name))
|
|
94
94
|
continue;
|
|
95
|
-
fetchPromises.push(exchange.fetchOrderBook(
|
|
95
|
+
fetchPromises.push(exchange.fetchOrderBook(outcomeId, resolvedSide).catch(() => null));
|
|
96
96
|
}
|
|
97
97
|
const books = (await Promise.all(fetchPromises)).filter((b) => b !== null);
|
|
98
98
|
if (books.length === 0) {
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"verb": "get",
|
|
74
74
|
"args": [
|
|
75
75
|
{
|
|
76
|
-
"name": "
|
|
76
|
+
"name": "outcomeId",
|
|
77
77
|
"kind": "string",
|
|
78
78
|
"optional": false
|
|
79
79
|
},
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"verb": "get",
|
|
89
89
|
"args": [
|
|
90
90
|
{
|
|
91
|
-
"name": "
|
|
91
|
+
"name": "outcomeId",
|
|
92
92
|
"kind": "string",
|
|
93
93
|
"optional": false
|
|
94
94
|
},
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"verb": "get",
|
|
104
104
|
"args": [
|
|
105
105
|
{
|
|
106
|
-
"name": "
|
|
106
|
+
"name": "outcomeId",
|
|
107
107
|
"kind": "string",
|
|
108
108
|
"optional": false
|
|
109
109
|
},
|
|
@@ -298,7 +298,7 @@
|
|
|
298
298
|
"verb": "post",
|
|
299
299
|
"args": [
|
|
300
300
|
{
|
|
301
|
-
"name": "
|
|
301
|
+
"name": "outcomeId",
|
|
302
302
|
"kind": "string",
|
|
303
303
|
"optional": false
|
|
304
304
|
},
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
"verb": "post",
|
|
314
314
|
"args": [
|
|
315
315
|
{
|
|
316
|
-
"name": "
|
|
316
|
+
"name": "outcomeIds",
|
|
317
317
|
"kind": "unknown",
|
|
318
318
|
"optional": false
|
|
319
319
|
},
|
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
"verb": "post",
|
|
329
329
|
"args": [
|
|
330
330
|
{
|
|
331
|
-
"name": "
|
|
331
|
+
"name": "outcomeId",
|
|
332
332
|
"kind": "string",
|
|
333
333
|
"optional": false
|
|
334
334
|
}
|
|
@@ -338,7 +338,7 @@
|
|
|
338
338
|
"verb": "post",
|
|
339
339
|
"args": [
|
|
340
340
|
{
|
|
341
|
-
"name": "
|
|
341
|
+
"name": "outcomeId",
|
|
342
342
|
"kind": "string",
|
|
343
343
|
"optional": false
|
|
344
344
|
},
|
package/dist/server/openapi.yaml
CHANGED
|
@@ -584,7 +584,7 @@ paths:
|
|
|
584
584
|
parameters:
|
|
585
585
|
- $ref: '#/components/parameters/ExchangeParam'
|
|
586
586
|
- in: query
|
|
587
|
-
name:
|
|
587
|
+
name: outcomeId
|
|
588
588
|
required: true
|
|
589
589
|
schema:
|
|
590
590
|
type: string
|
|
@@ -636,7 +636,7 @@ paths:
|
|
|
636
636
|
parameters:
|
|
637
637
|
- $ref: '#/components/parameters/ExchangeParam'
|
|
638
638
|
- in: query
|
|
639
|
-
name:
|
|
639
|
+
name: outcomeId
|
|
640
640
|
required: true
|
|
641
641
|
schema:
|
|
642
642
|
type: string
|
|
@@ -667,7 +667,7 @@ paths:
|
|
|
667
667
|
parameters:
|
|
668
668
|
- $ref: '#/components/parameters/ExchangeParam'
|
|
669
669
|
- in: query
|
|
670
|
-
name:
|
|
670
|
+
name: outcomeId
|
|
671
671
|
required: true
|
|
672
672
|
schema:
|
|
673
673
|
type: string
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxt-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.39.1",
|
|
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.39.1,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.39.1,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",
|