pmxtjs 1.3.3 → 1.4.0

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.
Files changed (52) hide show
  1. package/dist/esm/generated/src/apis/DefaultApi.d.ts +41 -1
  2. package/dist/esm/generated/src/apis/DefaultApi.js +71 -1
  3. package/dist/esm/generated/src/models/ExecutionPriceResult.d.ts +44 -0
  4. package/dist/esm/generated/src/models/ExecutionPriceResult.js +45 -0
  5. package/dist/esm/generated/src/models/GetExecutionPrice200Response.d.ts +45 -0
  6. package/dist/esm/generated/src/models/GetExecutionPrice200Response.js +46 -0
  7. package/dist/esm/generated/src/models/GetExecutionPriceDetailed200Response.d.ts +46 -0
  8. package/dist/esm/generated/src/models/GetExecutionPriceDetailed200Response.js +47 -0
  9. package/dist/esm/generated/src/models/GetExecutionPriceRequest.d.ts +40 -0
  10. package/dist/esm/generated/src/models/GetExecutionPriceRequest.js +47 -0
  11. package/dist/esm/generated/src/models/GetExecutionPriceRequestArgsInner.d.ts +22 -0
  12. package/dist/esm/generated/src/models/GetExecutionPriceRequestArgsInner.js +56 -0
  13. package/dist/esm/generated/src/models/index.d.ts +5 -0
  14. package/dist/esm/generated/src/models/index.js +5 -0
  15. package/dist/esm/pmxt/client.d.ts +36 -2
  16. package/dist/esm/pmxt/client.js +134 -4
  17. package/dist/esm/pmxt/models.d.ts +42 -0
  18. package/dist/generated/src/apis/DefaultApi.d.ts +41 -1
  19. package/dist/generated/src/apis/DefaultApi.js +71 -1
  20. package/dist/generated/src/models/ExecutionPriceResult.d.ts +44 -0
  21. package/dist/generated/src/models/ExecutionPriceResult.js +52 -0
  22. package/dist/generated/src/models/GetExecutionPrice200Response.d.ts +45 -0
  23. package/dist/generated/src/models/GetExecutionPrice200Response.js +53 -0
  24. package/dist/generated/src/models/GetExecutionPriceDetailed200Response.d.ts +46 -0
  25. package/dist/generated/src/models/GetExecutionPriceDetailed200Response.js +54 -0
  26. package/dist/generated/src/models/GetExecutionPriceRequest.d.ts +40 -0
  27. package/dist/generated/src/models/GetExecutionPriceRequest.js +54 -0
  28. package/dist/generated/src/models/GetExecutionPriceRequestArgsInner.d.ts +22 -0
  29. package/dist/generated/src/models/GetExecutionPriceRequestArgsInner.js +62 -0
  30. package/dist/generated/src/models/index.d.ts +5 -0
  31. package/dist/generated/src/models/index.js +5 -0
  32. package/dist/pmxt/client.d.ts +36 -2
  33. package/dist/pmxt/client.js +134 -4
  34. package/dist/pmxt/models.d.ts +42 -0
  35. package/generated/.openapi-generator/FILES +10 -0
  36. package/generated/docs/DefaultApi.md +138 -0
  37. package/generated/docs/ExecutionPriceResult.md +38 -0
  38. package/generated/docs/GetExecutionPrice200Response.md +38 -0
  39. package/generated/docs/GetExecutionPriceDetailed200Response.md +38 -0
  40. package/generated/docs/GetExecutionPriceRequest.md +36 -0
  41. package/generated/docs/GetExecutionPriceRequestArgsInner.md +38 -0
  42. package/generated/package.json +1 -1
  43. package/generated/src/apis/DefaultApi.ts +115 -0
  44. package/generated/src/models/ExecutionPriceResult.ts +81 -0
  45. package/generated/src/models/GetExecutionPrice200Response.ts +89 -0
  46. package/generated/src/models/GetExecutionPriceDetailed200Response.ts +96 -0
  47. package/generated/src/models/GetExecutionPriceRequest.ts +89 -0
  48. package/generated/src/models/GetExecutionPriceRequestArgsInner.ts +75 -0
  49. package/generated/src/models/index.ts +5 -0
  50. package/package.json +2 -2
  51. package/pmxt/client.ts +156 -4
  52. package/pmxt/models.ts +54 -0
@@ -4,8 +4,8 @@
4
4
  * This module provides clean, TypeScript-friendly wrappers around the auto-generated
5
5
  * OpenAPI client, matching the Python API exactly.
6
6
  */
7
- import { DefaultApi, ExchangeCredentials } from "../generated/src/index.js";
8
- import { UnifiedMarket, PriceCandle, OrderBook, Trade, Order, Position, Balance, MarketFilterParams, HistoryFilterParams, CreateOrderParams } from "./models.js";
7
+ import { DefaultApi, Configuration, ExchangeCredentials } from "../generated/src/index.js";
8
+ import { UnifiedMarket, PriceCandle, OrderBook, Trade, Order, Position, Balance, MarketFilterParams, HistoryFilterParams, CreateOrderParams, UnifiedEvent, ExecutionPriceResult } from "./models.js";
9
9
  import { ServerManager } from "./server-manager.js";
10
10
  /**
11
11
  * Base exchange client options.
@@ -31,6 +31,7 @@ export declare abstract class Exchange {
31
31
  protected apiKey?: string;
32
32
  protected privateKey?: string;
33
33
  protected api: DefaultApi;
34
+ protected config: Configuration;
34
35
  protected serverManager: ServerManager;
35
36
  protected initPromise: Promise<void>;
36
37
  constructor(exchangeName: string, options?: ExchangeOptions);
@@ -62,6 +63,19 @@ export declare abstract class Exchange {
62
63
  * ```
63
64
  */
64
65
  searchMarkets(query: string, params?: MarketFilterParams): Promise<UnifiedMarket[]>;
66
+ /**
67
+ * Search events (groups of related markets) by keyword.
68
+ *
69
+ * @param query - Search query
70
+ * @param params - Optional filter parameters
71
+ * @returns List of matching events
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const events = await exchange.searchEvents("Trump");
76
+ * ```
77
+ */
78
+ searchEvents(query: string, params?: MarketFilterParams): Promise<UnifiedEvent[]>;
65
79
  /**
66
80
  * Fetch markets by URL slug/ticker.
67
81
  *
@@ -220,6 +234,26 @@ export declare abstract class Exchange {
220
234
  * @returns List of balances (by currency)
221
235
  */
222
236
  fetchBalance(): Promise<Balance[]>;
237
+ /**
238
+ * Calculate the average execution price for a given amount by walking the order book.
239
+ * Uses the sidecar server for calculation to ensure consistency.
240
+ *
241
+ * @param orderBook - The current order book
242
+ * @param side - 'buy' or 'sell'
243
+ * @param amount - The amount to execute
244
+ * @returns The volume-weighted average price, or 0 if insufficient liquidity
245
+ */
246
+ getExecutionPrice(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): Promise<number>;
247
+ /**
248
+ * Calculate detailed execution price information.
249
+ * Uses the sidecar server for calculation to ensure consistency.
250
+ *
251
+ * @param orderBook - The current order book
252
+ * @param side - 'buy' or 'sell'
253
+ * @param amount - The amount to execute
254
+ * @returns Detailed execution result
255
+ */
256
+ getExecutionPriceDetailed(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): Promise<ExecutionPriceResult>;
223
257
  }
224
258
  /**
225
259
  * Polymarket exchange client.
@@ -112,6 +112,37 @@ function convertBalance(raw) {
112
112
  locked: raw.locked,
113
113
  };
114
114
  }
115
+ function convertEvent(raw) {
116
+ const markets = (raw.markets || []).map(convertMarket);
117
+ return {
118
+ id: raw.id,
119
+ title: raw.title,
120
+ description: raw.description,
121
+ slug: raw.slug,
122
+ markets,
123
+ url: raw.url,
124
+ image: raw.image,
125
+ category: raw.category,
126
+ tags: raw.tags,
127
+ searchMarkets(query, searchIn = "both") {
128
+ const queryLower = query.toLowerCase();
129
+ return this.markets.filter(market => {
130
+ let match = false;
131
+ if (searchIn === "title" || searchIn === "both") {
132
+ if (market.title.toLowerCase().includes(queryLower)) {
133
+ match = true;
134
+ }
135
+ }
136
+ if (searchIn === "description" || searchIn === "both") {
137
+ if (market.description?.toLowerCase().includes(queryLower)) {
138
+ match = true;
139
+ }
140
+ }
141
+ return match;
142
+ });
143
+ }
144
+ };
145
+ }
115
146
  /**
116
147
  * Base class for prediction market exchanges.
117
148
  *
@@ -123,6 +154,7 @@ export class Exchange {
123
154
  apiKey;
124
155
  privateKey;
125
156
  api;
157
+ config;
126
158
  serverManager;
127
159
  initPromise;
128
160
  constructor(exchangeName, options = {}) {
@@ -134,8 +166,8 @@ export class Exchange {
134
166
  // Initialize server manager
135
167
  this.serverManager = new ServerManager({ baseUrl });
136
168
  // Configure the API client with the initial base URL (will be updated if port changes)
137
- const config = new Configuration({ basePath: baseUrl });
138
- this.api = new DefaultApi(config);
169
+ this.config = new Configuration({ basePath: baseUrl });
170
+ this.api = new DefaultApi(this.config);
139
171
  // Initialize the server connection asynchronously
140
172
  this.initPromise = this.initializeServer(autoStartServer);
141
173
  }
@@ -153,11 +185,11 @@ export class Exchange {
153
185
  headers['x-pmxt-access-token'] = accessToken;
154
186
  }
155
187
  // Update API client with actual base URL
156
- const newConfig = new Configuration({
188
+ this.config = new Configuration({
157
189
  basePath: newBaseUrl,
158
190
  headers
159
191
  });
160
- this.api = new DefaultApi(newConfig);
192
+ this.api = new DefaultApi(this.config);
161
193
  }
162
194
  catch (error) {
163
195
  throw new Error(`Failed to start PMXT server: ${error}\n\n` +
@@ -250,6 +282,52 @@ export class Exchange {
250
282
  throw new Error(`Failed to search markets: ${error}`);
251
283
  }
252
284
  }
285
+ /**
286
+ * Search events (groups of related markets) by keyword.
287
+ *
288
+ * @param query - Search query
289
+ * @param params - Optional filter parameters
290
+ * @returns List of matching events
291
+ *
292
+ * @example
293
+ * ```typescript
294
+ * const events = await exchange.searchEvents("Trump");
295
+ * ```
296
+ */
297
+ async searchEvents(query, params) {
298
+ await this.initPromise;
299
+ try {
300
+ const args = [query];
301
+ if (params) {
302
+ args.push(params);
303
+ }
304
+ const body = { args };
305
+ const credentials = this.getCredentials();
306
+ if (credentials) {
307
+ body.credentials = credentials;
308
+ }
309
+ // Manual implementation since generated client is missing this
310
+ const url = `${this.config.basePath}/api/${this.exchangeName}/searchEvents`;
311
+ const response = await fetch(url, {
312
+ method: 'POST',
313
+ headers: {
314
+ 'Content-Type': 'application/json',
315
+ ...this.config.headers
316
+ },
317
+ body: JSON.stringify(body)
318
+ });
319
+ if (!response.ok) {
320
+ const error = await response.json().catch(() => ({}));
321
+ throw new Error(error.error?.message || response.statusText);
322
+ }
323
+ const json = await response.json();
324
+ const data = this.handleResponse(json);
325
+ return data.map(convertEvent);
326
+ }
327
+ catch (error) {
328
+ throw new Error(`Failed to search events: ${error}`);
329
+ }
330
+ }
253
331
  /**
254
332
  * Fetch markets by URL slug/ticker.
255
333
  *
@@ -654,6 +732,58 @@ export class Exchange {
654
732
  throw new Error(`Failed to fetch balance: ${error}`);
655
733
  }
656
734
  }
735
+ /**
736
+ * Calculate the average execution price for a given amount by walking the order book.
737
+ * Uses the sidecar server for calculation to ensure consistency.
738
+ *
739
+ * @param orderBook - The current order book
740
+ * @param side - 'buy' or 'sell'
741
+ * @param amount - The amount to execute
742
+ * @returns The volume-weighted average price, or 0 if insufficient liquidity
743
+ */
744
+ async getExecutionPrice(orderBook, side, amount) {
745
+ const result = await this.getExecutionPriceDetailed(orderBook, side, amount);
746
+ return result.fullyFilled ? result.price : 0;
747
+ }
748
+ /**
749
+ * Calculate detailed execution price information.
750
+ * Uses the sidecar server for calculation to ensure consistency.
751
+ *
752
+ * @param orderBook - The current order book
753
+ * @param side - 'buy' or 'sell'
754
+ * @param amount - The amount to execute
755
+ * @returns Detailed execution result
756
+ */
757
+ async getExecutionPriceDetailed(orderBook, side, amount) {
758
+ await this.initPromise;
759
+ try {
760
+ const body = {
761
+ args: [orderBook, side, amount]
762
+ };
763
+ const credentials = this.getCredentials();
764
+ if (credentials) {
765
+ body.credentials = credentials;
766
+ }
767
+ const url = `${this.config.basePath}/api/${this.exchangeName}/getExecutionPriceDetailed`;
768
+ const response = await fetch(url, {
769
+ method: 'POST',
770
+ headers: {
771
+ 'Content-Type': 'application/json',
772
+ ...this.config.headers
773
+ },
774
+ body: JSON.stringify(body)
775
+ });
776
+ if (!response.ok) {
777
+ const error = await response.json().catch(() => ({}));
778
+ throw new Error(error.error?.message || response.statusText);
779
+ }
780
+ const json = await response.json();
781
+ return this.handleResponse(json);
782
+ }
783
+ catch (error) {
784
+ throw new Error(`Failed to get execution price: ${error}`);
785
+ }
786
+ }
657
787
  }
658
788
  /**
659
789
  * Polymarket exchange client.
@@ -98,6 +98,17 @@ export interface OrderBook {
98
98
  /** Unix timestamp (milliseconds) */
99
99
  timestamp?: number;
100
100
  }
101
+ /**
102
+ * Result of an execution price calculation.
103
+ */
104
+ export interface ExecutionPriceResult {
105
+ /** The volume-weighted average price */
106
+ price: number;
107
+ /** The actual amount that can be filled */
108
+ filledAmount: number;
109
+ /** Whether the full requested amount can be filled */
110
+ fullyFilled: boolean;
111
+ }
101
112
  /**
102
113
  * A historical trade.
103
114
  */
@@ -224,3 +235,34 @@ export interface CreateOrderParams {
224
235
  /** Limit price (required for limit orders, 0.0-1.0) */
225
236
  price?: number;
226
237
  }
238
+ /**
239
+ * A grouped collection of related markets (e.g., "Who will be Fed Chair?" contains multiple candidate markets)
240
+ */
241
+ export interface UnifiedEvent {
242
+ /** Event ID */
243
+ id: string;
244
+ /** Event title */
245
+ title: string;
246
+ /** Event description */
247
+ description: string;
248
+ /** Event slug */
249
+ slug: string;
250
+ /** Related markets in this event */
251
+ markets: UnifiedMarket[];
252
+ /** Event URL */
253
+ url: string;
254
+ /** Event image URL */
255
+ image?: string;
256
+ /** Event category */
257
+ category?: string;
258
+ /** Event tags */
259
+ tags?: string[];
260
+ /**
261
+ * Search for markets within this event by keyword.
262
+ *
263
+ * @param query - Search query (case-insensitive)
264
+ * @param searchIn - Where to search - "title", "description", or "both"
265
+ * @returns List of matching markets
266
+ */
267
+ searchMarkets(query: string, searchIn?: SearchIn): UnifiedMarket[];
268
+ }
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { CancelOrderRequest, CreateOrder200Response, CreateOrderRequest, FetchBalance200Response, FetchMarkets200Response, FetchMarketsRequest, FetchOHLCV200Response, FetchOHLCVRequest, FetchOpenOrders200Response, FetchOpenOrdersRequest, FetchOrderBook200Response, FetchOrderBookRequest, FetchPositions200Response, FetchPositionsRequest, FetchTrades200Response, FetchTradesRequest, GetMarketsBySlugRequest, HealthCheck200Response, SearchEvents200Response, SearchEventsRequest, SearchMarketsRequest, WatchOrderBookRequest, WatchTradesRequest } from '../models/index';
13
+ import type { CancelOrderRequest, CreateOrder200Response, CreateOrderRequest, FetchBalance200Response, FetchMarkets200Response, FetchMarketsRequest, FetchOHLCV200Response, FetchOHLCVRequest, FetchOpenOrders200Response, FetchOpenOrdersRequest, FetchOrderBook200Response, FetchOrderBookRequest, FetchPositions200Response, FetchPositionsRequest, FetchTrades200Response, FetchTradesRequest, GetExecutionPrice200Response, GetExecutionPriceDetailed200Response, GetExecutionPriceRequest, GetMarketsBySlugRequest, HealthCheck200Response, SearchEvents200Response, SearchEventsRequest, SearchMarketsRequest, WatchOrderBookRequest, WatchTradesRequest } from '../models/index';
14
14
  export interface CancelOrderOperationRequest {
15
15
  exchange: CancelOrderOperationExchangeEnum;
16
16
  cancelOrderRequest?: CancelOrderRequest;
@@ -51,6 +51,14 @@ export interface FetchTradesOperationRequest {
51
51
  exchange: FetchTradesOperationExchangeEnum;
52
52
  fetchTradesRequest?: FetchTradesRequest;
53
53
  }
54
+ export interface GetExecutionPriceOperationRequest {
55
+ exchange: GetExecutionPriceOperationExchangeEnum;
56
+ getExecutionPriceRequest?: GetExecutionPriceRequest;
57
+ }
58
+ export interface GetExecutionPriceDetailedRequest {
59
+ exchange: GetExecutionPriceDetailedExchangeEnum;
60
+ getExecutionPriceRequest?: GetExecutionPriceRequest;
61
+ }
54
62
  export interface GetMarketsBySlugOperationRequest {
55
63
  exchange: GetMarketsBySlugOperationExchangeEnum;
56
64
  getMarketsBySlugRequest?: GetMarketsBySlugRequest;
@@ -155,6 +163,22 @@ export declare class DefaultApi extends runtime.BaseAPI {
155
163
  * Fetch Trades
156
164
  */
157
165
  fetchTrades(requestParameters: FetchTradesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FetchTrades200Response>;
166
+ /**
167
+ * Get Execution Price
168
+ */
169
+ getExecutionPriceRaw(requestParameters: GetExecutionPriceOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetExecutionPrice200Response>>;
170
+ /**
171
+ * Get Execution Price
172
+ */
173
+ getExecutionPrice(requestParameters: GetExecutionPriceOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetExecutionPrice200Response>;
174
+ /**
175
+ * Get Detailed Execution Price
176
+ */
177
+ getExecutionPriceDetailedRaw(requestParameters: GetExecutionPriceDetailedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetExecutionPriceDetailed200Response>>;
178
+ /**
179
+ * Get Detailed Execution Price
180
+ */
181
+ getExecutionPriceDetailed(requestParameters: GetExecutionPriceDetailedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetExecutionPriceDetailed200Response>;
158
182
  /**
159
183
  * Get Market by Slug
160
184
  */
@@ -292,6 +316,22 @@ export declare const FetchTradesOperationExchangeEnum: {
292
316
  readonly Kalshi: "kalshi";
293
317
  };
294
318
  export type FetchTradesOperationExchangeEnum = typeof FetchTradesOperationExchangeEnum[keyof typeof FetchTradesOperationExchangeEnum];
319
+ /**
320
+ * @export
321
+ */
322
+ export declare const GetExecutionPriceOperationExchangeEnum: {
323
+ readonly Polymarket: "polymarket";
324
+ readonly Kalshi: "kalshi";
325
+ };
326
+ export type GetExecutionPriceOperationExchangeEnum = typeof GetExecutionPriceOperationExchangeEnum[keyof typeof GetExecutionPriceOperationExchangeEnum];
327
+ /**
328
+ * @export
329
+ */
330
+ export declare const GetExecutionPriceDetailedExchangeEnum: {
331
+ readonly Polymarket: "polymarket";
332
+ readonly Kalshi: "kalshi";
333
+ };
334
+ export type GetExecutionPriceDetailedExchangeEnum = typeof GetExecutionPriceDetailedExchangeEnum[keyof typeof GetExecutionPriceDetailedExchangeEnum];
295
335
  /**
296
336
  * @export
297
337
  */
@@ -46,7 +46,7 @@ var __importStar = (this && this.__importStar) || (function () {
46
46
  };
47
47
  })();
48
48
  Object.defineProperty(exports, "__esModule", { value: true });
49
- exports.WatchTradesOperationExchangeEnum = exports.WatchOrderBookOperationExchangeEnum = exports.SearchMarketsOperationExchangeEnum = exports.SearchEventsOperationExchangeEnum = exports.GetMarketsBySlugOperationExchangeEnum = exports.FetchTradesOperationExchangeEnum = exports.FetchPositionsOperationExchangeEnum = exports.FetchOrderBookOperationExchangeEnum = exports.FetchOrderExchangeEnum = exports.FetchOpenOrdersOperationExchangeEnum = exports.FetchOHLCVOperationExchangeEnum = exports.FetchMarketsOperationExchangeEnum = exports.FetchBalanceExchangeEnum = exports.CreateOrderOperationExchangeEnum = exports.CancelOrderOperationExchangeEnum = exports.DefaultApi = void 0;
49
+ exports.WatchTradesOperationExchangeEnum = exports.WatchOrderBookOperationExchangeEnum = exports.SearchMarketsOperationExchangeEnum = exports.SearchEventsOperationExchangeEnum = exports.GetMarketsBySlugOperationExchangeEnum = exports.GetExecutionPriceDetailedExchangeEnum = exports.GetExecutionPriceOperationExchangeEnum = exports.FetchTradesOperationExchangeEnum = exports.FetchPositionsOperationExchangeEnum = exports.FetchOrderBookOperationExchangeEnum = exports.FetchOrderExchangeEnum = exports.FetchOpenOrdersOperationExchangeEnum = exports.FetchOHLCVOperationExchangeEnum = exports.FetchMarketsOperationExchangeEnum = exports.FetchBalanceExchangeEnum = exports.CreateOrderOperationExchangeEnum = exports.CancelOrderOperationExchangeEnum = exports.DefaultApi = void 0;
50
50
  const runtime = __importStar(require("../runtime"));
51
51
  const index_1 = require("../models/index");
52
52
  /**
@@ -333,6 +333,62 @@ class DefaultApi extends runtime.BaseAPI {
333
333
  const response = await this.fetchTradesRaw(requestParameters, initOverrides);
334
334
  return await response.value();
335
335
  }
336
+ /**
337
+ * Get Execution Price
338
+ */
339
+ async getExecutionPriceRaw(requestParameters, initOverrides) {
340
+ if (requestParameters['exchange'] == null) {
341
+ throw new runtime.RequiredError('exchange', 'Required parameter "exchange" was null or undefined when calling getExecutionPrice().');
342
+ }
343
+ const queryParameters = {};
344
+ const headerParameters = {};
345
+ headerParameters['Content-Type'] = 'application/json';
346
+ let urlPath = `/api/{exchange}/getExecutionPrice`;
347
+ urlPath = urlPath.replace(`{${"exchange"}}`, encodeURIComponent(String(requestParameters['exchange'])));
348
+ const response = await this.request({
349
+ path: urlPath,
350
+ method: 'POST',
351
+ headers: headerParameters,
352
+ query: queryParameters,
353
+ body: (0, index_1.GetExecutionPriceRequestToJSON)(requestParameters['getExecutionPriceRequest']),
354
+ }, initOverrides);
355
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.GetExecutionPrice200ResponseFromJSON)(jsonValue));
356
+ }
357
+ /**
358
+ * Get Execution Price
359
+ */
360
+ async getExecutionPrice(requestParameters, initOverrides) {
361
+ const response = await this.getExecutionPriceRaw(requestParameters, initOverrides);
362
+ return await response.value();
363
+ }
364
+ /**
365
+ * Get Detailed Execution Price
366
+ */
367
+ async getExecutionPriceDetailedRaw(requestParameters, initOverrides) {
368
+ if (requestParameters['exchange'] == null) {
369
+ throw new runtime.RequiredError('exchange', 'Required parameter "exchange" was null or undefined when calling getExecutionPriceDetailed().');
370
+ }
371
+ const queryParameters = {};
372
+ const headerParameters = {};
373
+ headerParameters['Content-Type'] = 'application/json';
374
+ let urlPath = `/api/{exchange}/getExecutionPriceDetailed`;
375
+ urlPath = urlPath.replace(`{${"exchange"}}`, encodeURIComponent(String(requestParameters['exchange'])));
376
+ const response = await this.request({
377
+ path: urlPath,
378
+ method: 'POST',
379
+ headers: headerParameters,
380
+ query: queryParameters,
381
+ body: (0, index_1.GetExecutionPriceRequestToJSON)(requestParameters['getExecutionPriceRequest']),
382
+ }, initOverrides);
383
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.GetExecutionPriceDetailed200ResponseFromJSON)(jsonValue));
384
+ }
385
+ /**
386
+ * Get Detailed Execution Price
387
+ */
388
+ async getExecutionPriceDetailed(requestParameters, initOverrides) {
389
+ const response = await this.getExecutionPriceDetailedRaw(requestParameters, initOverrides);
390
+ return await response.value();
391
+ }
336
392
  /**
337
393
  * Get Market by Slug
338
394
  */
@@ -575,6 +631,20 @@ exports.FetchTradesOperationExchangeEnum = {
575
631
  Polymarket: 'polymarket',
576
632
  Kalshi: 'kalshi'
577
633
  };
634
+ /**
635
+ * @export
636
+ */
637
+ exports.GetExecutionPriceOperationExchangeEnum = {
638
+ Polymarket: 'polymarket',
639
+ Kalshi: 'kalshi'
640
+ };
641
+ /**
642
+ * @export
643
+ */
644
+ exports.GetExecutionPriceDetailedExchangeEnum = {
645
+ Polymarket: 'polymarket',
646
+ Kalshi: 'kalshi'
647
+ };
578
648
  /**
579
649
  * @export
580
650
  */
@@ -0,0 +1,44 @@
1
+ /**
2
+ * PMXT Sidecar API
3
+ * A unified local sidecar API for prediction markets (Polymarket, Kalshi). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
4
+ *
5
+ * The version of the OpenAPI document: 0.4.4
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface ExecutionPriceResult
16
+ */
17
+ export interface ExecutionPriceResult {
18
+ /**
19
+ *
20
+ * @type {number}
21
+ * @memberof ExecutionPriceResult
22
+ */
23
+ price?: number;
24
+ /**
25
+ *
26
+ * @type {number}
27
+ * @memberof ExecutionPriceResult
28
+ */
29
+ filledAmount?: number;
30
+ /**
31
+ *
32
+ * @type {boolean}
33
+ * @memberof ExecutionPriceResult
34
+ */
35
+ fullyFilled?: boolean;
36
+ }
37
+ /**
38
+ * Check if a given object implements the ExecutionPriceResult interface.
39
+ */
40
+ export declare function instanceOfExecutionPriceResult(value: object): value is ExecutionPriceResult;
41
+ export declare function ExecutionPriceResultFromJSON(json: any): ExecutionPriceResult;
42
+ export declare function ExecutionPriceResultFromJSONTyped(json: any, ignoreDiscriminator: boolean): ExecutionPriceResult;
43
+ export declare function ExecutionPriceResultToJSON(json: any): ExecutionPriceResult;
44
+ export declare function ExecutionPriceResultToJSONTyped(value?: ExecutionPriceResult | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * PMXT Sidecar API
6
+ * A unified local sidecar API for prediction markets (Polymarket, Kalshi). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
7
+ *
8
+ * The version of the OpenAPI document: 0.4.4
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfExecutionPriceResult = instanceOfExecutionPriceResult;
17
+ exports.ExecutionPriceResultFromJSON = ExecutionPriceResultFromJSON;
18
+ exports.ExecutionPriceResultFromJSONTyped = ExecutionPriceResultFromJSONTyped;
19
+ exports.ExecutionPriceResultToJSON = ExecutionPriceResultToJSON;
20
+ exports.ExecutionPriceResultToJSONTyped = ExecutionPriceResultToJSONTyped;
21
+ /**
22
+ * Check if a given object implements the ExecutionPriceResult interface.
23
+ */
24
+ function instanceOfExecutionPriceResult(value) {
25
+ return true;
26
+ }
27
+ function ExecutionPriceResultFromJSON(json) {
28
+ return ExecutionPriceResultFromJSONTyped(json, false);
29
+ }
30
+ function ExecutionPriceResultFromJSONTyped(json, ignoreDiscriminator) {
31
+ if (json == null) {
32
+ return json;
33
+ }
34
+ return {
35
+ 'price': json['price'] == null ? undefined : json['price'],
36
+ 'filledAmount': json['filledAmount'] == null ? undefined : json['filledAmount'],
37
+ 'fullyFilled': json['fullyFilled'] == null ? undefined : json['fullyFilled'],
38
+ };
39
+ }
40
+ function ExecutionPriceResultToJSON(json) {
41
+ return ExecutionPriceResultToJSONTyped(json, false);
42
+ }
43
+ function ExecutionPriceResultToJSONTyped(value, ignoreDiscriminator = false) {
44
+ if (value == null) {
45
+ return value;
46
+ }
47
+ return {
48
+ 'price': value['price'],
49
+ 'filledAmount': value['filledAmount'],
50
+ 'fullyFilled': value['fullyFilled'],
51
+ };
52
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * PMXT Sidecar API
3
+ * A unified local sidecar API for prediction markets (Polymarket, Kalshi). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
4
+ *
5
+ * The version of the OpenAPI document: 0.4.4
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import type { ErrorDetail } from './ErrorDetail';
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface GetExecutionPrice200Response
17
+ */
18
+ export interface GetExecutionPrice200Response {
19
+ /**
20
+ *
21
+ * @type {boolean}
22
+ * @memberof GetExecutionPrice200Response
23
+ */
24
+ success?: boolean;
25
+ /**
26
+ *
27
+ * @type {ErrorDetail}
28
+ * @memberof GetExecutionPrice200Response
29
+ */
30
+ error?: ErrorDetail;
31
+ /**
32
+ *
33
+ * @type {number}
34
+ * @memberof GetExecutionPrice200Response
35
+ */
36
+ data?: number;
37
+ }
38
+ /**
39
+ * Check if a given object implements the GetExecutionPrice200Response interface.
40
+ */
41
+ export declare function instanceOfGetExecutionPrice200Response(value: object): value is GetExecutionPrice200Response;
42
+ export declare function GetExecutionPrice200ResponseFromJSON(json: any): GetExecutionPrice200Response;
43
+ export declare function GetExecutionPrice200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetExecutionPrice200Response;
44
+ export declare function GetExecutionPrice200ResponseToJSON(json: any): GetExecutionPrice200Response;
45
+ export declare function GetExecutionPrice200ResponseToJSONTyped(value?: GetExecutionPrice200Response | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * PMXT Sidecar API
6
+ * A unified local sidecar API for prediction markets (Polymarket, Kalshi). This API acts as a JSON-RPC-style gateway. Each endpoint corresponds to a specific method on the generic exchange implementation.
7
+ *
8
+ * The version of the OpenAPI document: 0.4.4
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfGetExecutionPrice200Response = instanceOfGetExecutionPrice200Response;
17
+ exports.GetExecutionPrice200ResponseFromJSON = GetExecutionPrice200ResponseFromJSON;
18
+ exports.GetExecutionPrice200ResponseFromJSONTyped = GetExecutionPrice200ResponseFromJSONTyped;
19
+ exports.GetExecutionPrice200ResponseToJSON = GetExecutionPrice200ResponseToJSON;
20
+ exports.GetExecutionPrice200ResponseToJSONTyped = GetExecutionPrice200ResponseToJSONTyped;
21
+ const ErrorDetail_1 = require("./ErrorDetail");
22
+ /**
23
+ * Check if a given object implements the GetExecutionPrice200Response interface.
24
+ */
25
+ function instanceOfGetExecutionPrice200Response(value) {
26
+ return true;
27
+ }
28
+ function GetExecutionPrice200ResponseFromJSON(json) {
29
+ return GetExecutionPrice200ResponseFromJSONTyped(json, false);
30
+ }
31
+ function GetExecutionPrice200ResponseFromJSONTyped(json, ignoreDiscriminator) {
32
+ if (json == null) {
33
+ return json;
34
+ }
35
+ return {
36
+ 'success': json['success'] == null ? undefined : json['success'],
37
+ 'error': json['error'] == null ? undefined : (0, ErrorDetail_1.ErrorDetailFromJSON)(json['error']),
38
+ 'data': json['data'] == null ? undefined : json['data'],
39
+ };
40
+ }
41
+ function GetExecutionPrice200ResponseToJSON(json) {
42
+ return GetExecutionPrice200ResponseToJSONTyped(json, false);
43
+ }
44
+ function GetExecutionPrice200ResponseToJSONTyped(value, ignoreDiscriminator = false) {
45
+ if (value == null) {
46
+ return value;
47
+ }
48
+ return {
49
+ 'success': value['success'],
50
+ 'error': (0, ErrorDetail_1.ErrorDetailToJSON)(value['error']),
51
+ 'data': value['data'],
52
+ };
53
+ }