pmxt-core 2.17.1 → 2.17.3

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.
@@ -60,7 +60,11 @@ class PredictionMarketExchange {
60
60
  constructor(credentials, options) {
61
61
  this.credentials = credentials;
62
62
  this._snapshotTTL = options?.snapshotTTL ?? 0;
63
- this.http = axios_1.default.create();
63
+ this.http = axios_1.default.create({
64
+ headers: {
65
+ 'User-Agent': `pmxt (https://github.com/pmxt-dev/pmxt)`
66
+ }
67
+ });
64
68
  this._throttler = new throttler_1.Throttler({
65
69
  refillRate: 1 / this._rateLimit,
66
70
  capacity: 1,
@@ -16,17 +16,20 @@ async function fetchEvents(connection, params) {
16
16
  status: params.status,
17
17
  searchIn: params.searchIn,
18
18
  });
19
- return markets.map(m => ({
20
- id: m.marketId,
21
- title: m.title,
22
- description: m.description,
23
- slug: m.marketId,
24
- markets: [m],
25
- url: m.url,
26
- image: m.image,
27
- category: m.category,
28
- tags: m.tags,
29
- }));
19
+ return markets.map(m => {
20
+ const unifiedEvent = {
21
+ id: m.marketId,
22
+ title: m.title,
23
+ description: m.description,
24
+ slug: m.marketId,
25
+ markets: [m],
26
+ url: m.url,
27
+ image: m.image,
28
+ category: m.category,
29
+ tags: m.tags,
30
+ };
31
+ return unifiedEvent;
32
+ });
30
33
  }
31
34
  catch (error) {
32
35
  throw errors_1.baoziErrorMapper.mapError(error);
@@ -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-02-24T10:35:33.024Z
3
+ * Generated at: 2026-02-24T13:29:17.018Z
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-02-24T10:35:33.024Z
6
+ * Generated at: 2026-02-24T13:29:17.018Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.kalshiApiSpec = {
@@ -44,7 +44,7 @@ function rawEventToUnified(event) {
44
44
  }
45
45
  }
46
46
  }
47
- return {
47
+ const unifiedEvent = {
48
48
  id: event.event_ticker,
49
49
  title: event.title,
50
50
  description: event.mututals_description || "",
@@ -55,6 +55,7 @@ function rawEventToUnified(event) {
55
55
  category: event.category,
56
56
  tags: event.tags || [],
57
57
  };
58
+ return unifiedEvent;
58
59
  }
59
60
  async function fetchAllWithStatus(callApi, apiStatus) {
60
61
  let allEvents = [];
@@ -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-02-24T10:35:33.076Z
3
+ * Generated at: 2026-02-24T13:29:17.072Z
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-02-24T10:35:33.076Z
6
+ * Generated at: 2026-02-24T13:29:17.072Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.limitlessApiSpec = {
@@ -1,3 +1,4 @@
1
1
  import { EventFetchParams } from '../../BaseExchange';
2
2
  import { UnifiedEvent } from '../../types';
3
- export declare function fetchEvents(params: EventFetchParams, callApi: (operationId: string, params?: Record<string, any>) => Promise<any>): Promise<UnifiedEvent[]>;
3
+ import { AxiosInstance } from 'axios';
4
+ export declare function fetchEvents(params: EventFetchParams, callApi: (operationId: string, params?: Record<string, any>) => Promise<any>, http?: AxiosInstance): Promise<UnifiedEvent[]>;
@@ -40,7 +40,7 @@ exports.fetchEvents = fetchEvents;
40
40
  const utils_1 = require("./utils");
41
41
  const errors_1 = require("./errors");
42
42
  const axios_1 = __importDefault(require("axios"));
43
- async function fetchEventBySlug(slug) {
43
+ async function fetchEventBySlug(slug, http = axios_1.default) {
44
44
  const { HttpClient, MarketFetcher } = await Promise.resolve().then(() => __importStar(require('@limitless-exchange/sdk')));
45
45
  const httpClient = new HttpClient({ baseURL: utils_1.LIMITLESS_API_URL });
46
46
  const marketFetcher = new MarketFetcher(httpClient);
@@ -58,7 +58,7 @@ async function fetchEventBySlug(slug) {
58
58
  if (unifiedMarket)
59
59
  marketsList = [unifiedMarket];
60
60
  }
61
- return {
61
+ const unifiedEvent = {
62
62
  id: market.slug,
63
63
  title: market.title || market.question,
64
64
  description: market.description || '',
@@ -69,6 +69,7 @@ async function fetchEventBySlug(slug) {
69
69
  category: market.categories?.[0],
70
70
  tags: market.tags || []
71
71
  };
72
+ return unifiedEvent;
72
73
  }
73
74
  function rawMarketToEvent(market) {
74
75
  let marketsList = [];
@@ -82,7 +83,7 @@ function rawMarketToEvent(market) {
82
83
  if (unifiedMarket)
83
84
  marketsList = [unifiedMarket];
84
85
  }
85
- return {
86
+ const unifiedEvent = {
86
87
  id: market.slug,
87
88
  title: market.title || market.question,
88
89
  description: market.description || '',
@@ -93,13 +94,14 @@ function rawMarketToEvent(market) {
93
94
  category: market.categories?.[0],
94
95
  tags: market.tags || []
95
96
  };
97
+ return unifiedEvent;
96
98
  }
97
- async function fetchEvents(params, callApi) {
99
+ async function fetchEvents(params, callApi, http = axios_1.default) {
98
100
  try {
99
101
  // Handle eventId/slug lookup (same thing for Limitless)
100
102
  if (params.eventId || params.slug) {
101
103
  const slug = params.eventId || params.slug;
102
- const event = await fetchEventBySlug(slug);
104
+ const event = await fetchEventBySlug(slug, http);
103
105
  return event ? [event] : [];
104
106
  }
105
107
  // Query-based search: use the /markets/search endpoint
@@ -108,7 +110,7 @@ async function fetchEvents(params, callApi) {
108
110
  }
109
111
  // Default: fetch active group markets from /markets/active
110
112
  // On Limitless, "events" = group markets (tradeType === 'group')
111
- return await fetchEventsDefault(params);
113
+ return await fetchEventsDefault(params, http);
112
114
  }
113
115
  catch (error) {
114
116
  throw errors_1.limitlessErrorMapper.mapError(error);
@@ -131,7 +133,7 @@ async function searchEvents(params, callApi) {
131
133
  }
132
134
  return markets.map(rawMarketToEvent);
133
135
  }
134
- async function fetchEventsDefault(params) {
136
+ async function fetchEventsDefault(params, http = axios_1.default) {
135
137
  // Limitless has no dedicated /events endpoint.
136
138
  // Group markets (tradeType === 'group') are the semantic equivalent of events.
137
139
  // We use GET /markets/active and filter for groups only.
@@ -141,7 +143,7 @@ async function fetchEventsDefault(params) {
141
143
  const MAX_PAGES = 40; // Safety cap
142
144
  const allGroups = [];
143
145
  while (allGroups.length < limit && page <= MAX_PAGES) {
144
- const response = await axios_1.default.get(`${utils_1.LIMITLESS_API_URL}/markets/active`, {
146
+ const response = await http.get(`${utils_1.LIMITLESS_API_URL}/markets/active`, {
145
147
  params: {
146
148
  page,
147
149
  limit: pageSize,
@@ -97,7 +97,7 @@ class LimitlessExchange extends BaseExchange_1.PredictionMarketExchange {
97
97
  return (0, fetchMarkets_1.fetchMarkets)(params, apiKey, this.callApi.bind(this));
98
98
  }
99
99
  async fetchEventsImpl(params) {
100
- return (0, fetchEvents_1.fetchEvents)(params, this.callApi.bind(this));
100
+ return (0, fetchEvents_1.fetchEvents)(params, this.callApi.bind(this), this.http);
101
101
  }
102
102
  async fetchOHLCV(id, params) {
103
103
  return (0, fetchOHLCV_1.fetchOHLCV)(id, params, this.callApi.bind(this));
@@ -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-02-24T10:35:33.089Z
3
+ * Generated at: 2026-02-24T13:29:17.086Z
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-02-24T10:35:33.089Z
6
+ * Generated at: 2026-02-24T13:29:17.086Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.myriadApiSpec = {
@@ -89,7 +89,7 @@ function mapQuestionToEvent(question) {
89
89
  if (um)
90
90
  markets.push(um);
91
91
  }
92
- return {
92
+ const unifiedEvent = {
93
93
  id: String(question.id),
94
94
  title: question.title || '',
95
95
  description: '',
@@ -97,4 +97,5 @@ function mapQuestionToEvent(question) {
97
97
  markets,
98
98
  url: `https://myriad.markets`,
99
99
  };
100
+ return unifiedEvent;
100
101
  }
@@ -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-02-24T10:35:33.033Z
3
+ * Generated at: 2026-02-24T13:29:17.025Z
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-02-24T10:35:33.033Z
6
+ * Generated at: 2026-02-24T13:29:17.025Z
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-02-24T10:35:33.053Z
3
+ * Generated at: 2026-02-24T13:29:17.041Z
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-02-24T10:35:33.053Z
6
+ * Generated at: 2026-02-24T13:29:17.041Z
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-02-24T10:35:33.043Z
3
+ * Generated at: 2026-02-24T13:29:17.039Z
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-02-24T10:35:33.043Z
6
+ * Generated at: 2026-02-24T13:29:17.039Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketGammaSpec = {
@@ -99,7 +99,9 @@ class PolymarketAuth {
99
99
  try {
100
100
  // Polymarket Data API / Profiles endpoint
101
101
  // Path-based: https://data-api.polymarket.com/profiles/0x...
102
- const response = await axios_1.default.get(`https://data-api.polymarket.com/profiles/${address}`);
102
+ const response = await axios_1.default.get(`https://data-api.polymarket.com/profiles/${address}`, {
103
+ headers: { 'User-Agent': 'pmxt (https://github.com/pmxt-dev/pmxt)' }
104
+ });
103
105
  const profile = response.data;
104
106
  // console.log(`[PolymarketAuth] Profile for ${address}:`, JSON.stringify(profile));
105
107
  if (profile && profile.proxyAddress) {
@@ -17,7 +17,7 @@ function mapRawEventToUnified(event) {
17
17
  }
18
18
  }
19
19
  }
20
- return {
20
+ const unifiedEvent = {
21
21
  id: event.id || event.slug,
22
22
  title: event.title,
23
23
  description: event.description || '',
@@ -28,6 +28,7 @@ function mapRawEventToUnified(event) {
28
28
  category: event.category || event.tags?.[0]?.label,
29
29
  tags: event.tags?.map((t) => t.label) || []
30
30
  };
31
+ return unifiedEvent;
31
32
  }
32
33
  async function fetchEvents(params, http = axios_1.default) {
33
34
  try {
@@ -146,7 +146,7 @@ class PolymarketExchange extends BaseExchange_1.PredictionMarketExchange {
146
146
  markets.push(unified);
147
147
  }
148
148
  }
149
- return {
149
+ const unifiedEvent = {
150
150
  id: event.id || event.slug,
151
151
  title: event.title,
152
152
  description: event.description || '',
@@ -157,6 +157,7 @@ class PolymarketExchange extends BaseExchange_1.PredictionMarketExchange {
157
157
  category: event.category || event.tags?.[0]?.label,
158
158
  tags: event.tags?.map((t) => t.label) || [],
159
159
  };
160
+ return unifiedEvent;
160
161
  });
161
162
  }
162
163
  return (0, fetchEvents_1.fetchEvents)(params, this.http);
@@ -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-02-24T10:35:33.083Z
3
+ * Generated at: 2026-02-24T13:29:17.078Z
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-02-24T10:35:33.083Z
6
+ * Generated at: 2026-02-24T13:29:17.078Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.probableApiSpec = {
@@ -57,7 +57,7 @@ function mapEventToUnified(event) {
57
57
  markets.push(mapped);
58
58
  }
59
59
  }
60
- return {
60
+ const unifiedEvent = {
61
61
  id: String(event.id),
62
62
  title: event.title || '',
63
63
  description: event.description || '',
@@ -68,6 +68,7 @@ function mapEventToUnified(event) {
68
68
  category: event.category || undefined,
69
69
  tags: event.tags || [],
70
70
  };
71
+ return unifiedEvent;
71
72
  }
72
73
  async function enrichMarketsWithPrices(markets, callMidpoint) {
73
74
  const outcomes = [];
package/dist/types.d.ts CHANGED
@@ -37,6 +37,7 @@ export interface UnifiedMarket {
37
37
  category?: string;
38
38
  tags?: string[];
39
39
  tickSize?: number;
40
+ event?: UnifiedEvent;
40
41
  yes?: MarketOutcome;
41
42
  no?: MarketOutcome;
42
43
  up?: MarketOutcome;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxt-core",
3
- "version": "2.17.1",
3
+ "version": "2.17.3",
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.17.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.17.1,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.17.3,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.17.3,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",