pmxt-core 2.43.20 → 2.43.25
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/baozi/errors.d.ts +1 -1
- package/dist/exchanges/baozi/errors.js +1 -1
- package/dist/exchanges/gemini-titan/errors.d.ts +3 -3
- package/dist/exchanges/gemini-titan/errors.js +1 -1
- package/dist/exchanges/gemini-titan/index.js +1 -1
- package/dist/exchanges/gemini-titan/normalizer.js +2 -2
- package/dist/exchanges/hyperliquid/errors.d.ts +3 -3
- package/dist/exchanges/hyperliquid/errors.js +1 -1
- package/dist/exchanges/hyperliquid/index.js +1 -1
- package/dist/exchanges/kalshi/api.d.ts +1 -1
- package/dist/exchanges/kalshi/api.js +1 -1
- package/dist/exchanges/kalshi/auth.js +3 -0
- package/dist/exchanges/kalshi/errors.d.ts +2 -2
- package/dist/exchanges/kalshi/fetcher.d.ts +1 -0
- package/dist/exchanges/kalshi/index.js +1 -1
- package/dist/exchanges/kalshi/normalizer.d.ts +1 -1
- package/dist/exchanges/kalshi/normalizer.js +4 -4
- package/dist/exchanges/limitless/api.d.ts +1 -1
- package/dist/exchanges/limitless/api.js +1 -1
- package/dist/exchanges/limitless/auth.js +3 -0
- package/dist/exchanges/limitless/errors.d.ts +2 -2
- package/dist/exchanges/limitless/index.js +1 -1
- package/dist/exchanges/metaculus/cancelOrder.d.ts +1 -1
- package/dist/exchanges/metaculus/cancelOrder.js +3 -3
- package/dist/exchanges/metaculus/errors.d.ts +3 -3
- package/dist/exchanges/mock/index.js +32 -15
- package/dist/exchanges/myriad/api.d.ts +1 -1
- package/dist/exchanges/myriad/api.js +1 -1
- package/dist/exchanges/myriad/errors.d.ts +2 -2
- package/dist/exchanges/opinion/api.d.ts +1 -1
- package/dist/exchanges/opinion/api.js +1 -1
- package/dist/exchanges/opinion/errors.d.ts +2 -2
- package/dist/exchanges/opinion/errors.js +4 -3
- package/dist/exchanges/opinion/index.js +1 -1
- package/dist/exchanges/opinion/utils.d.ts +1 -1
- package/dist/exchanges/opinion/utils.js +2 -2
- 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/auth.js +22 -3
- package/dist/exchanges/polymarket/errors.d.ts +3 -3
- package/dist/exchanges/polymarket/fetcher.js +3 -0
- package/dist/exchanges/polymarket/index.js +1 -1
- package/dist/exchanges/polymarket_us/normalizer.js +3 -3
- package/dist/exchanges/probable/api.d.ts +1 -1
- package/dist/exchanges/probable/api.js +1 -1
- package/dist/exchanges/probable/errors.d.ts +2 -2
- package/dist/exchanges/probable/errors.js +1 -1
- package/dist/exchanges/probable/index.js +2 -2
- package/dist/exchanges/smarkets/auth.js +6 -0
- package/dist/exchanges/smarkets/errors.d.ts +3 -3
- package/dist/exchanges/smarkets/errors.js +7 -2
- package/dist/feeds/binance/binance-feed.js +11 -2
- package/dist/feeds/chainlink/chainlink-feed.js +9 -3
- package/dist/router/Router.js +1 -3
- package/dist/router/client.d.ts +16 -8
- package/dist/router/client.js +7 -3
- package/dist/server/openapi.yaml +1 -1
- package/dist/subscriber/external/goldsky.d.ts +2 -1
- package/dist/subscriber/external/goldsky.js +33 -14
- package/dist/types.d.ts +1 -1
- package/dist/utils/error-mapper.d.ts +7 -7
- package/dist/utils/error-mapper.js +54 -47
- package/package.json +3 -3
|
@@ -5,7 +5,7 @@ import { BaseError } from '../../errors';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class BaoziErrorMapper extends ErrorMapper {
|
|
7
7
|
constructor();
|
|
8
|
-
mapError(error:
|
|
8
|
+
mapError(error: unknown): BaseError;
|
|
9
9
|
private extractAnchorError;
|
|
10
10
|
}
|
|
11
11
|
export declare const baoziErrorMapper: BaoziErrorMapper;
|
|
@@ -22,7 +22,7 @@ class BaoziErrorMapper extends error_mapper_1.ErrorMapper {
|
|
|
22
22
|
}
|
|
23
23
|
mapError(error) {
|
|
24
24
|
// Handle Solana transaction errors
|
|
25
|
-
if (error
|
|
25
|
+
if (error instanceof Error) {
|
|
26
26
|
const msg = error.message;
|
|
27
27
|
// Solana insufficient funds
|
|
28
28
|
if (msg.includes('Attempt to debit an account but found no record of a prior credit') ||
|
|
@@ -13,8 +13,8 @@ import { BadRequest } from '../../errors';
|
|
|
13
13
|
*/
|
|
14
14
|
export declare class GeminiErrorMapper extends ErrorMapper {
|
|
15
15
|
constructor();
|
|
16
|
-
protected extractErrorMessage(error:
|
|
17
|
-
protected mapBadRequestError(message: string, data:
|
|
18
|
-
mapError(error:
|
|
16
|
+
protected extractErrorMessage(error: unknown): string;
|
|
17
|
+
protected mapBadRequestError(message: string, data: unknown): BadRequest;
|
|
18
|
+
mapError(error: unknown): ReturnType<ErrorMapper['mapError']>;
|
|
19
19
|
}
|
|
20
20
|
export declare const geminiErrorMapper: GeminiErrorMapper;
|
|
@@ -38,7 +38,7 @@ class GeminiErrorMapper extends error_mapper_1.ErrorMapper {
|
|
|
38
38
|
return super.extractErrorMessage(error);
|
|
39
39
|
}
|
|
40
40
|
mapBadRequestError(message, data) {
|
|
41
|
-
const reason = typeof data === 'object' && data
|
|
41
|
+
const reason = typeof data === 'object' && data !== null && 'reason' in data
|
|
42
42
|
? String(data.reason)
|
|
43
43
|
: '';
|
|
44
44
|
const lowerReason = reason.toLowerCase();
|
|
@@ -23,8 +23,8 @@ function mapOrderStatus(geminiStatus) {
|
|
|
23
23
|
case 'open': return 'open';
|
|
24
24
|
case 'accepted': return 'open';
|
|
25
25
|
case 'filled': return 'filled';
|
|
26
|
-
case 'cancelled': return '
|
|
27
|
-
case 'canceled': return '
|
|
26
|
+
case 'cancelled': return 'canceled';
|
|
27
|
+
case 'canceled': return 'canceled';
|
|
28
28
|
case 'rejected': return 'rejected';
|
|
29
29
|
default: return 'open';
|
|
30
30
|
}
|
|
@@ -11,8 +11,8 @@ import { BadRequest } from '../../errors';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class HyperliquidErrorMapper extends ErrorMapper {
|
|
13
13
|
constructor();
|
|
14
|
-
protected extractErrorMessage(error:
|
|
15
|
-
protected mapBadRequestError(message: string, data:
|
|
16
|
-
mapError(error:
|
|
14
|
+
protected extractErrorMessage(error: unknown): string;
|
|
15
|
+
protected mapBadRequestError(message: string, data: unknown): BadRequest;
|
|
16
|
+
mapError(error: unknown): ReturnType<ErrorMapper['mapError']>;
|
|
17
17
|
}
|
|
18
18
|
export declare const hyperliquidErrorMapper: HyperliquidErrorMapper;
|
|
@@ -34,7 +34,7 @@ class HyperliquidErrorMapper extends error_mapper_1.ErrorMapper {
|
|
|
34
34
|
}
|
|
35
35
|
mapBadRequestError(message, data) {
|
|
36
36
|
const lowerMessage = message.toLowerCase();
|
|
37
|
-
const responseStr = typeof data === 'object' && data
|
|
37
|
+
const responseStr = typeof data === 'object' && data !== null && 'response' in data
|
|
38
38
|
? String(data.response).toLowerCase()
|
|
39
39
|
: lowerMessage;
|
|
40
40
|
if (responseStr.includes('insufficient margin') || responseStr.includes('not enough')) {
|
|
@@ -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-24T18:32:06.453Z
|
|
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-24T18:32:06.453Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.kalshiApiSpec = {
|
|
@@ -83,6 +83,9 @@ class KalshiAuth {
|
|
|
83
83
|
// Allow input of private key in both raw string or PEM format
|
|
84
84
|
// If it's a raw key without headers, accessing it might be tricky with implicit types,
|
|
85
85
|
// but standard PEM is best. We assume the user provides a valid PEM.
|
|
86
|
+
if (!this.credentials.privateKey) {
|
|
87
|
+
throw new Error('[kalshi] privateKey is required for authenticated requests');
|
|
88
|
+
}
|
|
86
89
|
let privateKey = this.credentials.privateKey;
|
|
87
90
|
// Fix for common .env issue where newlines are escaped
|
|
88
91
|
if (privateKey.includes('\\n')) {
|
|
@@ -10,10 +10,10 @@ export declare class KalshiErrorMapper extends ErrorMapper {
|
|
|
10
10
|
/**
|
|
11
11
|
* Override to handle Kalshi-specific error patterns
|
|
12
12
|
*/
|
|
13
|
-
protected extractErrorMessage(error:
|
|
13
|
+
protected extractErrorMessage(error: unknown): string;
|
|
14
14
|
/**
|
|
15
15
|
* Override to detect Kalshi-specific error patterns
|
|
16
16
|
*/
|
|
17
|
-
protected mapBadRequestError(message: string, data:
|
|
17
|
+
protected mapBadRequestError(message: string, data: unknown): BadRequest;
|
|
18
18
|
}
|
|
19
19
|
export declare const kalshiErrorMapper: KalshiErrorMapper;
|
|
@@ -260,7 +260,7 @@ class KalshiExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
260
260
|
side: order.side === 'yes' ? 'buy' : 'sell',
|
|
261
261
|
type: 'limit',
|
|
262
262
|
amount: order.count,
|
|
263
|
-
status: '
|
|
263
|
+
status: 'canceled',
|
|
264
264
|
filled: order.count - (order.remaining_count || 0),
|
|
265
265
|
remaining: 0,
|
|
266
266
|
timestamp: new Date(order.created_time).getTime(),
|
|
@@ -25,4 +25,4 @@ export declare class KalshiNormalizer implements IExchangeNormalizer<KalshiRawEv
|
|
|
25
25
|
private cleanLabel;
|
|
26
26
|
private templateRule;
|
|
27
27
|
}
|
|
28
|
-
export declare function sortRawEvents(events:
|
|
28
|
+
export declare function sortRawEvents(events: KalshiRawEvent[], sort: string): KalshiRawEvent[];
|
|
@@ -125,9 +125,9 @@ class KalshiNormalizer {
|
|
|
125
125
|
const pf = p[field];
|
|
126
126
|
const af = ask[field];
|
|
127
127
|
const bf = bid[field];
|
|
128
|
-
if (pf
|
|
128
|
+
if (pf != null)
|
|
129
129
|
return pf;
|
|
130
|
-
if (af
|
|
130
|
+
if (af != null && bf != null) {
|
|
131
131
|
return (af + bf) / 2;
|
|
132
132
|
}
|
|
133
133
|
return p.previous || 0;
|
|
@@ -257,7 +257,7 @@ class KalshiNormalizer {
|
|
|
257
257
|
switch ((status ?? '').toLowerCase()) {
|
|
258
258
|
case 'resting': return 'open';
|
|
259
259
|
case 'canceled':
|
|
260
|
-
case 'cancelled': return '
|
|
260
|
+
case 'cancelled': return 'canceled';
|
|
261
261
|
case 'executed':
|
|
262
262
|
case 'filled': return 'filled';
|
|
263
263
|
default: return 'open';
|
|
@@ -337,7 +337,7 @@ function eventVolume(event) {
|
|
|
337
337
|
return (event.markets || []).reduce((sum, m) => sum + (parseFloat(m.volume_fp ?? '') || Number(m.volume || 0)), 0);
|
|
338
338
|
}
|
|
339
339
|
function eventLiquidity(event) {
|
|
340
|
-
return (event.markets || []).reduce((sum, m) => sum + (parseFloat(m.open_interest_fp ?? '') || parseFloat(m.liquidity_dollars || m.open_interest || m.liquidity || '0') || 0), 0);
|
|
340
|
+
return (event.markets || []).reduce((sum, m) => sum + (parseFloat(m.open_interest_fp ?? '') || parseFloat(String(m.liquidity_dollars || m.open_interest || m.liquidity || '0')) || 0), 0);
|
|
341
341
|
}
|
|
342
342
|
function eventNewest(event) {
|
|
343
343
|
const times = (event.markets || [])
|
|
@@ -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-24T18:32:06.491Z
|
|
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-24T18:32:06.491Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.limitlessApiSpec = {
|
|
@@ -10,10 +10,10 @@ export declare class LimitlessErrorMapper extends ErrorMapper {
|
|
|
10
10
|
/**
|
|
11
11
|
* Override to handle Limitless-specific error patterns
|
|
12
12
|
*/
|
|
13
|
-
protected extractErrorMessage(error:
|
|
13
|
+
protected extractErrorMessage(error: unknown): string;
|
|
14
14
|
/**
|
|
15
15
|
* Override to detect Limitless-specific error patterns
|
|
16
16
|
*/
|
|
17
|
-
protected mapBadRequestError(message: string, data:
|
|
17
|
+
protected mapBadRequestError(message: string, data: unknown): BadRequest;
|
|
18
18
|
}
|
|
19
19
|
export declare const limitlessErrorMapper: LimitlessErrorMapper;
|
|
@@ -32,7 +32,7 @@ export interface CancelOrderContext {
|
|
|
32
32
|
*
|
|
33
33
|
* @param orderId The Metaculus question ID to withdraw the forecast from.
|
|
34
34
|
* @param ctx HTTP client and auth context.
|
|
35
|
-
* @returns A synthetic Order with status "
|
|
35
|
+
* @returns A synthetic Order with status "canceled".
|
|
36
36
|
*
|
|
37
37
|
* @throws {AuthenticationError} If no API token is configured.
|
|
38
38
|
* @throws {ValidationError} If the orderId is not a valid numeric question ID.
|
|
@@ -24,7 +24,7 @@ const errors_2 = require("./errors");
|
|
|
24
24
|
*
|
|
25
25
|
* @param orderId The Metaculus question ID to withdraw the forecast from.
|
|
26
26
|
* @param ctx HTTP client and auth context.
|
|
27
|
-
* @returns A synthetic Order with status "
|
|
27
|
+
* @returns A synthetic Order with status "canceled".
|
|
28
28
|
*
|
|
29
29
|
* @throws {AuthenticationError} If no API token is configured.
|
|
30
30
|
* @throws {ValidationError} If the orderId is not a valid numeric question ID.
|
|
@@ -51,7 +51,7 @@ async function cancelOrder(orderId, ctx) {
|
|
|
51
51
|
data: [{ question: questionId }],
|
|
52
52
|
headers: { "Content-Type": "application/json", ...headers },
|
|
53
53
|
});
|
|
54
|
-
// 4. Return synthetic
|
|
54
|
+
// 4. Return synthetic canceled order
|
|
55
55
|
return {
|
|
56
56
|
id: `mc-withdraw-${questionId}-${Date.now()}`,
|
|
57
57
|
marketId: orderId,
|
|
@@ -59,7 +59,7 @@ async function cancelOrder(orderId, ctx) {
|
|
|
59
59
|
side: "buy",
|
|
60
60
|
type: "market",
|
|
61
61
|
amount: 1,
|
|
62
|
-
status: "
|
|
62
|
+
status: "canceled",
|
|
63
63
|
filled: 0,
|
|
64
64
|
remaining: 0,
|
|
65
65
|
timestamp: Date.now(),
|
|
@@ -11,11 +11,11 @@ import { NotFound, BadRequest, BaseError } from '../../errors';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class MetaculusErrorMapper extends ErrorMapper {
|
|
13
13
|
constructor();
|
|
14
|
-
protected mapNotFoundError(message: string, _data:
|
|
15
|
-
protected mapBadRequestError(message: string, data:
|
|
14
|
+
protected mapNotFoundError(message: string, _data: unknown): NotFound;
|
|
15
|
+
protected mapBadRequestError(message: string, data: unknown): BadRequest;
|
|
16
16
|
/**
|
|
17
17
|
* Override the top-level mapByStatusCode for Metaculus-specific auth messages.
|
|
18
18
|
*/
|
|
19
|
-
protected mapByStatusCode(status: number, message: string, data:
|
|
19
|
+
protected mapByStatusCode(status: number, message: string, data: unknown, response?: unknown): BaseError;
|
|
20
20
|
}
|
|
21
21
|
export declare const metaculusErrorMapper: MetaculusErrorMapper;
|
|
@@ -161,14 +161,19 @@ class MockExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
161
161
|
const candidates = f.pick(CANDIDATES);
|
|
162
162
|
const rawPrices = candidates.map(() => f.float(0.05, 0.9));
|
|
163
163
|
const total = rawPrices.reduce((s, p) => s + p, 0);
|
|
164
|
-
outcomes = candidates.map((label, i) =>
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
164
|
+
outcomes = candidates.map((label, i) => {
|
|
165
|
+
const rawPrice = rawPrices[i];
|
|
166
|
+
if (rawPrice === undefined)
|
|
167
|
+
throw new Error(`Missing raw price at index ${i}`);
|
|
168
|
+
return {
|
|
169
|
+
outcomeId: `${marketId}-${i}`,
|
|
170
|
+
marketId,
|
|
171
|
+
label,
|
|
172
|
+
price: round(rawPrice / total, 3),
|
|
173
|
+
priceChange24h: round(f.float(-0.05, 0.05), 3),
|
|
174
|
+
metadata: { clobTokenId: `mock-clob-${seed}-${i}` },
|
|
175
|
+
};
|
|
176
|
+
});
|
|
172
177
|
}
|
|
173
178
|
const market = {
|
|
174
179
|
marketId,
|
|
@@ -221,13 +226,19 @@ class MockExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
221
226
|
for (const m of markets) {
|
|
222
227
|
if (!m.eventId)
|
|
223
228
|
continue;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
229
|
+
const existing = eventMap.get(m.eventId);
|
|
230
|
+
if (existing) {
|
|
231
|
+
existing.push(m);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
eventMap.set(m.eventId, [m]);
|
|
235
|
+
}
|
|
227
236
|
}
|
|
228
237
|
const events = [];
|
|
229
238
|
for (const [eventId, eventMarkets] of eventMap) {
|
|
230
239
|
const f = rng(eventId);
|
|
240
|
+
if (eventMarkets.length === 0)
|
|
241
|
+
continue;
|
|
231
242
|
const first = eventMarkets[0];
|
|
232
243
|
const volume24h = round(eventMarkets.reduce((s, m) => s + m.volume24h, 0), 2);
|
|
233
244
|
const volume = round(eventMarkets.reduce((s, m) => s + (m.volume ?? 0), 0), 2);
|
|
@@ -444,7 +455,10 @@ class MockExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
444
455
|
const sizeChange = params.side === 'buy' ? amount : -amount;
|
|
445
456
|
this._setPosition(params, price, sizeChange);
|
|
446
457
|
this._pushTrade(f, params, orderId, price, amount, ts);
|
|
447
|
-
|
|
458
|
+
const filled = this._orders.get(orderId);
|
|
459
|
+
if (!filled)
|
|
460
|
+
throw new Error(`Order disappeared after fill: ${orderId}`);
|
|
461
|
+
return { ...filled };
|
|
448
462
|
}
|
|
449
463
|
_placeRestingLimit(params, ts, price) {
|
|
450
464
|
const ro = new seededRng_1.SeededRng('oid:' + this._ordSeq);
|
|
@@ -543,7 +557,10 @@ class MockExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
543
557
|
this._setPosition(cp, p, current.side === 'buy' ? fillAmt : -fillAmt);
|
|
544
558
|
this._pushTrade(f, cp, orderId, p, fillAmt, ts);
|
|
545
559
|
this._orders.set(orderId, next);
|
|
546
|
-
|
|
560
|
+
const updated = this._orders.get(orderId);
|
|
561
|
+
if (!updated)
|
|
562
|
+
throw new Error(`Order disappeared after fill: ${orderId}`);
|
|
563
|
+
return { ...updated };
|
|
547
564
|
}
|
|
548
565
|
async cancelOrder(orderId) {
|
|
549
566
|
const current = this._orders.get(orderId);
|
|
@@ -558,7 +575,7 @@ class MockExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
558
575
|
this._freeCash += rest;
|
|
559
576
|
this._lockedByBuy.delete(orderId);
|
|
560
577
|
}
|
|
561
|
-
const u = { ...current, status: '
|
|
578
|
+
const u = { ...current, status: 'canceled', remaining: 0, timestamp: Date.now() };
|
|
562
579
|
this._orders.set(orderId, u);
|
|
563
580
|
return { ...u };
|
|
564
581
|
}
|
|
@@ -581,7 +598,7 @@ class MockExchange extends BaseExchange_1.PredictionMarketExchange {
|
|
|
581
598
|
}
|
|
582
599
|
async fetchClosedOrders() {
|
|
583
600
|
return Array.from(this._orders.values())
|
|
584
|
-
.filter(o => o.status === 'filled' || o.status === '
|
|
601
|
+
.filter(o => o.status === 'filled' || o.status === 'canceled' || o.status === 'rejected')
|
|
585
602
|
.map(o => ({ ...o }));
|
|
586
603
|
}
|
|
587
604
|
async fetchAllOrders() {
|
|
@@ -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-24T18:32:06.502Z
|
|
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-24T18:32:06.502Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.myriadApiSpec = {
|
|
@@ -2,7 +2,7 @@ import { ErrorMapper } from '../../utils/error-mapper';
|
|
|
2
2
|
import { BadRequest } from '../../errors';
|
|
3
3
|
export declare class MyriadErrorMapper extends ErrorMapper {
|
|
4
4
|
constructor();
|
|
5
|
-
protected extractErrorMessage(error:
|
|
6
|
-
protected mapBadRequestError(message: string, data:
|
|
5
|
+
protected extractErrorMessage(error: unknown): string;
|
|
6
|
+
protected mapBadRequestError(message: string, data: unknown): BadRequest;
|
|
7
7
|
}
|
|
8
8
|
export declare const myriadErrorMapper: MyriadErrorMapper;
|
|
@@ -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-24T18:32:06.507Z
|
|
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-24T18:32:06.507Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.opinionApiSpec = {
|
|
@@ -2,7 +2,7 @@ import { ErrorMapper } from '../../utils/error-mapper';
|
|
|
2
2
|
import { BadRequest } from '../../errors';
|
|
3
3
|
export declare class OpinionErrorMapper extends ErrorMapper {
|
|
4
4
|
constructor();
|
|
5
|
-
protected extractErrorMessage(error:
|
|
6
|
-
protected mapBadRequestError(message: string, data:
|
|
5
|
+
protected extractErrorMessage(error: unknown): string;
|
|
6
|
+
protected mapBadRequestError(message: string, data: unknown): BadRequest;
|
|
7
7
|
}
|
|
8
8
|
export declare const opinionErrorMapper: OpinionErrorMapper;
|
|
@@ -23,11 +23,12 @@ class OpinionErrorMapper extends error_mapper_1.ErrorMapper {
|
|
|
23
23
|
return super.extractErrorMessage(error);
|
|
24
24
|
}
|
|
25
25
|
mapBadRequestError(message, data) {
|
|
26
|
-
if (
|
|
26
|
+
if (typeof data === 'object' && data !== null) {
|
|
27
|
+
const obj = data;
|
|
27
28
|
// OpenAPI format: { code: number, msg: string }
|
|
28
29
|
// SDK format: { errno: number, errmsg: string }
|
|
29
|
-
const errorCode =
|
|
30
|
-
const errorMsg =
|
|
30
|
+
const errorCode = obj.code ?? obj.errno;
|
|
31
|
+
const errorMsg = obj.msg || obj.errmsg || message;
|
|
31
32
|
if (errorCode !== undefined && errorCode !== 0) {
|
|
32
33
|
return new errors_1.BadRequest(`Opinion API error (code ${errorCode}): ${errorMsg}`, this.exchangeName);
|
|
33
34
|
}
|
|
@@ -17,7 +17,7 @@ export declare const OPINION_ORDER_STATUS: {
|
|
|
17
17
|
export declare function mapStatusToOpinion(status: string): string | undefined;
|
|
18
18
|
export declare function mapSortToOpinion(sort?: string): number | undefined;
|
|
19
19
|
export declare function mapIntervalToOpinion(interval: CandleInterval): string;
|
|
20
|
-
export declare function mapOrderStatus(status: number): 'pending' | 'open' | 'filled' | '
|
|
20
|
+
export declare function mapOrderStatus(status: number): 'pending' | 'open' | 'filled' | 'canceled' | 'rejected';
|
|
21
21
|
export declare function parseNumStr(value: string | undefined | null): number;
|
|
22
22
|
export declare function toMillis(ts: number | undefined | null): number;
|
|
23
23
|
export declare function intervalToMs(interval: CandleInterval): number;
|
|
@@ -61,8 +61,8 @@ function mapOrderStatus(status) {
|
|
|
61
61
|
switch (status) {
|
|
62
62
|
case exports.OPINION_ORDER_STATUS.PENDING: return 'pending';
|
|
63
63
|
case exports.OPINION_ORDER_STATUS.FILLED: return 'filled';
|
|
64
|
-
case exports.OPINION_ORDER_STATUS.CANCELED: return '
|
|
65
|
-
case exports.OPINION_ORDER_STATUS.EXPIRED: return '
|
|
64
|
+
case exports.OPINION_ORDER_STATUS.CANCELED: return 'canceled';
|
|
65
|
+
case exports.OPINION_ORDER_STATUS.EXPIRED: return 'canceled'; // expired -> canceled
|
|
66
66
|
case exports.OPINION_ORDER_STATUS.FAILED: return 'rejected'; // failed -> rejected
|
|
67
67
|
default: return 'pending';
|
|
68
68
|
}
|
|
@@ -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-24T18:32:06.460Z
|
|
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-24T18:32:06.460Z
|
|
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-24T18:32:06.472Z
|
|
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-24T18:32:06.472Z
|
|
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-24T18:32:06.470Z
|
|
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-24T18:32:06.470Z
|
|
7
7
|
* Do not edit manually -- run "npm run fetch:openapi" to regenerate.
|
|
8
8
|
*/
|
|
9
9
|
exports.polymarketGammaSpec = {
|