pmxt-core 2.43.11 → 2.43.12

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.
@@ -103,12 +103,14 @@ export interface OHLCVParams {
103
103
  /**
104
104
  * Parameters for fetching trade history. No resolution parameter - trades are discrete events.
105
105
  */
106
+ /** Maximum allowed value for `TradesParams.limit`. */
107
+ export declare const MAX_TRADES_LIMIT = 1000;
106
108
  export interface TradesParams {
107
109
  /** Start of the time range */
108
110
  start?: Date;
109
111
  /** End of the time range */
110
112
  end?: Date;
111
- /** Maximum number of results to return */
113
+ /** Maximum number of results to return (max {@link MAX_TRADES_LIMIT}) */
112
114
  limit?: number;
113
115
  }
114
116
  export interface MyTradesParams {
@@ -3,12 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PredictionMarketExchange = void 0;
6
+ exports.PredictionMarketExchange = exports.MAX_TRADES_LIMIT = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
8
  const errors_1 = require("./errors");
9
9
  const math_1 = require("./utils/math");
10
10
  const logger_1 = require("./utils/logger");
11
11
  const throttler_1 = require("./utils/throttler");
12
+ /**
13
+ * Parameters for fetching trade history. No resolution parameter - trades are discrete events.
14
+ */
15
+ /** Maximum allowed value for `TradesParams.limit`. */
16
+ exports.MAX_TRADES_LIMIT = 1000;
12
17
  // ----------------------------------------------------------------------------
13
18
  // Base Exchange Class
14
19
  // ----------------------------------------------------------------------------
@@ -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-23T11:49:57.982Z
3
+ * Generated at: 2026-05-23T13:25:22.239Z
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-23T11:49:57.982Z
6
+ * Generated at: 2026-05-23T13:25:22.239Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.kalshiApiSpec = {
@@ -155,10 +155,10 @@ class KalshiFetcher {
155
155
  // -- Trades ----------------------------------------------------------------
156
156
  async fetchRawTrades(id, params) {
157
157
  const ticker = id.replace(/-NO$/, '');
158
- const data = await this.ctx.callApi('GetTrades', {
159
- ticker,
160
- limit: params.limit || 100,
161
- });
158
+ const query = { ticker };
159
+ if (params.limit)
160
+ query.limit = params.limit;
161
+ const data = await this.ctx.callApi('GetTrades', query);
162
162
  return data.trades || [];
163
163
  }
164
164
  // -- User data -------------------------------------------------------------
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.KalshiExchange = void 0;
4
4
  const BaseExchange_1 = require("../../BaseExchange");
5
5
  const errors_1 = require("../../errors");
6
+ const validation_1 = require("../../utils/validation");
6
7
  const openapi_1 = require("../../utils/openapi");
7
8
  const logger_1 = require("../../utils/logger");
8
9
  const api_1 = require("./api");
@@ -137,6 +138,7 @@ class KalshiExchange extends BaseExchange_1.PredictionMarketExchange {
137
138
  return response;
138
139
  }
139
140
  async fetchTrades(outcomeId, params) {
141
+ (0, validation_1.validateTradesLimit)(params.limit);
140
142
  if ('resolution' in params && params.resolution !== undefined) {
141
143
  logger_1.logger.warn('The "resolution" parameter is deprecated for fetchTrades() and will be ignored. ' +
142
144
  'It will be removed in v3.0.0. Please remove it from your code.');
@@ -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-23T11:49:58.021Z
3
+ * Generated at: 2026-05-23T13:25:22.282Z
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-23T11:49:58.021Z
6
+ * Generated at: 2026-05-23T13:25:22.282Z
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-23T11:49:58.034Z
3
+ * Generated at: 2026-05-23T13:25:22.294Z
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-23T11:49:58.034Z
6
+ * Generated at: 2026-05-23T13:25:22.294Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.myriadApiSpec = {
@@ -166,8 +166,9 @@ class MyriadFetcher {
166
166
  id: marketId,
167
167
  network_id: Number(networkId),
168
168
  page: 1,
169
- limit: params.limit || 100,
170
169
  };
170
+ if (params.limit)
171
+ queryParams.limit = params.limit;
171
172
  if (params.start)
172
173
  queryParams.since = Math.floor(ensureDate(params.start).getTime() / 1000);
173
174
  if (params.end)
@@ -6,6 +6,7 @@ const auth_1 = require("./auth");
6
6
  const websocket_1 = require("./websocket");
7
7
  const errors_1 = require("./errors");
8
8
  const errors_2 = require("../../errors");
9
+ const validation_1 = require("../../utils/validation");
9
10
  const utils_1 = require("./utils");
10
11
  const openapi_1 = require("../../utils/openapi");
11
12
  const api_1 = require("./api");
@@ -109,6 +110,7 @@ class MyriadExchange extends BaseExchange_1.PredictionMarketExchange {
109
110
  return this.normalizer.normalizeOrderBook(rawMarket, outcomeId);
110
111
  }
111
112
  async fetchTrades(outcomeId, params) {
113
+ (0, validation_1.validateTradesLimit)(params.limit);
112
114
  if ('resolution' in params && params.resolution !== undefined) {
113
115
  logger_1.logger.warn('The "resolution" parameter is deprecated for fetchTrades() and will be ignored. ' +
114
116
  'It will be removed in v3.0.0. Please remove it from your code.');
@@ -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-23T11:49:58.038Z
3
+ * Generated at: 2026-05-23T13:25:22.299Z
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-23T11:49:58.038Z
6
+ * Generated at: 2026-05-23T13:25:22.299Z
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-23T11:49:57.988Z
3
+ * Generated at: 2026-05-23T13:25:22.247Z
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-23T11:49:57.988Z
6
+ * Generated at: 2026-05-23T13:25:22.247Z
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-23T11:49:58.001Z
3
+ * Generated at: 2026-05-23T13:25:22.264Z
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-23T11:49:58.001Z
6
+ * Generated at: 2026-05-23T13:25:22.264Z
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-23T11:49:57.998Z
3
+ * Generated at: 2026-05-23T13:25:22.262Z
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-23T11:49:57.998Z
6
+ * Generated at: 2026-05-23T13:25:22.262Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketGammaSpec = {
@@ -193,6 +193,8 @@ class PolymarketFetcher {
193
193
  const queryParams = {
194
194
  asset_id: id,
195
195
  };
196
+ if (params.limit)
197
+ queryParams.limit = params.limit;
196
198
  if (params.start) {
197
199
  queryParams.after = Math.floor(ensureDate(params.start).getTime() / 1000);
198
200
  }
@@ -135,6 +135,7 @@ class PolymarketExchange extends BaseExchange_1.PredictionMarketExchange {
135
135
  async fetchTrades(outcomeId, params) {
136
136
  (0, validation_1.validateIdFormat)(outcomeId, 'Trades');
137
137
  (0, validation_1.validateOutcomeId)(outcomeId, 'Trades');
138
+ (0, validation_1.validateTradesLimit)(params.limit);
138
139
  if ('resolution' in params && params.resolution !== undefined) {
139
140
  logger_1.logger.warn('The "resolution" parameter is deprecated for fetchTrades() and will be ignored. It will be removed in v3.0.0.');
140
141
  }
@@ -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-23T11:49:58.029Z
3
+ * Generated at: 2026-05-23T13:25:22.286Z
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-23T11:49:58.029Z
6
+ * Generated at: 2026-05-23T13:25:22.286Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.probableApiSpec = {
@@ -6,6 +6,7 @@ const auth_1 = require("./auth");
6
6
  const websocket_1 = require("./websocket");
7
7
  const errors_1 = require("./errors");
8
8
  const errors_2 = require("../../errors");
9
+ const validation_1 = require("../../utils/validation");
9
10
  const clob_1 = require("@prob/clob");
10
11
  const openapi_1 = require("../../utils/openapi");
11
12
  const api_1 = require("./api");
@@ -135,6 +136,7 @@ class ProbableExchange extends BaseExchange_1.PredictionMarketExchange {
135
136
  return rawTrades.map((raw, i) => this.normalizer.normalizeUserTrade(raw, i));
136
137
  }
137
138
  async fetchTrades(outcomeId, params) {
139
+ (0, validation_1.validateTradesLimit)(params.limit);
138
140
  const auth = this.ensureAuth();
139
141
  const client = auth.getClobClient();
140
142
  // Use CLOB client directly for trades (legacy behaviour preserved)
@@ -158,7 +158,7 @@ export declare class SmarketsFetcher implements IExchangeFetcher<SmarketsRawEven
158
158
  fetchRawMarkets(params?: MarketFilterParams): Promise<SmarketsRawEventWithMarkets[]>;
159
159
  fetchRawEvents(params: EventFetchParams): Promise<SmarketsRawEventWithMarkets[]>;
160
160
  fetchRawOrderBook(id: string): Promise<Record<string, SmarketsRawQuote>>;
161
- fetchRawTradeActivity(marketId: string, _params: TradesParams): Promise<SmarketsRawActivityRow[]>;
161
+ fetchRawTradeActivity(marketId: string, params: TradesParams): Promise<SmarketsRawActivityRow[]>;
162
162
  fetchRawMyTradeActivity(params?: Record<string, any>): Promise<SmarketsRawActivityRow[]>;
163
163
  fetchRawBalance(): Promise<SmarketsRawBalance>;
164
164
  fetchRawOrders(queryParams?: Record<string, any>): Promise<SmarketsRawOrder[]>;
@@ -69,13 +69,15 @@ class SmarketsFetcher {
69
69
  return data;
70
70
  }
71
71
  // -- Trades (account activity) --------------------------------------------
72
- async fetchRawTradeActivity(marketId, _params) {
73
- const data = await this.ctx.callApi('get_activity', {
72
+ async fetchRawTradeActivity(marketId, params) {
73
+ const query = {
74
74
  market_id: [marketId],
75
75
  source: ['order.execute', 'order.execute.confirm'],
76
- limit: 100,
77
76
  sort: '-seq,-subseq',
78
- });
77
+ };
78
+ if (params.limit)
79
+ query.limit = params.limit;
80
+ const data = await this.ctx.callApi('get_activity', query);
79
81
  return (data.account_activity || []);
80
82
  }
81
83
  async fetchRawMyTradeActivity(params = {}) {
@@ -5,6 +5,7 @@ const BaseExchange_1 = require("../../BaseExchange");
5
5
  const auth_1 = require("./auth");
6
6
  const errors_1 = require("./errors");
7
7
  const errors_2 = require("../../errors");
8
+ const validation_1 = require("../../utils/validation");
8
9
  const openapi_1 = require("../../utils/openapi");
9
10
  const api_1 = require("./api");
10
11
  const config_1 = require("./config");
@@ -164,6 +165,7 @@ class SmarketsExchange extends BaseExchange_1.PredictionMarketExchange {
164
165
  return this.normalizer.normalizeOrderBook(raw, outcomeId);
165
166
  }
166
167
  async fetchTrades(outcomeId, params) {
168
+ (0, validation_1.validateTradesLimit)(params.limit);
167
169
  if ('resolution' in params && params.resolution !== undefined) {
168
170
  logger_1.logger.warn('The "resolution" parameter is deprecated for fetchTrades() and will be ignored. ' +
169
171
  'It will be removed in v3.0.0. Please remove it from your code.');
@@ -760,7 +760,7 @@ paths:
760
760
  required: false
761
761
  schema:
762
762
  type: number
763
- description: Maximum number of results to return
763
+ description: 'Maximum number of results to return (max {@link MAX_TRADES_LIMIT})'
764
764
  responses:
765
765
  '200':
766
766
  description: Fetch Trades response
@@ -3204,7 +3204,6 @@ components:
3204
3204
  reconstructed L2 OrderBook snapshots between `since` and `until` (hosted API only).
3205
3205
  TradesParams:
3206
3206
  type: object
3207
- description: Parameters for fetching trade history. No resolution parameter - trades are discrete events.
3208
3207
  properties:
3209
3208
  start:
3210
3209
  type: string
@@ -3216,7 +3215,7 @@ components:
3216
3215
  description: End of the time range
3217
3216
  limit:
3218
3217
  type: number
3219
- description: Maximum number of results to return
3218
+ description: 'Maximum number of results to return (max {@link MAX_TRADES_LIMIT})'
3220
3219
  CreateOrderParams:
3221
3220
  type: object
3222
3221
  properties:
@@ -4,3 +4,4 @@
4
4
  */
5
5
  export declare function validateOutcomeId(id: string, context: string): void;
6
6
  export declare function validateIdFormat(id: string, context: string): void;
7
+ export declare function validateTradesLimit(limit: number | undefined): void;
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateOutcomeId = validateOutcomeId;
4
4
  exports.validateIdFormat = validateIdFormat;
5
+ exports.validateTradesLimit = validateTradesLimit;
5
6
  const errors_1 = require("../errors");
7
+ const BaseExchange_1 = require("../BaseExchange");
6
8
  /**
7
9
  * Validates that the provided ID is an outcomeId
8
10
  * Numeric IDs should be at least 10 digits (CLOB Token IDs for Polymarket)
@@ -21,3 +23,8 @@ function validateIdFormat(id, context) {
21
23
  throw new errors_1.ValidationError(`Invalid ID for ${context}: ID cannot be empty`, 'id');
22
24
  }
23
25
  }
26
+ function validateTradesLimit(limit) {
27
+ if (limit !== undefined && limit > BaseExchange_1.MAX_TRADES_LIMIT) {
28
+ throw new errors_1.ValidationError(`limit exceeds maximum of ${BaseExchange_1.MAX_TRADES_LIMIT}`, 'limit');
29
+ }
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxt-core",
3
- "version": "2.43.11",
3
+ "version": "2.43.12",
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.43.11,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.43.11,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.43.12,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.43.12,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",