pmxt-core 2.40.4 → 2.40.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/exchanges/kalshi/api.d.ts +1 -1
- package/dist/exchanges/kalshi/api.js +1 -1
- 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/fetcher.d.ts +4 -0
- package/dist/exchanges/myriad/fetcher.js +15 -0
- package/dist/exchanges/myriad/index.js +15 -0
- package/dist/exchanges/myriad/normalizer.d.ts +4 -0
- package/dist/exchanges/myriad/normalizer.js +32 -3
- 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/errors.js +9 -0
- package/dist/exchanges/polymarket/index.js +5 -5
- package/dist/exchanges/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- 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-12T19:35:04.170Z
|
|
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-12T19:35:04.170Z
|
|
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-05-
|
|
3
|
+
* Generated at: 2026-05-12T19:35:04.204Z
|
|
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-12T19:35:04.204Z
|
|
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-12T19:35:04.215Z
|
|
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-12T19:35:04.215Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.myriadApiSpec = {
|
|
@@ -63,6 +63,10 @@ export declare class MyriadFetcher implements IExchangeFetcher<MyriadRawMarket,
|
|
|
63
63
|
fetchRawMarkets(params?: MarketFilterParams): Promise<MyriadRawMarket[]>;
|
|
64
64
|
fetchRawEvents(params: EventFetchParams): Promise<MyriadRawQuestion[]>;
|
|
65
65
|
fetchRawOHLCV(id: string, _params: OHLCVParams): Promise<MyriadRawMarket>;
|
|
66
|
+
fetchClobOrderBook(networkId: string, marketId: string, outcome: number): Promise<{
|
|
67
|
+
bids: [string, string][];
|
|
68
|
+
asks: [string, string][];
|
|
69
|
+
} | null>;
|
|
66
70
|
fetchRawOrderBook(id: string): Promise<MyriadRawMarket>;
|
|
67
71
|
fetchRawTrades(id: string, params: TradesParams): Promise<MyriadRawTradeEvent[]>;
|
|
68
72
|
fetchRawMyTrades(params: MyTradesParams, walletAddress: string): Promise<MyriadRawTradeEvent[]>;
|
|
@@ -118,6 +118,21 @@ class MyriadFetcher {
|
|
|
118
118
|
throw errors_1.myriadErrorMapper.mapError(error);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
+
async fetchClobOrderBook(networkId, marketId, outcome) {
|
|
122
|
+
try {
|
|
123
|
+
const response = await this.ctx.http.get(`${this.baseUrl}/markets/${marketId}/orderbook`, {
|
|
124
|
+
params: { network_id: Number(networkId), outcome },
|
|
125
|
+
headers: this.ctx.getHeaders(),
|
|
126
|
+
});
|
|
127
|
+
const data = response.data;
|
|
128
|
+
if (data.error)
|
|
129
|
+
return null;
|
|
130
|
+
return { bids: data.bids || [], asks: data.asks || [] };
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
121
136
|
async fetchRawOrderBook(id) {
|
|
122
137
|
try {
|
|
123
138
|
const parts = id.split(':');
|
|
@@ -89,6 +89,21 @@ class MyriadExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
89
89
|
return this.normalizer.normalizeOHLCV(rawMarket, params, parsedOutcomeId);
|
|
90
90
|
}
|
|
91
91
|
async fetchOrderBook(outcomeId) {
|
|
92
|
+
const parts = outcomeId.split(':');
|
|
93
|
+
if (parts.length >= 3) {
|
|
94
|
+
const [networkId, marketId, oid] = parts;
|
|
95
|
+
const numericOid = Number(oid);
|
|
96
|
+
// CLOB markets expose a real orderbook endpoint.
|
|
97
|
+
// For binary markets outcome is 0 (YES) or 1 (NO).
|
|
98
|
+
// For AMM markets the endpoint returns an error and we fall back.
|
|
99
|
+
if (!isNaN(numericOid) && numericOid >= 0) {
|
|
100
|
+
const clob = await this.fetcher.fetchClobOrderBook(networkId, marketId, numericOid);
|
|
101
|
+
if (clob) {
|
|
102
|
+
return this.normalizer.normalizeClobOrderBook(clob);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// AMM fallback: emulate orderbook from spot prices
|
|
92
107
|
const rawMarket = await this.fetcher.fetchRawOrderBook(outcomeId);
|
|
93
108
|
return this.normalizer.normalizeOrderBook(rawMarket, outcomeId);
|
|
94
109
|
}
|
|
@@ -7,6 +7,10 @@ export declare class MyriadNormalizer implements IExchangeNormalizer<MyriadRawMa
|
|
|
7
7
|
normalizeEvent(raw: MyriadRawQuestion): UnifiedEvent | null;
|
|
8
8
|
normalizeOHLCV(raw: MyriadRawMarket, params: OHLCVParams, outcomeId?: string): PriceCandle[];
|
|
9
9
|
normalizeOrderBook(raw: MyriadRawMarket, id: string): OrderBook;
|
|
10
|
+
normalizeClobOrderBook(raw: {
|
|
11
|
+
bids: [string, string][];
|
|
12
|
+
asks: [string, string][];
|
|
13
|
+
}): OrderBook;
|
|
10
14
|
normalizeTrade(raw: MyriadRawTradeEvent, index: number): Trade;
|
|
11
15
|
normalizeUserTrade(raw: MyriadRawTradeEvent, index: number): UserTrade;
|
|
12
16
|
normalizePosition(raw: MyriadRawPortfolioItem): Position;
|
|
@@ -140,11 +140,26 @@ class MyriadNormalizer {
|
|
|
140
140
|
const parts = id.split(':');
|
|
141
141
|
const outcomeId = parts.length >= 3 ? parts[2] : undefined;
|
|
142
142
|
const outcomes = raw.outcomes || [];
|
|
143
|
-
|
|
144
|
-
if (!outcome) {
|
|
143
|
+
if (!outcomes.length) {
|
|
145
144
|
return { bids: [], asks: [], timestamp: Date.now() };
|
|
146
145
|
}
|
|
147
|
-
const
|
|
146
|
+
const numericId = Number(outcomeId);
|
|
147
|
+
let price;
|
|
148
|
+
if (!isNaN(numericId) && numericId < 0) {
|
|
149
|
+
// Synthetic NO outcome (negative ID from normalizeEvent).
|
|
150
|
+
// The NO price is the sum of all other outcomes in the AMM pool.
|
|
151
|
+
const positiveId = -numericId;
|
|
152
|
+
price = outcomes
|
|
153
|
+
.filter((o) => Number(o.id) !== positiveId)
|
|
154
|
+
.reduce((sum, o) => sum + (Number(o.price) || 0), 0);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
const outcome = outcomes.find((o) => String(o.id) === outcomeId) || outcomes[0];
|
|
158
|
+
if (!outcome) {
|
|
159
|
+
return { bids: [], asks: [], timestamp: Date.now() };
|
|
160
|
+
}
|
|
161
|
+
price = Number(outcome.price) || 0;
|
|
162
|
+
}
|
|
148
163
|
const liquidity = Number(raw.liquidity || 0);
|
|
149
164
|
const size = liquidity > 0 ? liquidity : 1;
|
|
150
165
|
return {
|
|
@@ -153,6 +168,20 @@ class MyriadNormalizer {
|
|
|
153
168
|
timestamp: Date.now(),
|
|
154
169
|
};
|
|
155
170
|
}
|
|
171
|
+
normalizeClobOrderBook(raw) {
|
|
172
|
+
const WEI = 1e18;
|
|
173
|
+
return {
|
|
174
|
+
bids: raw.bids.map(([priceWei, sizeWei]) => ({
|
|
175
|
+
price: Number(priceWei) / WEI,
|
|
176
|
+
size: Number(sizeWei) / WEI,
|
|
177
|
+
})),
|
|
178
|
+
asks: raw.asks.map(([priceWei, sizeWei]) => ({
|
|
179
|
+
price: Number(priceWei) / WEI,
|
|
180
|
+
size: Number(sizeWei) / WEI,
|
|
181
|
+
})),
|
|
182
|
+
timestamp: Date.now(),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
156
185
|
normalizeTrade(raw, index) {
|
|
157
186
|
return {
|
|
158
187
|
id: `${raw.blockNumber || raw.timestamp}-${index}`,
|
|
@@ -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-12T19:35:04.219Z
|
|
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-12T19:35:04.219Z
|
|
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-12T19:35:04.175Z
|
|
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-12T19:35:04.175Z
|
|
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-12T19:35:04.187Z
|
|
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-12T19:35:04.187Z
|
|
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-12T19:35:04.184Z
|
|
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-12T19:35:04.184Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.polymarketGammaSpec = {
|
|
@@ -58,6 +58,15 @@ class PolymarketErrorMapper extends error_mapper_1.ErrorMapper {
|
|
|
58
58
|
*/
|
|
59
59
|
mapBadRequestError(message, data) {
|
|
60
60
|
const lowerMessage = message.toLowerCase();
|
|
61
|
+
// Signature type / maker address mismatch — the most common auth
|
|
62
|
+
// misconfiguration. Surface actionable guidance so users don't have
|
|
63
|
+
// to guess which signature_type to use.
|
|
64
|
+
if (lowerMessage.includes('maker address not allowed') ||
|
|
65
|
+
lowerMessage.includes('deposit wallet')) {
|
|
66
|
+
return new errors_1.AuthenticationError(`${message}. Your signature_type may be wrong for this account. ` +
|
|
67
|
+
`Try signature_type='deposit_wallet' (newest accounts), ` +
|
|
68
|
+
`'gnosis_safe' (2023-era accounts), or 'polyproxy' (legacy accounts).`, this.exchangeName);
|
|
69
|
+
}
|
|
61
70
|
// Authentication errors surfaced as 400
|
|
62
71
|
if (lowerMessage.includes('api key') ||
|
|
63
72
|
lowerMessage.includes('proxy') ||
|
|
@@ -413,11 +413,11 @@ class PolymarketExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
413
413
|
const msg = String(ordersError?.message ?? ordersError);
|
|
414
414
|
if (msg.includes('is not iterable')) {
|
|
415
415
|
throw new errors_1.AuthenticationError('Polymarket CLOB rejected the request to list open orders. ' +
|
|
416
|
-
'This usually means
|
|
417
|
-
'
|
|
418
|
-
'
|
|
419
|
-
'
|
|
420
|
-
'
|
|
416
|
+
'This usually means your signature_type is wrong for this account, ' +
|
|
417
|
+
'or the wallet has not completed Polymarket onboarding. ' +
|
|
418
|
+
"Try signature_type='deposit_wallet' (newest accounts), " +
|
|
419
|
+
"'gnosis_safe' (2023-era accounts), or 'polyproxy' (legacy accounts). " +
|
|
420
|
+
'If none work, visit https://polymarket.com to complete account setup.', 'Polymarket');
|
|
421
421
|
}
|
|
422
422
|
// Unexpected failure — surface through the standard mapper.
|
|
423
423
|
throw ordersError;
|
|
@@ -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-12T19:35:04.208Z
|
|
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-12T19:35:04.208Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.probableApiSpec = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmxt-core",
|
|
3
|
-
"version": "2.40.
|
|
3
|
+
"version": "2.40.6",
|
|
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.40.
|
|
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.40.
|
|
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.40.6,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.40.6,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",
|