pmxt-core 2.41.1 → 2.41.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.
@@ -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-15T18:19:35.222Z
3
+ * Generated at: 2026-05-15T19:10:58.060Z
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-15T18:19:35.222Z
6
+ * Generated at: 2026-05-15T19:10:58.060Z
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-15T18:19:35.272Z
3
+ * Generated at: 2026-05-15T19:10:58.097Z
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-15T18:19:35.272Z
6
+ * Generated at: 2026-05-15T19:10:58.097Z
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-15T18:19:35.290Z
3
+ * Generated at: 2026-05-15T19:10:58.109Z
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-15T18:19:35.290Z
6
+ * Generated at: 2026-05-15T19:10:58.109Z
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-05-15T18:19:35.296Z
3
+ * Generated at: 2026-05-15T19:10:58.114Z
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-15T18:19:35.296Z
6
+ * Generated at: 2026-05-15T19:10:58.114Z
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-15T18:19:35.230Z
3
+ * Generated at: 2026-05-15T19:10:58.068Z
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-15T18:19:35.230Z
6
+ * Generated at: 2026-05-15T19:10:58.068Z
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-15T18:19:35.251Z
3
+ * Generated at: 2026-05-15T19:10:58.080Z
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-15T18:19:35.251Z
6
+ * Generated at: 2026-05-15T19:10:58.080Z
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-15T18:19:35.248Z
3
+ * Generated at: 2026-05-15T19:10:58.078Z
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-15T18:19:35.248Z
6
+ * Generated at: 2026-05-15T19:10:58.078Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.polymarketGammaSpec = {
@@ -153,20 +153,19 @@ class PolymarketExchange extends BaseExchange_1.PredictionMarketExchange {
153
153
  const auth = this.ensureAuth();
154
154
  const client = await auth.getClobClient();
155
155
  const side = params.side.toUpperCase() === 'BUY' ? clob_client_v2_1.Side.BUY : clob_client_v2_1.Side.SELL;
156
- const price = params.price || (side === clob_client_v2_1.Side.BUY ? 0.99 : 0.01);
157
156
  const tickSize = params.tickSize ? params.tickSize.toString() : undefined;
158
- const orderArgs = {
159
- tokenID: params.outcomeId,
160
- price,
161
- side,
162
- size: params.amount,
163
- };
164
157
  const options = {};
165
158
  if (tickSize)
166
159
  options.tickSize = tickSize;
167
160
  if (params.negRisk !== undefined)
168
161
  options.negRisk = params.negRisk;
169
- const signedOrder = await client.createOrder(orderArgs, options);
162
+ let signedOrder;
163
+ if (params.type === 'market' || !params.price) {
164
+ signedOrder = await client.createMarketOrder({ tokenID: params.outcomeId, amount: params.amount, side }, options);
165
+ }
166
+ else {
167
+ signedOrder = await client.createOrder({ tokenID: params.outcomeId, price: params.price, side, size: params.amount }, options);
168
+ }
170
169
  return {
171
170
  exchange: this.name,
172
171
  params,
@@ -182,36 +181,31 @@ class PolymarketExchange extends BaseExchange_1.PredictionMarketExchange {
182
181
  try {
183
182
  const auth = this.ensureAuth();
184
183
  const client = await auth.getClobClient();
185
- const response = await client.postOrder(built.raw);
184
+ const isMarket = built.params.type === 'market' || !built.params.price;
185
+ const response = isMarket
186
+ ? await client.postOrder(built.raw, 'FOK')
187
+ : await client.postOrder(built.raw);
186
188
  if (!response || !response.success) {
187
189
  throw new Error(`${response?.errorMsg || 'Order submission failed'} (Response: ${JSON.stringify(response)})`);
188
190
  }
189
191
  const side = built.params.side.toUpperCase() === 'BUY' ? clob_client_v2_1.Side.BUY : clob_client_v2_1.Side.SELL;
190
- const price = built.params.price || (side === clob_client_v2_1.Side.BUY ? 0.99 : 0.01);
191
- // Extract actual fill data from the CLOB OrderResponse.
192
- // response.status: 'MATCHED' | 'CONFIRMED' = immediately filled,
193
- // 'LIVE' = resting on the book (filled: 0 is correct).
194
- // takingAmount / makingAmount are string representations of raw USDC amounts (6 decimals).
195
- const USDC_DECIMALS = 6;
192
+ const price = built.params.price || 0;
196
193
  const responseStatus = (response.status || '').toUpperCase();
197
194
  const isImmediatelyFilled = responseStatus === 'MATCHED' || responseStatus === 'CONFIRMED';
198
195
  let filled = 0;
199
196
  if (isImmediatelyFilled) {
200
- const takingRaw = typeof response.takingAmount === 'string'
197
+ const taking = typeof response.takingAmount === 'string'
201
198
  ? parseFloat(response.takingAmount)
202
199
  : (response.takingAmount ?? 0);
203
- const makingRaw = typeof response.makingAmount === 'string'
200
+ const making = typeof response.makingAmount === 'string'
204
201
  ? parseFloat(response.makingAmount)
205
202
  : (response.makingAmount ?? 0);
206
- // For BUY: makingAmount is USDC spent, takingAmount is shares received.
207
- // For SELL: makingAmount is shares sold, takingAmount is USDC received.
208
- // `filled` should reflect the share size that executed.
209
- filled = side === clob_client_v2_1.Side.BUY
210
- ? takingRaw / Math.pow(10, USDC_DECIMALS)
211
- : makingRaw / Math.pow(10, USDC_DECIMALS);
203
+ // For BUY: makingAmount = shares filled. For SELL: takingAmount = shares filled.
204
+ // Values are already human-readable (not raw 6-decimal units).
205
+ filled = side === clob_client_v2_1.Side.BUY ? making : taking;
212
206
  }
213
207
  const remaining = Math.max(0, built.params.amount - filled);
214
- const orderStatus = filled >= built.params.amount ? 'filled' : 'open';
208
+ const orderStatus = filled >= built.params.amount - 0.001 ? 'filled' : 'open';
215
209
  return {
216
210
  id: response.orderID,
217
211
  marketId: built.params.marketId,
@@ -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-15T18:19:35.279Z
3
+ * Generated at: 2026-05-15T19:10:58.102Z
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-15T18:19:35.279Z
6
+ * Generated at: 2026-05-15T19:10:58.102Z
7
7
  * Do not edit manually -- run "npm run fetch:openapi" to regenerate.
8
8
  */
9
9
  exports.probableApiSpec = {
@@ -1296,7 +1296,7 @@ paths:
1296
1296
  function.
1297
1297
  '/api/{exchange}/watchOrderBook':
1298
1298
  post:
1299
- summary: Watch Order Book (WebSocket)
1299
+ summary: Watch Order Book
1300
1300
  operationId: watchOrderBook
1301
1301
  parameters:
1302
1302
  - $ref: '#/components/parameters/ExchangeParam'
@@ -1342,22 +1342,9 @@ paths:
1342
1342
  { "id": "req-1", "action": "unsubscribe" }
1343
1343
 
1344
1344
  ```
1345
- requestBody:
1346
- content:
1347
- application/json:
1348
- schema:
1349
- title: WatchOrderBookRequest
1350
- type: object
1351
- properties:
1352
- args:
1353
- type: array
1354
- items:
1355
- type: string
1356
- credentials:
1357
- $ref: '#/components/schemas/ExchangeCredentials'
1358
1345
  responses:
1359
1346
  '200':
1360
- description: Watch Order Book response (WebSocket data event)
1347
+ description: Watch Order Book response
1361
1348
  content:
1362
1349
  application/json:
1363
1350
  schema:
@@ -1369,7 +1356,7 @@ paths:
1369
1356
  $ref: '#/components/schemas/OrderBook'
1370
1357
  '/api/{exchange}/watchOrderBooks':
1371
1358
  post:
1372
- summary: Watch Order Books (WebSocket)
1359
+ summary: Watch Order Books
1373
1360
  operationId: watchOrderBooks
1374
1361
  parameters:
1375
1362
  - $ref: '#/components/parameters/ExchangeParam'
@@ -1416,22 +1403,9 @@ paths:
1416
1403
  { "id": "req-1", "action": "unsubscribe" }
1417
1404
 
1418
1405
  ```
1419
- requestBody:
1420
- content:
1421
- application/json:
1422
- schema:
1423
- title: WatchOrderBooksRequest
1424
- type: object
1425
- properties:
1426
- args:
1427
- type: array
1428
- items:
1429
- type: string
1430
- credentials:
1431
- $ref: '#/components/schemas/ExchangeCredentials'
1432
1406
  responses:
1433
1407
  '200':
1434
- description: Watch Order Books response (WebSocket data event)
1408
+ description: Watch Order Books response
1435
1409
  content:
1436
1410
  application/json:
1437
1411
  schema:
@@ -1445,7 +1419,7 @@ paths:
1445
1419
  $ref: '#/components/schemas/OrderBook'
1446
1420
  '/api/{exchange}/unwatchOrderBook':
1447
1421
  post:
1448
- summary: Unwatch Order Book (WebSocket)
1422
+ summary: Unwatch Order Book
1449
1423
  operationId: unwatchOrderBook
1450
1424
  parameters:
1451
1425
  - $ref: '#/components/parameters/ExchangeParam'
@@ -1473,29 +1447,16 @@ paths:
1473
1447
  ```json
1474
1448
  { "id": "req-1", "action": "unsubscribe" }
1475
1449
  ```
1476
- requestBody:
1477
- content:
1478
- application/json:
1479
- schema:
1480
- title: UnwatchOrderBookRequest
1481
- type: object
1482
- properties:
1483
- args:
1484
- type: array
1485
- items:
1486
- type: string
1487
- credentials:
1488
- $ref: '#/components/schemas/ExchangeCredentials'
1489
1450
  responses:
1490
1451
  '200':
1491
- description: Unwatch Order Book response (WebSocket data event)
1452
+ description: Unwatch Order Book response
1492
1453
  content:
1493
1454
  application/json:
1494
1455
  schema:
1495
1456
  $ref: '#/components/schemas/BaseResponse'
1496
1457
  '/api/{exchange}/watchTrades':
1497
1458
  post:
1498
- summary: Watch Trades (WebSocket)
1459
+ summary: Watch Trades
1499
1460
  operationId: watchTrades
1500
1461
  parameters:
1501
1462
  - $ref: '#/components/parameters/ExchangeParam'
@@ -1541,22 +1502,9 @@ paths:
1541
1502
  { "id": "req-1", "action": "unsubscribe" }
1542
1503
 
1543
1504
  ```
1544
- requestBody:
1545
- content:
1546
- application/json:
1547
- schema:
1548
- title: WatchTradesRequest
1549
- type: object
1550
- properties:
1551
- args:
1552
- type: array
1553
- items:
1554
- type: string
1555
- credentials:
1556
- $ref: '#/components/schemas/ExchangeCredentials'
1557
1505
  responses:
1558
1506
  '200':
1559
- description: Watch Trades response (WebSocket data event)
1507
+ description: Watch Trades response
1560
1508
  content:
1561
1509
  application/json:
1562
1510
  schema:
@@ -1570,7 +1518,7 @@ paths:
1570
1518
  $ref: '#/components/schemas/Trade'
1571
1519
  '/api/{exchange}/watchAddress':
1572
1520
  post:
1573
- summary: Watch Address (WebSocket)
1521
+ summary: Watch Address
1574
1522
  operationId: watchAddress
1575
1523
  parameters:
1576
1524
  - $ref: '#/components/parameters/ExchangeParam'
@@ -1616,22 +1564,9 @@ paths:
1616
1564
  { "id": "req-1", "action": "unsubscribe" }
1617
1565
 
1618
1566
  ```
1619
- requestBody:
1620
- content:
1621
- application/json:
1622
- schema:
1623
- title: WatchAddressRequest
1624
- type: object
1625
- properties:
1626
- args:
1627
- type: array
1628
- items:
1629
- type: string
1630
- credentials:
1631
- $ref: '#/components/schemas/ExchangeCredentials'
1632
1567
  responses:
1633
1568
  '200':
1634
- description: Watch Address response (WebSocket data event)
1569
+ description: Watch Address response
1635
1570
  content:
1636
1571
  application/json:
1637
1572
  schema:
@@ -1643,7 +1578,7 @@ paths:
1643
1578
  type: object
1644
1579
  '/api/{exchange}/unwatchAddress':
1645
1580
  post:
1646
- summary: Unwatch Address (WebSocket)
1581
+ summary: Unwatch Address
1647
1582
  operationId: unwatchAddress
1648
1583
  parameters:
1649
1584
  - $ref: '#/components/parameters/ExchangeParam'
@@ -1671,22 +1606,9 @@ paths:
1671
1606
  ```json
1672
1607
  { "id": "req-1", "action": "unsubscribe" }
1673
1608
  ```
1674
- requestBody:
1675
- content:
1676
- application/json:
1677
- schema:
1678
- title: UnwatchAddressRequest
1679
- type: object
1680
- properties:
1681
- args:
1682
- type: array
1683
- items:
1684
- type: string
1685
- credentials:
1686
- $ref: '#/components/schemas/ExchangeCredentials'
1687
1609
  responses:
1688
1610
  '200':
1689
- description: Unwatch Address response (WebSocket data event)
1611
+ description: Unwatch Address response
1690
1612
  content:
1691
1613
  application/json:
1692
1614
  schema:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxt-core",
3
- "version": "2.41.1",
3
+ "version": "2.41.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.41.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.41.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.41.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.41.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",