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
@@ -0,0 +1,96 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * PMXT Sidecar API
5
+ * 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.
6
+ *
7
+ * The version of the OpenAPI document: 0.4.4
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ import type { ErrorDetail } from './ErrorDetail';
17
+ import {
18
+ ErrorDetailFromJSON,
19
+ ErrorDetailFromJSONTyped,
20
+ ErrorDetailToJSON,
21
+ ErrorDetailToJSONTyped,
22
+ } from './ErrorDetail';
23
+ import type { ExecutionPriceResult } from './ExecutionPriceResult';
24
+ import {
25
+ ExecutionPriceResultFromJSON,
26
+ ExecutionPriceResultFromJSONTyped,
27
+ ExecutionPriceResultToJSON,
28
+ ExecutionPriceResultToJSONTyped,
29
+ } from './ExecutionPriceResult';
30
+
31
+ /**
32
+ *
33
+ * @export
34
+ * @interface GetExecutionPriceDetailed200Response
35
+ */
36
+ export interface GetExecutionPriceDetailed200Response {
37
+ /**
38
+ *
39
+ * @type {boolean}
40
+ * @memberof GetExecutionPriceDetailed200Response
41
+ */
42
+ success?: boolean;
43
+ /**
44
+ *
45
+ * @type {ErrorDetail}
46
+ * @memberof GetExecutionPriceDetailed200Response
47
+ */
48
+ error?: ErrorDetail;
49
+ /**
50
+ *
51
+ * @type {ExecutionPriceResult}
52
+ * @memberof GetExecutionPriceDetailed200Response
53
+ */
54
+ data?: ExecutionPriceResult;
55
+ }
56
+
57
+ /**
58
+ * Check if a given object implements the GetExecutionPriceDetailed200Response interface.
59
+ */
60
+ export function instanceOfGetExecutionPriceDetailed200Response(value: object): value is GetExecutionPriceDetailed200Response {
61
+ return true;
62
+ }
63
+
64
+ export function GetExecutionPriceDetailed200ResponseFromJSON(json: any): GetExecutionPriceDetailed200Response {
65
+ return GetExecutionPriceDetailed200ResponseFromJSONTyped(json, false);
66
+ }
67
+
68
+ export function GetExecutionPriceDetailed200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetExecutionPriceDetailed200Response {
69
+ if (json == null) {
70
+ return json;
71
+ }
72
+ return {
73
+
74
+ 'success': json['success'] == null ? undefined : json['success'],
75
+ 'error': json['error'] == null ? undefined : ErrorDetailFromJSON(json['error']),
76
+ 'data': json['data'] == null ? undefined : ExecutionPriceResultFromJSON(json['data']),
77
+ };
78
+ }
79
+
80
+ export function GetExecutionPriceDetailed200ResponseToJSON(json: any): GetExecutionPriceDetailed200Response {
81
+ return GetExecutionPriceDetailed200ResponseToJSONTyped(json, false);
82
+ }
83
+
84
+ export function GetExecutionPriceDetailed200ResponseToJSONTyped(value?: GetExecutionPriceDetailed200Response | null, ignoreDiscriminator: boolean = false): any {
85
+ if (value == null) {
86
+ return value;
87
+ }
88
+
89
+ return {
90
+
91
+ 'success': value['success'],
92
+ 'error': ErrorDetailToJSON(value['error']),
93
+ 'data': ExecutionPriceResultToJSON(value['data']),
94
+ };
95
+ }
96
+
@@ -0,0 +1,89 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * PMXT Sidecar API
5
+ * 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.
6
+ *
7
+ * The version of the OpenAPI document: 0.4.4
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ import type { GetExecutionPriceRequestArgsInner } from './GetExecutionPriceRequestArgsInner';
17
+ import {
18
+ GetExecutionPriceRequestArgsInnerFromJSON,
19
+ GetExecutionPriceRequestArgsInnerFromJSONTyped,
20
+ GetExecutionPriceRequestArgsInnerToJSON,
21
+ GetExecutionPriceRequestArgsInnerToJSONTyped,
22
+ } from './GetExecutionPriceRequestArgsInner';
23
+ import type { ExchangeCredentials } from './ExchangeCredentials';
24
+ import {
25
+ ExchangeCredentialsFromJSON,
26
+ ExchangeCredentialsFromJSONTyped,
27
+ ExchangeCredentialsToJSON,
28
+ ExchangeCredentialsToJSONTyped,
29
+ } from './ExchangeCredentials';
30
+
31
+ /**
32
+ *
33
+ * @export
34
+ * @interface GetExecutionPriceRequest
35
+ */
36
+ export interface GetExecutionPriceRequest {
37
+ /**
38
+ * [orderBook, side, amount]
39
+ * @type {Array<GetExecutionPriceRequestArgsInner>}
40
+ * @memberof GetExecutionPriceRequest
41
+ */
42
+ args: Array<GetExecutionPriceRequestArgsInner>;
43
+ /**
44
+ *
45
+ * @type {ExchangeCredentials}
46
+ * @memberof GetExecutionPriceRequest
47
+ */
48
+ credentials?: ExchangeCredentials;
49
+ }
50
+
51
+ /**
52
+ * Check if a given object implements the GetExecutionPriceRequest interface.
53
+ */
54
+ export function instanceOfGetExecutionPriceRequest(value: object): value is GetExecutionPriceRequest {
55
+ if (!('args' in value) || value['args'] === undefined) return false;
56
+ return true;
57
+ }
58
+
59
+ export function GetExecutionPriceRequestFromJSON(json: any): GetExecutionPriceRequest {
60
+ return GetExecutionPriceRequestFromJSONTyped(json, false);
61
+ }
62
+
63
+ export function GetExecutionPriceRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetExecutionPriceRequest {
64
+ if (json == null) {
65
+ return json;
66
+ }
67
+ return {
68
+
69
+ 'args': ((json['args'] as Array<any>).map(GetExecutionPriceRequestArgsInnerFromJSON)),
70
+ 'credentials': json['credentials'] == null ? undefined : ExchangeCredentialsFromJSON(json['credentials']),
71
+ };
72
+ }
73
+
74
+ export function GetExecutionPriceRequestToJSON(json: any): GetExecutionPriceRequest {
75
+ return GetExecutionPriceRequestToJSONTyped(json, false);
76
+ }
77
+
78
+ export function GetExecutionPriceRequestToJSONTyped(value?: GetExecutionPriceRequest | null, ignoreDiscriminator: boolean = false): any {
79
+ if (value == null) {
80
+ return value;
81
+ }
82
+
83
+ return {
84
+
85
+ 'args': ((value['args'] as Array<any>).map(GetExecutionPriceRequestArgsInnerToJSON)),
86
+ 'credentials': ExchangeCredentialsToJSON(value['credentials']),
87
+ };
88
+ }
89
+
@@ -0,0 +1,75 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * PMXT Sidecar API
5
+ * 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.
6
+ *
7
+ * The version of the OpenAPI document: 0.4.4
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import type { OrderBook } from './OrderBook';
16
+ import {
17
+ instanceOfOrderBook,
18
+ OrderBookFromJSON,
19
+ OrderBookFromJSONTyped,
20
+ OrderBookToJSON,
21
+ } from './OrderBook';
22
+
23
+ /**
24
+ * @type GetExecutionPriceRequestArgsInner
25
+ *
26
+ * @export
27
+ */
28
+ export type GetExecutionPriceRequestArgsInner = OrderBook | number | string;
29
+
30
+ export function GetExecutionPriceRequestArgsInnerFromJSON(json: any): GetExecutionPriceRequestArgsInner {
31
+ return GetExecutionPriceRequestArgsInnerFromJSONTyped(json, false);
32
+ }
33
+
34
+ export function GetExecutionPriceRequestArgsInnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetExecutionPriceRequestArgsInner {
35
+ if (json == null) {
36
+ return json;
37
+ }
38
+ if (typeof json !== 'object') {
39
+ return json;
40
+ }
41
+ if (instanceOfOrderBook(json)) {
42
+ return OrderBookFromJSONTyped(json, true);
43
+ }
44
+ if (typeof json === 'number') {
45
+ return json;
46
+ }
47
+ if (typeof json === 'string' && (json === 'buy' || json === 'sell')) {
48
+ return json;
49
+ }
50
+ return {} as any;
51
+ }
52
+
53
+ export function GetExecutionPriceRequestArgsInnerToJSON(json: any): any {
54
+ return GetExecutionPriceRequestArgsInnerToJSONTyped(json, false);
55
+ }
56
+
57
+ export function GetExecutionPriceRequestArgsInnerToJSONTyped(value?: GetExecutionPriceRequestArgsInner | null, ignoreDiscriminator: boolean = false): any {
58
+ if (value == null) {
59
+ return value;
60
+ }
61
+ if (typeof value !== 'object') {
62
+ return value;
63
+ }
64
+ if (instanceOfOrderBook(value)) {
65
+ return OrderBookToJSON(value as OrderBook);
66
+ }
67
+ if (typeof value === 'number') {
68
+ return value;
69
+ }
70
+ if (typeof value === 'string' && (value === 'buy' || value === 'sell')) {
71
+ return value;
72
+ }
73
+ return {};
74
+ }
75
+
@@ -10,6 +10,7 @@ export * from './CreateOrderRequest';
10
10
  export * from './ErrorDetail';
11
11
  export * from './ErrorResponse';
12
12
  export * from './ExchangeCredentials';
13
+ export * from './ExecutionPriceResult';
13
14
  export * from './FetchBalance200Response';
14
15
  export * from './FetchMarkets200Response';
15
16
  export * from './FetchMarketsRequest';
@@ -24,6 +25,10 @@ export * from './FetchPositions200Response';
24
25
  export * from './FetchPositionsRequest';
25
26
  export * from './FetchTrades200Response';
26
27
  export * from './FetchTradesRequest';
28
+ export * from './GetExecutionPrice200Response';
29
+ export * from './GetExecutionPriceDetailed200Response';
30
+ export * from './GetExecutionPriceRequest';
31
+ export * from './GetExecutionPriceRequestArgsInner';
27
32
  export * from './GetMarketsBySlugRequest';
28
33
  export * from './HealthCheck200Response';
29
34
  export * from './HistoryFilterParams';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxtjs",
3
- "version": "1.3.3",
3
+ "version": "1.4.0",
4
4
  "description": "Unified prediction market data API - The ccxt for prediction markets",
5
5
  "author": "PMXT Contributors",
6
6
  "repository": {
@@ -42,7 +42,7 @@
42
42
  "unified"
43
43
  ],
44
44
  "dependencies": {
45
- "pmxt-core": "1.3.3"
45
+ "pmxt-core": "1.4.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/jest": "^30.0.0",
package/pmxt/client.ts CHANGED
@@ -34,6 +34,9 @@ import {
34
34
  MarketFilterParams,
35
35
  HistoryFilterParams,
36
36
  CreateOrderParams,
37
+ SearchIn,
38
+ UnifiedEvent,
39
+ ExecutionPriceResult,
37
40
  } from "./models.js";
38
41
 
39
42
  import { ServerManager } from "./server-manager.js";
@@ -156,6 +159,39 @@ function convertBalance(raw: any): Balance {
156
159
  };
157
160
  }
158
161
 
162
+ function convertEvent(raw: any): UnifiedEvent {
163
+ const markets = (raw.markets || []).map(convertMarket);
164
+
165
+ return {
166
+ id: raw.id,
167
+ title: raw.title,
168
+ description: raw.description,
169
+ slug: raw.slug,
170
+ markets,
171
+ url: raw.url,
172
+ image: raw.image,
173
+ category: raw.category,
174
+ tags: raw.tags,
175
+ searchMarkets(query: string, searchIn: SearchIn = "both"): UnifiedMarket[] {
176
+ const queryLower = query.toLowerCase();
177
+ return this.markets.filter(market => {
178
+ let match = false;
179
+ if (searchIn === "title" || searchIn === "both") {
180
+ if (market.title.toLowerCase().includes(queryLower)) {
181
+ match = true;
182
+ }
183
+ }
184
+ if (searchIn === "description" || searchIn === "both") {
185
+ if (market.description?.toLowerCase().includes(queryLower)) {
186
+ match = true;
187
+ }
188
+ }
189
+ return match;
190
+ });
191
+ }
192
+ };
193
+ }
194
+
159
195
  /**
160
196
  * Base exchange client options.
161
197
  */
@@ -184,6 +220,7 @@ export abstract class Exchange {
184
220
  protected apiKey?: string;
185
221
  protected privateKey?: string;
186
222
  protected api: DefaultApi;
223
+ protected config: Configuration;
187
224
  protected serverManager: ServerManager;
188
225
  protected initPromise: Promise<void>;
189
226
 
@@ -199,8 +236,8 @@ export abstract class Exchange {
199
236
  this.serverManager = new ServerManager({ baseUrl });
200
237
 
201
238
  // Configure the API client with the initial base URL (will be updated if port changes)
202
- const config = new Configuration({ basePath: baseUrl });
203
- this.api = new DefaultApi(config);
239
+ this.config = new Configuration({ basePath: baseUrl });
240
+ this.api = new DefaultApi(this.config);
204
241
 
205
242
  // Initialize the server connection asynchronously
206
243
  this.initPromise = this.initializeServer(autoStartServer);
@@ -223,11 +260,11 @@ export abstract class Exchange {
223
260
  }
224
261
 
225
262
  // Update API client with actual base URL
226
- const newConfig = new Configuration({
263
+ this.config = new Configuration({
227
264
  basePath: newBaseUrl,
228
265
  headers
229
266
  });
230
- this.api = new DefaultApi(newConfig);
267
+ this.api = new DefaultApi(this.config);
231
268
  } catch (error) {
232
269
  throw new Error(
233
270
  `Failed to start PMXT server: ${error}\n\n` +
@@ -334,6 +371,60 @@ export abstract class Exchange {
334
371
  }
335
372
  }
336
373
 
374
+ /**
375
+ * Search events (groups of related markets) by keyword.
376
+ *
377
+ * @param query - Search query
378
+ * @param params - Optional filter parameters
379
+ * @returns List of matching events
380
+ *
381
+ * @example
382
+ * ```typescript
383
+ * const events = await exchange.searchEvents("Trump");
384
+ * ```
385
+ */
386
+ async searchEvents(
387
+ query: string,
388
+ params?: MarketFilterParams
389
+ ): Promise<UnifiedEvent[]> {
390
+ await this.initPromise;
391
+ try {
392
+ const args: any[] = [query];
393
+ if (params) {
394
+ args.push(params);
395
+ }
396
+
397
+ const body: any = { args };
398
+ const credentials = this.getCredentials();
399
+ if (credentials) {
400
+ body.credentials = credentials;
401
+ }
402
+
403
+ // Manual implementation since generated client is missing this
404
+ const url = `${this.config.basePath}/api/${this.exchangeName}/searchEvents`;
405
+
406
+ const response = await fetch(url, {
407
+ method: 'POST',
408
+ headers: {
409
+ 'Content-Type': 'application/json',
410
+ ...this.config.headers
411
+ },
412
+ body: JSON.stringify(body)
413
+ });
414
+
415
+ if (!response.ok) {
416
+ const error = await response.json().catch(() => ({}));
417
+ throw new Error(error.error?.message || response.statusText);
418
+ }
419
+
420
+ const json = await response.json();
421
+ const data = this.handleResponse(json);
422
+ return data.map(convertEvent);
423
+ } catch (error) {
424
+ throw new Error(`Failed to search events: ${error}`);
425
+ }
426
+ }
427
+
337
428
  /**
338
429
  * Fetch markets by URL slug/ticker.
339
430
  *
@@ -780,6 +871,67 @@ export abstract class Exchange {
780
871
  throw new Error(`Failed to fetch balance: ${error}`);
781
872
  }
782
873
  }
874
+
875
+ /**
876
+ * Calculate the average execution price for a given amount by walking the order book.
877
+ * Uses the sidecar server for calculation to ensure consistency.
878
+ *
879
+ * @param orderBook - The current order book
880
+ * @param side - 'buy' or 'sell'
881
+ * @param amount - The amount to execute
882
+ * @returns The volume-weighted average price, or 0 if insufficient liquidity
883
+ */
884
+ async getExecutionPrice(orderBook: OrderBook, side: 'buy' | 'sell', amount: number): Promise<number> {
885
+ const result = await this.getExecutionPriceDetailed(orderBook, side, amount);
886
+ return result.fullyFilled ? result.price : 0;
887
+ }
888
+
889
+ /**
890
+ * Calculate detailed execution price information.
891
+ * Uses the sidecar server for calculation to ensure consistency.
892
+ *
893
+ * @param orderBook - The current order book
894
+ * @param side - 'buy' or 'sell'
895
+ * @param amount - The amount to execute
896
+ * @returns Detailed execution result
897
+ */
898
+ async getExecutionPriceDetailed(
899
+ orderBook: OrderBook,
900
+ side: 'buy' | 'sell',
901
+ amount: number
902
+ ): Promise<ExecutionPriceResult> {
903
+ await this.initPromise;
904
+ try {
905
+ const body: any = {
906
+ args: [orderBook, side, amount]
907
+ };
908
+ const credentials = this.getCredentials();
909
+ if (credentials) {
910
+ body.credentials = credentials;
911
+ }
912
+
913
+ const url = `${this.config.basePath}/api/${this.exchangeName}/getExecutionPriceDetailed`;
914
+
915
+ const response = await fetch(url, {
916
+ method: 'POST',
917
+ headers: {
918
+ 'Content-Type': 'application/json',
919
+ ...this.config.headers
920
+ },
921
+ body: JSON.stringify(body)
922
+ });
923
+
924
+ if (!response.ok) {
925
+ const error = await response.json().catch(() => ({}));
926
+ throw new Error(error.error?.message || response.statusText);
927
+ }
928
+
929
+ const json = await response.json();
930
+ return this.handleResponse(json);
931
+ } catch (error) {
932
+ throw new Error(`Failed to get execution price: ${error}`);
933
+ }
934
+ }
783
935
  }
784
936
 
785
937
  /**
package/pmxt/models.ts CHANGED
@@ -132,6 +132,20 @@ export interface OrderBook {
132
132
  timestamp?: number;
133
133
  }
134
134
 
135
+ /**
136
+ * Result of an execution price calculation.
137
+ */
138
+ export interface ExecutionPriceResult {
139
+ /** The volume-weighted average price */
140
+ price: number;
141
+
142
+ /** The actual amount that can be filled */
143
+ filledAmount: number;
144
+
145
+ /** Whether the full requested amount can be filled */
146
+ fullyFilled: boolean;
147
+ }
148
+
135
149
  /**
136
150
  * A historical trade.
137
151
  */
@@ -302,3 +316,43 @@ export interface CreateOrderParams {
302
316
  /** Limit price (required for limit orders, 0.0-1.0) */
303
317
  price?: number;
304
318
  }
319
+ /**
320
+ * A grouped collection of related markets (e.g., "Who will be Fed Chair?" contains multiple candidate markets)
321
+ */
322
+ export interface UnifiedEvent {
323
+ /** Event ID */
324
+ id: string;
325
+
326
+ /** Event title */
327
+ title: string;
328
+
329
+ /** Event description */
330
+ description: string;
331
+
332
+ /** Event slug */
333
+ slug: string;
334
+
335
+ /** Related markets in this event */
336
+ markets: UnifiedMarket[];
337
+
338
+ /** Event URL */
339
+ url: string;
340
+
341
+ /** Event image URL */
342
+ image?: string;
343
+
344
+ /** Event category */
345
+ category?: string;
346
+
347
+ /** Event tags */
348
+ tags?: string[];
349
+
350
+ /**
351
+ * Search for markets within this event by keyword.
352
+ *
353
+ * @param query - Search query (case-insensitive)
354
+ * @param searchIn - Where to search - "title", "description", or "both"
355
+ * @returns List of matching markets
356
+ */
357
+ searchMarkets(query: string, searchIn?: SearchIn): UnifiedMarket[];
358
+ }