pmxtjs 2.43.16 → 2.43.18

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.
@@ -62,6 +62,7 @@ export interface FetchEventRequest {
62
62
  exchange: FetchEventExchangeEnum;
63
63
  query?: string;
64
64
  limit?: number;
65
+ cursor?: string;
65
66
  offset?: number;
66
67
  sort?: FetchEventSortEnum;
67
68
  status?: FetchEventStatusEnum;
@@ -88,6 +89,7 @@ export interface FetchEventsRequest {
88
89
  exchange: FetchEventsExchangeEnum;
89
90
  query?: string;
90
91
  limit?: number;
92
+ cursor?: string;
91
93
  offset?: number;
92
94
  sort?: FetchEventsSortEnum;
93
95
  status?: FetchEventsStatusEnum;
@@ -335,6 +335,9 @@ export class DefaultApi extends runtime.BaseAPI {
335
335
  if (requestParameters['limit'] != null) {
336
336
  queryParameters['limit'] = requestParameters['limit'];
337
337
  }
338
+ if (requestParameters['cursor'] != null) {
339
+ queryParameters['cursor'] = requestParameters['cursor'];
340
+ }
338
341
  if (requestParameters['offset'] != null) {
339
342
  queryParameters['offset'] = requestParameters['offset'];
340
343
  }
@@ -451,6 +454,9 @@ export class DefaultApi extends runtime.BaseAPI {
451
454
  if (requestParameters['limit'] != null) {
452
455
  queryParameters['limit'] = requestParameters['limit'];
453
456
  }
457
+ if (requestParameters['cursor'] != null) {
458
+ queryParameters['cursor'] = requestParameters['cursor'];
459
+ }
454
460
  if (requestParameters['offset'] != null) {
455
461
  queryParameters['offset'] = requestParameters['offset'];
456
462
  }
@@ -28,6 +28,12 @@ export interface EventFetchParams {
28
28
  * @memberof EventFetchParams
29
29
  */
30
30
  limit?: number;
31
+ /**
32
+ * Opaque venue pagination cursor, where supported.
33
+ * @type {string}
34
+ * @memberof EventFetchParams
35
+ */
36
+ cursor?: string;
31
37
  /**
32
38
  * Pagination offset — number of results to skip
33
39
  * @type {number}
@@ -53,6 +53,7 @@ export function EventFetchParamsFromJSONTyped(json, ignoreDiscriminator) {
53
53
  return {
54
54
  'query': json['query'] == null ? undefined : json['query'],
55
55
  'limit': json['limit'] == null ? undefined : json['limit'],
56
+ 'cursor': json['cursor'] == null ? undefined : json['cursor'],
56
57
  'offset': json['offset'] == null ? undefined : json['offset'],
57
58
  'sort': json['sort'] == null ? undefined : json['sort'],
58
59
  'status': json['status'] == null ? undefined : json['status'],
@@ -74,6 +75,7 @@ export function EventFetchParamsToJSONTyped(value, ignoreDiscriminator = false)
74
75
  return {
75
76
  'query': value['query'],
76
77
  'limit': value['limit'],
78
+ 'cursor': value['cursor'],
77
79
  'offset': value['offset'],
78
80
  'sort': value['sort'],
79
81
  'status': value['status'],
@@ -152,7 +152,7 @@ export declare abstract class Exchange {
152
152
  protected sidecarReadRequest(methodName: string, query: Record<string, unknown>, args: unknown[]): Promise<any>;
153
153
  loadMarkets(reload?: boolean): Promise<Record<string, UnifiedMarket>>;
154
154
  fetchMarkets(params?: MarketFetchParams): Promise<UnifiedMarket[]>;
155
- fetchMarketsPaginated(params?: any): Promise<PaginatedMarketsResult>;
155
+ fetchMarketsPaginated(params?: MarketFetchParams): Promise<PaginatedMarketsResult>;
156
156
  fetchEvents(params?: EventFetchParams): Promise<UnifiedEvent[]>;
157
157
  fetchMarket(params?: MarketFetchParams): Promise<UnifiedMarket>;
158
158
  fetchEvent(params?: EventFetchParams): Promise<UnifiedEvent>;
@@ -388,7 +388,7 @@ export declare abstract class Exchange {
388
388
  * @param amount - The amount to execute
389
389
  * @returns The volume-weighted average price, or 0 if insufficient liquidity
390
390
  */
391
- getExecutionPrice(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): Promise<number>;
391
+ getExecutionPrice(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): number;
392
392
  /**
393
393
  * Calculate detailed execution price information.
394
394
  * Uses the sidecar server for calculation to ensure consistency.
@@ -463,8 +463,12 @@ export declare abstract class Exchange {
463
463
  * Options for initializing Polymarket client.
464
464
  */
465
465
  export interface PolymarketOptions {
466
+ /** Venue-specific API key (e.g. Polymarket CLOB key). Optional. */
467
+ apiKey?: string;
466
468
  /** Private key for authentication (optional) */
467
469
  privateKey?: string;
470
+ /** Hosted pmxt API key. Enables hosted mode when set. */
471
+ pmxtApiKey?: string;
468
472
  /** Base URL of the PMXT sidecar server */
469
473
  baseUrl?: string;
470
474
  /** Automatically start server if not running (default: true) */
@@ -66,7 +66,7 @@ function queryHasNestedObject(query) {
66
66
  }
67
67
  // Converter functions
68
68
  function convertMarket(raw) {
69
- return {
69
+ const market = {
70
70
  ...raw,
71
71
  resolutionDate: raw.resolutionDate ? new Date(raw.resolutionDate) : undefined,
72
72
  outcomes: (raw.outcomes || []).map((o) => ({ ...o })),
@@ -75,6 +75,12 @@ function convertMarket(raw) {
75
75
  up: raw.up ? { ...raw.up } : undefined,
76
76
  down: raw.down ? { ...raw.down } : undefined,
77
77
  };
78
+ Object.defineProperty(market, 'question', {
79
+ get() { return this.title; },
80
+ enumerable: false,
81
+ configurable: true,
82
+ });
83
+ return market;
78
84
  }
79
85
  function convertCandle(raw) {
80
86
  return { ...raw };
@@ -1899,9 +1905,20 @@ export class Exchange {
1899
1905
  * @param amount - The amount to execute
1900
1906
  * @returns The volume-weighted average price, or 0 if insufficient liquidity
1901
1907
  */
1902
- async getExecutionPrice(orderBook, side, amount) {
1903
- const result = await this.getExecutionPriceDetailed(orderBook, side, amount);
1904
- return result.fullyFilled ? result.price : 0;
1908
+ getExecutionPrice(orderBook, side, amount) {
1909
+ const levels = side === 'buy' ? orderBook.asks : orderBook.bids;
1910
+ let remaining = amount;
1911
+ let totalCost = 0;
1912
+ for (const level of levels) {
1913
+ const fill = Math.min(remaining, level.size);
1914
+ totalCost += fill * level.price;
1915
+ remaining -= fill;
1916
+ if (remaining <= 0)
1917
+ break;
1918
+ }
1919
+ if (remaining > 0)
1920
+ return 0;
1921
+ return totalCost / amount;
1905
1922
  }
1906
1923
  /**
1907
1924
  * Calculate detailed execution price information.
@@ -23,6 +23,10 @@ export interface MarketOutcome {
23
23
  priceChange24h?: number;
24
24
  /** Exchange-specific metadata */
25
25
  metadata?: Record<string, any>;
26
+ /** Best bid price from the order book (when includePrices=True) */
27
+ bestBid?: number;
28
+ /** Best ask price from the order book (when includePrices=True) */
29
+ bestAsk?: number;
26
30
  }
27
31
  /**
28
32
  * A unified market representation across exchanges.
@@ -74,6 +78,8 @@ export interface UnifiedMarket {
74
78
  up?: MarketOutcome;
75
79
  /** Convenience access to the Down outcome for binary markets. */
76
80
  down?: MarketOutcome;
81
+ /** Alias for `title`. Matches the Python SDK's `market.question` property. */
82
+ readonly question?: string;
77
83
  }
78
84
  /**
79
85
  * OHLCV price candle.
@@ -62,6 +62,7 @@ export interface FetchEventRequest {
62
62
  exchange: FetchEventExchangeEnum;
63
63
  query?: string;
64
64
  limit?: number;
65
+ cursor?: string;
65
66
  offset?: number;
66
67
  sort?: FetchEventSortEnum;
67
68
  status?: FetchEventStatusEnum;
@@ -88,6 +89,7 @@ export interface FetchEventsRequest {
88
89
  exchange: FetchEventsExchangeEnum;
89
90
  query?: string;
90
91
  limit?: number;
92
+ cursor?: string;
91
93
  offset?: number;
92
94
  sort?: FetchEventsSortEnum;
93
95
  status?: FetchEventsStatusEnum;
@@ -372,6 +372,9 @@ class DefaultApi extends runtime.BaseAPI {
372
372
  if (requestParameters['limit'] != null) {
373
373
  queryParameters['limit'] = requestParameters['limit'];
374
374
  }
375
+ if (requestParameters['cursor'] != null) {
376
+ queryParameters['cursor'] = requestParameters['cursor'];
377
+ }
375
378
  if (requestParameters['offset'] != null) {
376
379
  queryParameters['offset'] = requestParameters['offset'];
377
380
  }
@@ -488,6 +491,9 @@ class DefaultApi extends runtime.BaseAPI {
488
491
  if (requestParameters['limit'] != null) {
489
492
  queryParameters['limit'] = requestParameters['limit'];
490
493
  }
494
+ if (requestParameters['cursor'] != null) {
495
+ queryParameters['cursor'] = requestParameters['cursor'];
496
+ }
491
497
  if (requestParameters['offset'] != null) {
492
498
  queryParameters['offset'] = requestParameters['offset'];
493
499
  }
@@ -28,6 +28,12 @@ export interface EventFetchParams {
28
28
  * @memberof EventFetchParams
29
29
  */
30
30
  limit?: number;
31
+ /**
32
+ * Opaque venue pagination cursor, where supported.
33
+ * @type {string}
34
+ * @memberof EventFetchParams
35
+ */
36
+ cursor?: string;
31
37
  /**
32
38
  * Pagination offset — number of results to skip
33
39
  * @type {number}
@@ -61,6 +61,7 @@ function EventFetchParamsFromJSONTyped(json, ignoreDiscriminator) {
61
61
  return {
62
62
  'query': json['query'] == null ? undefined : json['query'],
63
63
  'limit': json['limit'] == null ? undefined : json['limit'],
64
+ 'cursor': json['cursor'] == null ? undefined : json['cursor'],
64
65
  'offset': json['offset'] == null ? undefined : json['offset'],
65
66
  'sort': json['sort'] == null ? undefined : json['sort'],
66
67
  'status': json['status'] == null ? undefined : json['status'],
@@ -82,6 +83,7 @@ function EventFetchParamsToJSONTyped(value, ignoreDiscriminator = false) {
82
83
  return {
83
84
  'query': value['query'],
84
85
  'limit': value['limit'],
86
+ 'cursor': value['cursor'],
85
87
  'offset': value['offset'],
86
88
  'sort': value['sort'],
87
89
  'status': value['status'],
@@ -152,7 +152,7 @@ export declare abstract class Exchange {
152
152
  protected sidecarReadRequest(methodName: string, query: Record<string, unknown>, args: unknown[]): Promise<any>;
153
153
  loadMarkets(reload?: boolean): Promise<Record<string, UnifiedMarket>>;
154
154
  fetchMarkets(params?: MarketFetchParams): Promise<UnifiedMarket[]>;
155
- fetchMarketsPaginated(params?: any): Promise<PaginatedMarketsResult>;
155
+ fetchMarketsPaginated(params?: MarketFetchParams): Promise<PaginatedMarketsResult>;
156
156
  fetchEvents(params?: EventFetchParams): Promise<UnifiedEvent[]>;
157
157
  fetchMarket(params?: MarketFetchParams): Promise<UnifiedMarket>;
158
158
  fetchEvent(params?: EventFetchParams): Promise<UnifiedEvent>;
@@ -388,7 +388,7 @@ export declare abstract class Exchange {
388
388
  * @param amount - The amount to execute
389
389
  * @returns The volume-weighted average price, or 0 if insufficient liquidity
390
390
  */
391
- getExecutionPrice(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): Promise<number>;
391
+ getExecutionPrice(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): number;
392
392
  /**
393
393
  * Calculate detailed execution price information.
394
394
  * Uses the sidecar server for calculation to ensure consistency.
@@ -463,8 +463,12 @@ export declare abstract class Exchange {
463
463
  * Options for initializing Polymarket client.
464
464
  */
465
465
  export interface PolymarketOptions {
466
+ /** Venue-specific API key (e.g. Polymarket CLOB key). Optional. */
467
+ apiKey?: string;
466
468
  /** Private key for authentication (optional) */
467
469
  privateKey?: string;
470
+ /** Hosted pmxt API key. Enables hosted mode when set. */
471
+ pmxtApiKey?: string;
468
472
  /** Base URL of the PMXT sidecar server */
469
473
  baseUrl?: string;
470
474
  /** Automatically start server if not running (default: true) */
@@ -69,7 +69,7 @@ function queryHasNestedObject(query) {
69
69
  }
70
70
  // Converter functions
71
71
  function convertMarket(raw) {
72
- return {
72
+ const market = {
73
73
  ...raw,
74
74
  resolutionDate: raw.resolutionDate ? new Date(raw.resolutionDate) : undefined,
75
75
  outcomes: (raw.outcomes || []).map((o) => ({ ...o })),
@@ -78,6 +78,12 @@ function convertMarket(raw) {
78
78
  up: raw.up ? { ...raw.up } : undefined,
79
79
  down: raw.down ? { ...raw.down } : undefined,
80
80
  };
81
+ Object.defineProperty(market, 'question', {
82
+ get() { return this.title; },
83
+ enumerable: false,
84
+ configurable: true,
85
+ });
86
+ return market;
81
87
  }
82
88
  function convertCandle(raw) {
83
89
  return { ...raw };
@@ -1902,9 +1908,20 @@ class Exchange {
1902
1908
  * @param amount - The amount to execute
1903
1909
  * @returns The volume-weighted average price, or 0 if insufficient liquidity
1904
1910
  */
1905
- async getExecutionPrice(orderBook, side, amount) {
1906
- const result = await this.getExecutionPriceDetailed(orderBook, side, amount);
1907
- return result.fullyFilled ? result.price : 0;
1911
+ getExecutionPrice(orderBook, side, amount) {
1912
+ const levels = side === 'buy' ? orderBook.asks : orderBook.bids;
1913
+ let remaining = amount;
1914
+ let totalCost = 0;
1915
+ for (const level of levels) {
1916
+ const fill = Math.min(remaining, level.size);
1917
+ totalCost += fill * level.price;
1918
+ remaining -= fill;
1919
+ if (remaining <= 0)
1920
+ break;
1921
+ }
1922
+ if (remaining > 0)
1923
+ return 0;
1924
+ return totalCost / amount;
1908
1925
  }
1909
1926
  /**
1910
1927
  * Calculate detailed execution price information.
@@ -23,6 +23,10 @@ export interface MarketOutcome {
23
23
  priceChange24h?: number;
24
24
  /** Exchange-specific metadata */
25
25
  metadata?: Record<string, any>;
26
+ /** Best bid price from the order book (when includePrices=True) */
27
+ bestBid?: number;
28
+ /** Best ask price from the order book (when includePrices=True) */
29
+ bestAsk?: number;
26
30
  }
27
31
  /**
28
32
  * A unified market representation across exchanges.
@@ -74,6 +78,8 @@ export interface UnifiedMarket {
74
78
  up?: MarketOutcome;
75
79
  /** Convenience access to the Down outcome for binary markets. */
76
80
  down?: MarketOutcome;
81
+ /** Alias for `title`. Matches the Python SDK's `market.question` property. */
82
+ readonly question?: string;
77
83
  }
78
84
  /**
79
85
  * OHLCV price candle.
@@ -702,7 +702,7 @@ No authorization required
702
702
 
703
703
  ## fetchEvent
704
704
 
705
- > FetchEvent200Response fetchEvent(exchange, query, limit, offset, sort, status, searchIn, eventId, slug, filter, category, tags)
705
+ > FetchEvent200Response fetchEvent(exchange, query, limit, cursor, offset, sort, status, searchIn, eventId, slug, filter, category, tags)
706
706
 
707
707
  Fetch Event
708
708
 
@@ -728,6 +728,8 @@ async function example() {
728
728
  query: query_example,
729
729
  // number | Maximum number of results to return (optional)
730
730
  limit: 8.14,
731
+ // string | Opaque venue pagination cursor, where supported. (optional)
732
+ cursor: cursor_example,
731
733
  // number | Pagination offset — number of results to skip (optional)
732
734
  offset: 8.14,
733
735
  // 'volume' | 'liquidity' | 'newest' | Sort order for results (optional)
@@ -768,6 +770,7 @@ example().catch(console.error);
768
770
  | **exchange** | `polymarket`, `kalshi`, `kalshi-demo`, `limitless`, `probable`, `baozi`, `myriad`, `opinion`, `metaculus`, `smarkets`, `polymarket_us`, `gemini-titan`, `hyperliquid`, `mock`, `router` | The prediction market exchange to target. | [Defaults to `undefined`] [Enum: polymarket, kalshi, kalshi-demo, limitless, probable, baozi, myriad, opinion, metaculus, smarkets, polymarket_us, gemini-titan, hyperliquid, mock, router] |
769
771
  | **query** | `string` | For keyword search | [Optional] [Defaults to `undefined`] |
770
772
  | **limit** | `number` | Maximum number of results to return | [Optional] [Defaults to `undefined`] |
773
+ | **cursor** | `string` | Opaque venue pagination cursor, where supported. | [Optional] [Defaults to `undefined`] |
771
774
  | **offset** | `number` | Pagination offset — number of results to skip | [Optional] [Defaults to `undefined`] |
772
775
  | **sort** | `volume`, `liquidity`, `newest` | Sort order for results | [Optional] [Defaults to `undefined`] [Enum: volume, liquidity, newest] |
773
776
  | **status** | `active`, `inactive`, `closed`, `all` | Filter by event status (default: \&#39;active\&#39;, \&#39;inactive\&#39; and \&#39;closed\&#39; are interchangeable) | [Optional] [Defaults to `undefined`] [Enum: active, inactive, closed, all] |
@@ -896,7 +899,7 @@ No authorization required
896
899
 
897
900
  ## fetchEvents
898
901
 
899
- > FetchEvents200Response fetchEvents(exchange, query, limit, offset, sort, status, searchIn, eventId, slug, filter, category, tags)
902
+ > FetchEvents200Response fetchEvents(exchange, query, limit, cursor, offset, sort, status, searchIn, eventId, slug, filter, category, tags)
900
903
 
901
904
  Fetch Events
902
905
 
@@ -922,6 +925,8 @@ async function example() {
922
925
  query: query_example,
923
926
  // number | Maximum number of results to return (optional)
924
927
  limit: 8.14,
928
+ // string | Opaque venue pagination cursor, where supported. (optional)
929
+ cursor: cursor_example,
925
930
  // number | Pagination offset — number of results to skip (optional)
926
931
  offset: 8.14,
927
932
  // 'volume' | 'liquidity' | 'newest' | Sort order for results (optional)
@@ -962,6 +967,7 @@ example().catch(console.error);
962
967
  | **exchange** | `polymarket`, `kalshi`, `kalshi-demo`, `limitless`, `probable`, `baozi`, `myriad`, `opinion`, `metaculus`, `smarkets`, `polymarket_us`, `gemini-titan`, `hyperliquid`, `mock`, `router` | The prediction market exchange to target. | [Defaults to `undefined`] [Enum: polymarket, kalshi, kalshi-demo, limitless, probable, baozi, myriad, opinion, metaculus, smarkets, polymarket_us, gemini-titan, hyperliquid, mock, router] |
963
968
  | **query** | `string` | For keyword search | [Optional] [Defaults to `undefined`] |
964
969
  | **limit** | `number` | Maximum number of results to return | [Optional] [Defaults to `undefined`] |
970
+ | **cursor** | `string` | Opaque venue pagination cursor, where supported. | [Optional] [Defaults to `undefined`] |
965
971
  | **offset** | `number` | Pagination offset — number of results to skip | [Optional] [Defaults to `undefined`] |
966
972
  | **sort** | `volume`, `liquidity`, `newest` | Sort order for results | [Optional] [Defaults to `undefined`] [Enum: volume, liquidity, newest] |
967
973
  | **status** | `active`, `inactive`, `closed`, `all` | Filter by event status (default: \&#39;active\&#39;, \&#39;inactive\&#39; and \&#39;closed\&#39; are interchangeable) | [Optional] [Defaults to `undefined`] [Enum: active, inactive, closed, all] |
@@ -8,6 +8,7 @@ Name | Type
8
8
  ------------ | -------------
9
9
  `query` | string
10
10
  `limit` | number
11
+ `cursor` | string
11
12
  `offset` | number
12
13
  `sort` | string
13
14
  `status` | string
@@ -27,6 +28,7 @@ import type { EventFetchParams } from 'pmxtjs'
27
28
  const example = {
28
29
  "query": null,
29
30
  "limit": null,
31
+ "cursor": null,
30
32
  "offset": null,
31
33
  "sort": null,
32
34
  "status": null,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxtjs",
3
- "version": "2.43.16",
3
+ "version": "2.43.18",
4
4
  "description": "OpenAPI client for pmxtjs",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
@@ -205,6 +205,7 @@ export interface FetchEventRequest {
205
205
  exchange: FetchEventExchangeEnum;
206
206
  query?: string;
207
207
  limit?: number;
208
+ cursor?: string;
208
209
  offset?: number;
209
210
  sort?: FetchEventSortEnum;
210
211
  status?: FetchEventStatusEnum;
@@ -233,6 +234,7 @@ export interface FetchEventsRequest {
233
234
  exchange: FetchEventsExchangeEnum;
234
235
  query?: string;
235
236
  limit?: number;
237
+ cursor?: string;
236
238
  offset?: number;
237
239
  sort?: FetchEventsSortEnum;
238
240
  status?: FetchEventsStatusEnum;
@@ -890,6 +892,10 @@ export class DefaultApi extends runtime.BaseAPI {
890
892
  queryParameters['limit'] = requestParameters['limit'];
891
893
  }
892
894
 
895
+ if (requestParameters['cursor'] != null) {
896
+ queryParameters['cursor'] = requestParameters['cursor'];
897
+ }
898
+
893
899
  if (requestParameters['offset'] != null) {
894
900
  queryParameters['offset'] = requestParameters['offset'];
895
901
  }
@@ -1048,6 +1054,10 @@ export class DefaultApi extends runtime.BaseAPI {
1048
1054
  queryParameters['limit'] = requestParameters['limit'];
1049
1055
  }
1050
1056
 
1057
+ if (requestParameters['cursor'] != null) {
1058
+ queryParameters['cursor'] = requestParameters['cursor'];
1059
+ }
1060
+
1051
1061
  if (requestParameters['offset'] != null) {
1052
1062
  queryParameters['offset'] = requestParameters['offset'];
1053
1063
  }
@@ -39,6 +39,12 @@ export interface EventFetchParams {
39
39
  * @memberof EventFetchParams
40
40
  */
41
41
  limit?: number;
42
+ /**
43
+ * Opaque venue pagination cursor, where supported.
44
+ * @type {string}
45
+ * @memberof EventFetchParams
46
+ */
47
+ cursor?: string;
42
48
  /**
43
49
  * Pagination offset — number of results to skip
44
50
  * @type {number}
@@ -147,6 +153,7 @@ export function EventFetchParamsFromJSONTyped(json: any, ignoreDiscriminator: bo
147
153
 
148
154
  'query': json['query'] == null ? undefined : json['query'],
149
155
  'limit': json['limit'] == null ? undefined : json['limit'],
156
+ 'cursor': json['cursor'] == null ? undefined : json['cursor'],
150
157
  'offset': json['offset'] == null ? undefined : json['offset'],
151
158
  'sort': json['sort'] == null ? undefined : json['sort'],
152
159
  'status': json['status'] == null ? undefined : json['status'],
@@ -172,6 +179,7 @@ export function EventFetchParamsToJSONTyped(value?: EventFetchParams | null, ign
172
179
 
173
180
  'query': value['query'],
174
181
  'limit': value['limit'],
182
+ 'cursor': value['cursor'],
175
183
  'offset': value['offset'],
176
184
  'sort': value['sort'],
177
185
  'status': value['status'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxtjs",
3
- "version": "2.43.16",
3
+ "version": "2.43.18",
4
4
  "description": "Unified prediction market data API - The ccxt for prediction markets",
5
5
  "author": "PMXT Contributors",
6
6
  "repository": {
@@ -43,14 +43,14 @@
43
43
  "unified"
44
44
  ],
45
45
  "dependencies": {
46
- "pmxt-core": "2.43.16",
46
+ "pmxt-core": "2.43.18",
47
47
  "ws": "^8.18.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/jest": "^30.0.0",
51
51
  "@types/node": "^20.0.0",
52
52
  "jest": "^30.4.2",
53
- "ts-jest": "^29.4.9",
53
+ "ts-jest": "^29.4.11",
54
54
  "typescript": "^5.0.0"
55
55
  }
56
56
  }
package/pmxt/client.ts CHANGED
@@ -104,7 +104,7 @@ function queryHasNestedObject(query: Record<string, unknown>): boolean {
104
104
 
105
105
  // Converter functions
106
106
  function convertMarket(raw: any): UnifiedMarket {
107
- return {
107
+ const market: UnifiedMarket = {
108
108
  ...raw,
109
109
  resolutionDate: raw.resolutionDate ? new Date(raw.resolutionDate) : undefined,
110
110
  outcomes: (raw.outcomes || []).map((o: any) => ({ ...o })),
@@ -113,6 +113,12 @@ function convertMarket(raw: any): UnifiedMarket {
113
113
  up: raw.up ? { ...raw.up } : undefined,
114
114
  down: raw.down ? { ...raw.down } : undefined,
115
115
  };
116
+ Object.defineProperty(market, 'question', {
117
+ get() { return this.title; },
118
+ enumerable: false,
119
+ configurable: true,
120
+ });
121
+ return market;
116
122
  }
117
123
 
118
124
 
@@ -659,7 +665,7 @@ export abstract class Exchange {
659
665
  }
660
666
  }
661
667
 
662
- async fetchMarketsPaginated(params?: any): Promise<PaginatedMarketsResult> {
668
+ async fetchMarketsPaginated(params?: MarketFetchParams): Promise<PaginatedMarketsResult> {
663
669
  await this.initPromise;
664
670
  try {
665
671
  const args: any[] = [];
@@ -2043,9 +2049,18 @@ export abstract class Exchange {
2043
2049
  * @param amount - The amount to execute
2044
2050
  * @returns The volume-weighted average price, or 0 if insufficient liquidity
2045
2051
  */
2046
- async getExecutionPrice(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): Promise<number> {
2047
- const result = await this.getExecutionPriceDetailed(orderBook, side, amount);
2048
- return result.fullyFilled ? result.price : 0;
2052
+ getExecutionPrice(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): number {
2053
+ const levels = side === 'buy' ? orderBook.asks : orderBook.bids;
2054
+ let remaining = amount;
2055
+ let totalCost = 0;
2056
+ for (const level of levels) {
2057
+ const fill = Math.min(remaining, level.size);
2058
+ totalCost += fill * level.price;
2059
+ remaining -= fill;
2060
+ if (remaining <= 0) break;
2061
+ }
2062
+ if (remaining > 0) return 0;
2063
+ return totalCost / amount;
2049
2064
  }
2050
2065
 
2051
2066
  /**
@@ -2400,9 +2415,15 @@ export abstract class Exchange {
2400
2415
  * Options for initializing Polymarket client.
2401
2416
  */
2402
2417
  export interface PolymarketOptions {
2418
+ /** Venue-specific API key (e.g. Polymarket CLOB key). Optional. */
2419
+ apiKey?: string;
2420
+
2403
2421
  /** Private key for authentication (optional) */
2404
2422
  privateKey?: string;
2405
2423
 
2424
+ /** Hosted pmxt API key. Enables hosted mode when set. */
2425
+ pmxtApiKey?: string;
2426
+
2406
2427
  /** Base URL of the PMXT sidecar server */
2407
2428
  baseUrl?: string;
2408
2429
 
package/pmxt/models.ts CHANGED
@@ -29,6 +29,12 @@ export interface MarketOutcome {
29
29
 
30
30
  /** Exchange-specific metadata */
31
31
  metadata?: Record<string, any>;
32
+
33
+ /** Best bid price from the order book (when includePrices=True) */
34
+ bestBid?: number;
35
+
36
+ /** Best ask price from the order book (when includePrices=True) */
37
+ bestAsk?: number;
32
38
  }
33
39
 
34
40
  /**
@@ -103,6 +109,9 @@ export interface UnifiedMarket {
103
109
 
104
110
  /** Convenience access to the Down outcome for binary markets. */
105
111
  down?: MarketOutcome;
112
+
113
+ /** Alias for `title`. Matches the Python SDK's `market.question` property. */
114
+ readonly question?: string;
106
115
  }
107
116
 
108
117
  /**