pmxt-core 2.52.0 → 2.53.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.
@@ -2,7 +2,7 @@ import { AxiosInstance } from 'axios';
2
2
  import { SubscribedAddressSnapshot, SubscriptionOption } from './subscriber/base';
3
3
  import { Balance, BuiltOrder, CandleInterval, CreateOrderParams, Order, OrderBook, Position, PriceCandle, Trade, UnifiedEvent, UnifiedMarket, UnifiedSeries, UserTrade } from './types';
4
4
  import { ExecutionPriceResult } from './utils/math';
5
- import type { FetchMarketMatchesParams, FetchMatchesParams, FetchEventMatchesParams, FetchArbitrageParams, FetchMatchedMarketsParams, FetchMatchedPricesParams, MatchResult, EventMatchResult, PriceComparison, ArbitrageOpportunity, MatchedMarketPair, MatchedPricePair } from './router/types';
5
+ import type { FetchMarketMatchesParams, FetchMatchesParams, FetchEventMatchesParams, FetchArbitrageParams, FetchMatchedMarketsParams, FetchMatchedPricesParams, MatchResult, EventMatchResult, PriceComparison, CompareMarketPricesParams, ArbitrageOpportunity, MatchedMarketPair, MatchedPricePair } from './router/types';
6
6
  export interface ApiEndpoint {
7
7
  /** HTTP verb for the endpoint (e.g. GET, POST). */
8
8
  method: string;
@@ -818,7 +818,7 @@ export declare abstract class PredictionMarketExchange {
818
818
  * @param params - Match filter parameters (uses relation: 'identity' internally)
819
819
  * @returns Array of price comparisons across venues
820
820
  */
821
- compareMarketPrices(params: FetchMatchesParams): Promise<PriceComparison[]>;
821
+ compareMarketPrices(params: CompareMarketPricesParams): Promise<PriceComparison[]>;
822
822
  /**
823
823
  * Find related markets across venues. Discovers subset/superset market relationships
824
824
  * where one market's outcome implies another, with live prices.
@@ -7,11 +7,11 @@ const errors_1 = require("../../errors");
7
7
  const PROGRAM_ERRORS = {
8
8
  6000: { type: 'bad_request', message: 'Unauthorized' },
9
9
  6001: { type: 'bad_request', message: 'Market not found' },
10
+ 6013: { type: 'bad_request', message: 'Betting is closed' }, // Changed from 6018
11
+ 6014: { type: 'bad_request', message: 'Betting is frozen' }, // Changed from 6040
10
12
  6015: { type: 'bad_request', message: 'Market is not open for betting' },
11
- 6018: { type: 'bad_request', message: 'Betting is closed' },
12
- 6020: { type: 'invalid_order', message: 'Bet amount too small' },
13
- 6040: { type: 'bad_request', message: 'Betting is frozen' },
14
- 6041: { type: 'invalid_order', message: 'Bet amount too large' },
13
+ 6023: { type: 'invalid_order', message: 'Bet amount too small' }, // Changed from 6020
14
+ 6024: { type: 'invalid_order', message: 'Bet amount too large' }, // Changed from 6041
15
15
  };
16
16
  /**
17
17
  * Maps Solana/Anchor errors to pmxt unified error types.
@@ -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-07-18T00:54:13.384Z
3
+ * Generated at: 2026-07-18T01:30:24.099Z
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-07-18T00:54:13.384Z
6
+ * Generated at: 2026-07-18T01:30:24.099Z
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-07-18T00:54:13.429Z
3
+ * Generated at: 2026-07-18T01:30:24.137Z
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-07-18T00:54:13.429Z
6
+ * Generated at: 2026-07-18T01:30:24.137Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.limitlessApiSpec = {
@@ -173,39 +173,38 @@ function mapIntervalToFidelity(interval) {
173
173
  async function paginateLimitlessMarkets(fetcher, requestedLimit, sortBy) {
174
174
  const PAGE_SIZE = 25;
175
175
  const targetLimit = requestedLimit || PAGE_SIZE;
176
- const MAX_PAGES = 20; // Safety limit to prevent infinite loops
177
- if (targetLimit <= PAGE_SIZE) {
176
+ // Over-fetch by 70% because ~30% of markets lack tokens and get filtered out
177
+ // This ensures enough raw markets survive the token filter
178
+ const OVER_FETCH_FACTOR = 1.7;
179
+ const rawTargetLimit = Math.ceil(targetLimit * OVER_FETCH_FACTOR);
180
+ if (rawTargetLimit <= PAGE_SIZE) {
178
181
  const response = await fetcher.getActiveMarkets({
179
- limit: targetLimit,
182
+ limit: rawTargetLimit,
180
183
  page: 1,
181
184
  sortBy: sortBy,
182
185
  });
183
186
  return response.data || [];
184
187
  }
185
- // Fetch more pages than theoretically needed to account for filtering
186
- // ~33% of markets lack tokens and get filtered out, so we over-fetch
187
- // by 70% to ensure we get enough valid markets after filtering
188
- const estimatedPages = Math.ceil(targetLimit / PAGE_SIZE);
189
- const pagesWithBuffer = Math.min(Math.ceil(estimatedPages * 1.7), MAX_PAGES);
190
- const pageNumbers = [];
191
- for (let i = 1; i <= pagesWithBuffer; i++) {
192
- pageNumbers.push(i);
188
+ // Sequential pagination using totalMarketsCount
189
+ const allMarkets = [];
190
+ let page = 1;
191
+ const MAX_PAGES = 50; // Safety limit
192
+ while (page <= MAX_PAGES && allMarkets.length < rawTargetLimit) {
193
+ const response = await fetcher.getActiveMarkets({
194
+ limit: PAGE_SIZE,
195
+ page: page,
196
+ sortBy: sortBy,
197
+ });
198
+ const markets = response.data || [];
199
+ if (markets.length === 0)
200
+ break;
201
+ allMarkets.push(...markets);
202
+ // Use totalMarketsCount to check if we're done
203
+ const totalCount = response.totalMarketsCount;
204
+ if (totalCount && allMarkets.length >= totalCount)
205
+ break;
206
+ page++;
193
207
  }
194
- const pages = await Promise.all(pageNumbers.map(async (page) => {
195
- try {
196
- const response = await fetcher.getActiveMarkets({
197
- limit: PAGE_SIZE,
198
- page: page,
199
- sortBy: sortBy,
200
- });
201
- return response.data || [];
202
- }
203
- catch (e) {
204
- return [];
205
- }
206
- }));
207
- const allMarkets = pages.flat();
208
- // Don't slice here - let the caller handle limiting after filtering
209
- // This ensures we return enough raw markets for the caller to filter
208
+ // Return raw markets - caller will filter tokens and apply actual limit
210
209
  return allMarkets;
211
210
  }
@@ -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-07-18T00:54:13.441Z
3
+ * Generated at: 2026-07-18T01:30:24.144Z
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-07-18T00:54:13.441Z
6
+ * Generated at: 2026-07-18T01:30:24.144Z
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-07-18T00:54:13.446Z
3
+ * Generated at: 2026-07-18T01:30:24.149Z
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-07-18T00:54:13.446Z
6
+ * Generated at: 2026-07-18T01:30:24.149Z
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-07-18T00:54:13.392Z
3
+ * Generated at: 2026-07-18T01:30:24.107Z
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-07-18T00:54:13.392Z
6
+ * Generated at: 2026-07-18T01:30:24.107Z
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-07-18T00:54:13.410Z
3
+ * Generated at: 2026-07-18T01:30:24.120Z
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-07-18T00:54:13.410Z
6
+ * Generated at: 2026-07-18T01:30:24.120Z
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-07-18T00:54:13.407Z
3
+ * Generated at: 2026-07-18T01:30:24.118Z
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-07-18T00:54:13.407Z
6
+ * Generated at: 2026-07-18T01:30:24.118Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketGammaSpec = {
@@ -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-07-18T00:54:13.436Z
3
+ * Generated at: 2026-07-18T01:30:24.140Z
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-07-18T00:54:13.436Z
6
+ * Generated at: 2026-07-18T01:30:24.140Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.probableApiSpec = {
@@ -48,6 +48,19 @@ export interface ArbitrageOpportunity {
48
48
  /** Match confidence score (0.0 to 1.0). */
49
49
  confidence?: number;
50
50
  }
51
+ /**
52
+ * Parameters for comparing market prices across venues.
53
+ */
54
+ export interface CompareMarketPricesParams {
55
+ /** The source market ID to compare against. */
56
+ marketId: string;
57
+ /** Optional list of target market IDs to compare with. If not provided, the router finds matches automatically. */
58
+ targetMarketIds?: string[];
59
+ /** Minimum price difference to return. */
60
+ minDifference?: number;
61
+ /** Maximum number of results to return. */
62
+ limit?: number;
63
+ }
51
64
  export interface FetchMarketMatchesParams {
52
65
  /** Keyword search across matched market titles. */
53
66
  query?: string;
@@ -1758,7 +1758,7 @@ paths:
1758
1758
  type: array
1759
1759
  maxItems: 1
1760
1760
  items:
1761
- $ref: '#/components/schemas/FetchMarketMatchesParams'
1761
+ type: object
1762
1762
  minItems: 1
1763
1763
  credentials:
1764
1764
  $ref: '#/components/schemas/ExchangeCredentials'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxt-core",
3
- "version": "2.52.0",
3
+ "version": "2.53.1",
4
4
  "description": "Local sidecar API for supported 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.52.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.52.0,supportsES6=true,typescriptThreePlus=true && node ../sdks/typescript/scripts/fix-generated.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.53.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.53.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",