pmxtjs 2.46.14 → 2.48.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 (55) hide show
  1. package/dist/esm/generated/src/apis/DefaultApi.d.ts +38 -1
  2. package/dist/esm/generated/src/apis/DefaultApi.js +56 -1
  3. package/dist/esm/generated/src/models/EventFetchParams.d.ts +6 -0
  4. package/dist/esm/generated/src/models/EventFetchParams.js +2 -0
  5. package/dist/esm/generated/src/models/FetchSeries200Response.d.ts +46 -0
  6. package/dist/esm/generated/src/models/FetchSeries200Response.js +47 -0
  7. package/dist/esm/generated/src/models/UnifiedEvent.d.ts +8 -0
  8. package/dist/esm/generated/src/models/UnifiedEvent.js +2 -0
  9. package/dist/esm/generated/src/models/UnifiedMarket.d.ts +8 -0
  10. package/dist/esm/generated/src/models/UnifiedMarket.js +2 -0
  11. package/dist/esm/generated/src/models/UnifiedSeries.d.ts +95 -0
  12. package/dist/esm/generated/src/models/UnifiedSeries.js +66 -0
  13. package/dist/esm/generated/src/models/index.d.ts +2 -0
  14. package/dist/esm/generated/src/models/index.js +2 -0
  15. package/dist/esm/index.d.ts +1 -0
  16. package/dist/esm/pmxt/client.d.ts +2 -1
  17. package/dist/esm/pmxt/client.js +47 -18
  18. package/dist/esm/pmxt/models.d.ts +47 -0
  19. package/dist/generated/src/apis/DefaultApi.d.ts +38 -1
  20. package/dist/generated/src/apis/DefaultApi.js +56 -1
  21. package/dist/generated/src/models/EventFetchParams.d.ts +6 -0
  22. package/dist/generated/src/models/EventFetchParams.js +2 -0
  23. package/dist/generated/src/models/FetchSeries200Response.d.ts +46 -0
  24. package/dist/generated/src/models/FetchSeries200Response.js +54 -0
  25. package/dist/generated/src/models/UnifiedEvent.d.ts +8 -0
  26. package/dist/generated/src/models/UnifiedEvent.js +2 -0
  27. package/dist/generated/src/models/UnifiedMarket.d.ts +8 -0
  28. package/dist/generated/src/models/UnifiedMarket.js +2 -0
  29. package/dist/generated/src/models/UnifiedSeries.d.ts +95 -0
  30. package/dist/generated/src/models/UnifiedSeries.js +73 -0
  31. package/dist/generated/src/models/index.d.ts +2 -0
  32. package/dist/generated/src/models/index.js +2 -0
  33. package/dist/index.d.ts +1 -0
  34. package/dist/pmxt/client.d.ts +2 -1
  35. package/dist/pmxt/client.js +47 -18
  36. package/dist/pmxt/models.d.ts +47 -0
  37. package/generated/.openapi-generator/FILES +4 -0
  38. package/generated/docs/DefaultApi.md +76 -2
  39. package/generated/docs/EventFetchParams.md +2 -0
  40. package/generated/docs/FetchSeries200Response.md +38 -0
  41. package/generated/docs/UnifiedEvent.md +2 -0
  42. package/generated/docs/UnifiedMarket.md +2 -0
  43. package/generated/docs/UnifiedSeries.md +55 -0
  44. package/generated/package.json +1 -1
  45. package/generated/src/apis/DefaultApi.ts +78 -0
  46. package/generated/src/models/EventFetchParams.ts +8 -0
  47. package/generated/src/models/FetchSeries200Response.ts +96 -0
  48. package/generated/src/models/UnifiedEvent.ts +8 -0
  49. package/generated/src/models/UnifiedMarket.ts +8 -0
  50. package/generated/src/models/UnifiedSeries.ts +155 -0
  51. package/generated/src/models/index.ts +2 -0
  52. package/index.ts +1 -0
  53. package/package.json +2 -2
  54. package/pmxt/client.ts +47 -23
  55. package/pmxt/models.ts +59 -0
@@ -43,6 +43,7 @@ import type {
43
43
  FetchOrderBooks200Response,
44
44
  FetchOrderBooksRequest,
45
45
  FetchPositions200Response,
46
+ FetchSeries200Response,
46
47
  FetchTrades200Response,
47
48
  FilterEventsRequest,
48
49
  FilterMarketsRequest,
@@ -115,6 +116,8 @@ import {
115
116
  FetchOrderBooksRequestToJSON,
116
117
  FetchPositions200ResponseFromJSON,
117
118
  FetchPositions200ResponseToJSON,
119
+ FetchSeries200ResponseFromJSON,
120
+ FetchSeries200ResponseToJSON,
118
121
  FetchTrades200ResponseFromJSON,
119
122
  FetchTrades200ResponseToJSON,
120
123
  FilterEventsRequestFromJSON,
@@ -212,6 +215,7 @@ export interface FetchEventRequest {
212
215
  searchIn?: FetchEventSearchInEnum;
213
216
  eventId?: string;
214
217
  slug?: string;
218
+ series?: string;
215
219
  filter?: EventFilterCriteria;
216
220
  category?: string;
217
221
  tags?: Array<string>;
@@ -241,6 +245,7 @@ export interface FetchEventsRequest {
241
245
  searchIn?: FetchEventsSearchInEnum;
242
246
  eventId?: string;
243
247
  slug?: string;
248
+ series?: string;
244
249
  filter?: EventFilterCriteria;
245
250
  category?: string;
246
251
  tags?: Array<string>;
@@ -405,6 +410,10 @@ export interface FetchRelatedMarketsRequest {
405
410
  sort?: FetchRelatedMarketsSortEnum;
406
411
  }
407
412
 
413
+ export interface FetchSeriesRequest {
414
+ exchange: FetchSeriesExchangeEnum;
415
+ }
416
+
408
417
  export interface FetchTradesRequest {
409
418
  exchange: FetchTradesExchangeEnum;
410
419
  outcomeId: string;
@@ -920,6 +929,10 @@ export class DefaultApi extends runtime.BaseAPI {
920
929
  queryParameters['slug'] = requestParameters['slug'];
921
930
  }
922
931
 
932
+ if (requestParameters['series'] != null) {
933
+ queryParameters['series'] = requestParameters['series'];
934
+ }
935
+
923
936
  if (requestParameters['filter'] != null) {
924
937
  queryParameters['filter'] = requestParameters['filter'];
925
938
  }
@@ -1082,6 +1095,10 @@ export class DefaultApi extends runtime.BaseAPI {
1082
1095
  queryParameters['slug'] = requestParameters['slug'];
1083
1096
  }
1084
1097
 
1098
+ if (requestParameters['series'] != null) {
1099
+ queryParameters['series'] = requestParameters['series'];
1100
+ }
1101
+
1085
1102
  if (requestParameters['filter'] != null) {
1086
1103
  queryParameters['filter'] = requestParameters['filter'];
1087
1104
  }
@@ -2141,6 +2158,45 @@ export class DefaultApi extends runtime.BaseAPI {
2141
2158
  return await response.value();
2142
2159
  }
2143
2160
 
2161
+ /**
2162
+ * Fetch the recurring series (fourth tier above Event -> Market -> Outcome) that this venue exposes. Returns an empty array on venues without a series concept (Limitless, Smarkets, Probable, Metaculus, Baozi, Hyperliquid, SuiBets, Polymarket US). - `params.id` -> a single matching series with its events populated where supported. - no params -> the full list, typically without nested events for payload size.
2163
+ * Fetch Series
2164
+ */
2165
+ async fetchSeriesRaw(requestParameters: FetchSeriesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FetchSeries200Response>> {
2166
+ if (requestParameters['exchange'] == null) {
2167
+ throw new runtime.RequiredError(
2168
+ 'exchange',
2169
+ 'Required parameter "exchange" was null or undefined when calling fetchSeries().'
2170
+ );
2171
+ }
2172
+
2173
+ const queryParameters: any = {};
2174
+
2175
+ const headerParameters: runtime.HTTPHeaders = {};
2176
+
2177
+
2178
+ let urlPath = `/api/{exchange}/fetchSeries`;
2179
+ urlPath = urlPath.replace(`{${"exchange"}}`, encodeURIComponent(String(requestParameters['exchange'])));
2180
+
2181
+ const response = await this.request({
2182
+ path: urlPath,
2183
+ method: 'GET',
2184
+ headers: headerParameters,
2185
+ query: queryParameters,
2186
+ }, initOverrides);
2187
+
2188
+ return new runtime.JSONApiResponse(response, (jsonValue) => FetchSeries200ResponseFromJSON(jsonValue));
2189
+ }
2190
+
2191
+ /**
2192
+ * Fetch the recurring series (fourth tier above Event -> Market -> Outcome) that this venue exposes. Returns an empty array on venues without a series concept (Limitless, Smarkets, Probable, Metaculus, Baozi, Hyperliquid, SuiBets, Polymarket US). - `params.id` -> a single matching series with its events populated where supported. - no params -> the full list, typically without nested events for payload size.
2193
+ * Fetch Series
2194
+ */
2195
+ async fetchSeries(requestParameters: FetchSeriesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FetchSeries200Response> {
2196
+ const response = await this.fetchSeriesRaw(requestParameters, initOverrides);
2197
+ return await response.value();
2198
+ }
2199
+
2144
2200
  /**
2145
2201
  * Fetch raw trade history for a specific outcome.
2146
2202
  * Fetch Trades
@@ -3213,6 +3269,28 @@ export const FetchRelatedMarketsSortEnum = {
3213
3269
  PriceDifference: 'priceDifference'
3214
3270
  } as const;
3215
3271
  export type FetchRelatedMarketsSortEnum = typeof FetchRelatedMarketsSortEnum[keyof typeof FetchRelatedMarketsSortEnum];
3272
+ /**
3273
+ * @export
3274
+ */
3275
+ export const FetchSeriesExchangeEnum = {
3276
+ Polymarket: 'polymarket',
3277
+ Kalshi: 'kalshi',
3278
+ KalshiDemo: 'kalshi-demo',
3279
+ Limitless: 'limitless',
3280
+ Probable: 'probable',
3281
+ Baozi: 'baozi',
3282
+ Myriad: 'myriad',
3283
+ Opinion: 'opinion',
3284
+ Metaculus: 'metaculus',
3285
+ Smarkets: 'smarkets',
3286
+ PolymarketUs: 'polymarket_us',
3287
+ GeminiTitan: 'gemini-titan',
3288
+ Hyperliquid: 'hyperliquid',
3289
+ Suibets: 'suibets',
3290
+ Mock: 'mock',
3291
+ Router: 'router'
3292
+ } as const;
3293
+ export type FetchSeriesExchangeEnum = typeof FetchSeriesExchangeEnum[keyof typeof FetchSeriesExchangeEnum];
3216
3294
  /**
3217
3295
  * @export
3218
3296
  */
@@ -81,6 +81,12 @@ export interface EventFetchParams {
81
81
  * @memberof EventFetchParams
82
82
  */
83
83
  slug?: string;
84
+ /**
85
+ * Filter events by their parent series. Accepts the venue-native series id / ticker / slug (e.g. Kalshi `"KXATPMATCH"`, Polymarket `"wta"`). Passed through to the vendor where supported, otherwise applied to `sourceMetadata` after fetch.
86
+ * @type {string}
87
+ * @memberof EventFetchParams
88
+ */
89
+ series?: string;
84
90
  /**
85
91
  * Optional client-side filter applied after fetching
86
92
  * @type {EventFilterCriteria}
@@ -160,6 +166,7 @@ export function EventFetchParamsFromJSONTyped(json: any, ignoreDiscriminator: bo
160
166
  'searchIn': json['searchIn'] == null ? undefined : json['searchIn'],
161
167
  'eventId': json['eventId'] == null ? undefined : json['eventId'],
162
168
  'slug': json['slug'] == null ? undefined : json['slug'],
169
+ 'series': json['series'] == null ? undefined : json['series'],
163
170
  'filter': json['filter'] == null ? undefined : EventFilterCriteriaFromJSON(json['filter']),
164
171
  'category': json['category'] == null ? undefined : json['category'],
165
172
  'tags': json['tags'] == null ? undefined : json['tags'],
@@ -186,6 +193,7 @@ export function EventFetchParamsToJSONTyped(value?: EventFetchParams | null, ign
186
193
  'searchIn': value['searchIn'],
187
194
  'eventId': value['eventId'],
188
195
  'slug': value['slug'],
196
+ 'series': value['series'],
189
197
  'filter': EventFilterCriteriaToJSON(value['filter']),
190
198
  'category': value['category'],
191
199
  'tags': value['tags'],
@@ -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, Limitless). 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 { UnifiedSeries } from './UnifiedSeries';
24
+ import {
25
+ UnifiedSeriesFromJSON,
26
+ UnifiedSeriesFromJSONTyped,
27
+ UnifiedSeriesToJSON,
28
+ UnifiedSeriesToJSONTyped,
29
+ } from './UnifiedSeries';
30
+
31
+ /**
32
+ *
33
+ * @export
34
+ * @interface FetchSeries200Response
35
+ */
36
+ export interface FetchSeries200Response {
37
+ /**
38
+ *
39
+ * @type {boolean}
40
+ * @memberof FetchSeries200Response
41
+ */
42
+ success?: boolean;
43
+ /**
44
+ *
45
+ * @type {ErrorDetail}
46
+ * @memberof FetchSeries200Response
47
+ */
48
+ error?: ErrorDetail;
49
+ /**
50
+ *
51
+ * @type {Array<UnifiedSeries>}
52
+ * @memberof FetchSeries200Response
53
+ */
54
+ data?: Array<UnifiedSeries>;
55
+ }
56
+
57
+ /**
58
+ * Check if a given object implements the FetchSeries200Response interface.
59
+ */
60
+ export function instanceOfFetchSeries200Response(value: object): value is FetchSeries200Response {
61
+ return true;
62
+ }
63
+
64
+ export function FetchSeries200ResponseFromJSON(json: any): FetchSeries200Response {
65
+ return FetchSeries200ResponseFromJSONTyped(json, false);
66
+ }
67
+
68
+ export function FetchSeries200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FetchSeries200Response {
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 : ((json['data'] as Array<any>).map(UnifiedSeriesFromJSON)),
77
+ };
78
+ }
79
+
80
+ export function FetchSeries200ResponseToJSON(json: any): FetchSeries200Response {
81
+ return FetchSeries200ResponseToJSONTyped(json, false);
82
+ }
83
+
84
+ export function FetchSeries200ResponseToJSONTyped(value?: FetchSeries200Response | 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': value['data'] == null ? undefined : ((value['data'] as Array<any>).map(UnifiedSeriesToJSON)),
94
+ };
95
+ }
96
+
@@ -93,6 +93,12 @@ export interface UnifiedEvent {
93
93
  * @memberof UnifiedEvent
94
94
  */
95
95
  tags?: Array<string>;
96
+ /**
97
+ * Raw venue-specific metadata not captured by first-class fields (e.g. Kalshi series_ticker / series_title, Polymarket series). Passed through verbatim so downstream consumers can recover anything the unified shape omits. Each venue populates what it has.
98
+ * @type {{ [key: string]: any; }}
99
+ * @memberof UnifiedEvent
100
+ */
101
+ sourceMetadata?: { [key: string]: any; };
96
102
  /**
97
103
  * The exchange/venue this event originates from (e.g. 'polymarket', 'kalshi'). Populated by the Router.
98
104
  * @type {string}
@@ -136,6 +142,7 @@ export function UnifiedEventFromJSONTyped(json: any, ignoreDiscriminator: boolea
136
142
  'image': json['image'] == null ? undefined : json['image'],
137
143
  'category': json['category'] == null ? undefined : json['category'],
138
144
  'tags': json['tags'] == null ? undefined : json['tags'],
145
+ 'sourceMetadata': json['sourceMetadata'] == null ? undefined : json['sourceMetadata'],
139
146
  'sourceExchange': json['sourceExchange'] == null ? undefined : json['sourceExchange'],
140
147
  };
141
148
  }
@@ -162,6 +169,7 @@ export function UnifiedEventToJSONTyped(value?: UnifiedEvent | null, ignoreDiscr
162
169
  'image': value['image'],
163
170
  'category': value['category'],
164
171
  'tags': value['tags'],
172
+ 'sourceMetadata': value['sourceMetadata'],
165
173
  'sourceExchange': value['sourceExchange'],
166
174
  };
167
175
  }
@@ -135,6 +135,12 @@ export interface UnifiedMarket {
135
135
  * @memberof UnifiedMarket
136
136
  */
137
137
  contractAddress?: string;
138
+ /**
139
+ * Raw venue-specific metadata not captured by first-class fields (e.g. Kalshi series_ticker / series_title from the parent event, Polymarket series). Passed through verbatim so downstream consumers can recover anything the unified shape omits. Each venue populates what it has.
140
+ * @type {{ [key: string]: any; }}
141
+ * @memberof UnifiedMarket
142
+ */
143
+ sourceMetadata?: { [key: string]: any; };
138
144
  /**
139
145
  * The exchange/venue this market originates from (e.g. 'polymarket', 'kalshi'). Populated by the Router.
140
146
  * @type {string}
@@ -210,6 +216,7 @@ export function UnifiedMarketFromJSONTyped(json: any, ignoreDiscriminator: boole
210
216
  'tickSize': json['tickSize'] == null ? undefined : json['tickSize'],
211
217
  'status': json['status'] == null ? undefined : json['status'],
212
218
  'contractAddress': json['contractAddress'] == null ? undefined : json['contractAddress'],
219
+ 'sourceMetadata': json['sourceMetadata'] == null ? undefined : json['sourceMetadata'],
213
220
  'sourceExchange': json['sourceExchange'] == null ? undefined : json['sourceExchange'],
214
221
  'yes': json['yes'] == null ? undefined : MarketOutcomeFromJSON(json['yes']),
215
222
  'no': json['no'] == null ? undefined : MarketOutcomeFromJSON(json['no']),
@@ -247,6 +254,7 @@ export function UnifiedMarketToJSONTyped(value?: UnifiedMarket | null, ignoreDis
247
254
  'tickSize': value['tickSize'],
248
255
  'status': value['status'],
249
256
  'contractAddress': value['contractAddress'],
257
+ 'sourceMetadata': value['sourceMetadata'],
250
258
  'sourceExchange': value['sourceExchange'],
251
259
  'yes': MarketOutcomeToJSON(value['yes']),
252
260
  'no': MarketOutcomeToJSON(value['no']),
@@ -0,0 +1,155 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * PMXT Sidecar API
5
+ * A unified local sidecar API for prediction markets (Polymarket, Kalshi, Limitless). 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 { UnifiedEvent } from './UnifiedEvent';
17
+ import {
18
+ UnifiedEventFromJSON,
19
+ UnifiedEventFromJSONTyped,
20
+ UnifiedEventToJSON,
21
+ UnifiedEventToJSONTyped,
22
+ } from './UnifiedEvent';
23
+
24
+ /**
25
+ * A recurring grouping of events on a venue — the fourth tier above Event -> Market -> Outcome. Examples: Kalshi `KXATPMATCH` (every ATP tennis match), Polymarket `wta` (every WTA match), Opinion's daily `collection`. Series only exists where the venue exposes a recurring-event concept; venues without one return an empty array from `fetchSeries`.
26
+ * @export
27
+ * @interface UnifiedSeries
28
+ */
29
+ export interface UnifiedSeries {
30
+ /**
31
+ * Stable venue-native series identifier (e.g. "KXATPMATCH" on Kalshi, "atp" on Polymarket Gamma, numeric Gamma id).
32
+ * @type {string}
33
+ * @memberof UnifiedSeries
34
+ */
35
+ id: string;
36
+ /**
37
+ * Venue-native ticker, when distinct from `id`.
38
+ * @type {string}
39
+ * @memberof UnifiedSeries
40
+ */
41
+ ticker?: string;
42
+ /**
43
+ * Venue-native slug.
44
+ * @type {string}
45
+ * @memberof UnifiedSeries
46
+ */
47
+ slug?: string;
48
+ /**
49
+ * Human-readable series title (e.g. "ATP Match Winner", "WTA").
50
+ * @type {string}
51
+ * @memberof UnifiedSeries
52
+ */
53
+ title: string;
54
+ /**
55
+ *
56
+ * @type {string}
57
+ * @memberof UnifiedSeries
58
+ */
59
+ description?: string | null;
60
+ /**
61
+ *
62
+ * @type {string}
63
+ * @memberof UnifiedSeries
64
+ */
65
+ recurrence?: string | null;
66
+ /**
67
+ * Child events. Populated when fetched by id; the list form usually omits this to keep payloads small.
68
+ * @type {Array<UnifiedEvent>}
69
+ * @memberof UnifiedSeries
70
+ */
71
+ events?: Array<UnifiedEvent>;
72
+ /**
73
+ *
74
+ * @type {string}
75
+ * @memberof UnifiedSeries
76
+ */
77
+ url?: string | null;
78
+ /**
79
+ *
80
+ * @type {string}
81
+ * @memberof UnifiedSeries
82
+ */
83
+ image?: string | null;
84
+ /**
85
+ * The exchange this series originates from. Populated by the Router.
86
+ * @type {string}
87
+ * @memberof UnifiedSeries
88
+ */
89
+ sourceExchange?: string;
90
+ /**
91
+ * Raw venue-specific fields not promoted to first-class columns.
92
+ * @type {{ [key: string]: any; }}
93
+ * @memberof UnifiedSeries
94
+ */
95
+ sourceMetadata?: { [key: string]: any; };
96
+ }
97
+
98
+ /**
99
+ * Check if a given object implements the UnifiedSeries interface.
100
+ */
101
+ export function instanceOfUnifiedSeries(value: object): value is UnifiedSeries {
102
+ if (!('id' in value) || value['id'] === undefined) return false;
103
+ if (!('title' in value) || value['title'] === undefined) return false;
104
+ return true;
105
+ }
106
+
107
+ export function UnifiedSeriesFromJSON(json: any): UnifiedSeries {
108
+ return UnifiedSeriesFromJSONTyped(json, false);
109
+ }
110
+
111
+ export function UnifiedSeriesFromJSONTyped(json: any, ignoreDiscriminator: boolean): UnifiedSeries {
112
+ if (json == null) {
113
+ return json;
114
+ }
115
+ return {
116
+
117
+ 'id': json['id'],
118
+ 'ticker': json['ticker'] == null ? undefined : json['ticker'],
119
+ 'slug': json['slug'] == null ? undefined : json['slug'],
120
+ 'title': json['title'],
121
+ 'description': json['description'] == null ? undefined : json['description'],
122
+ 'recurrence': json['recurrence'] == null ? undefined : json['recurrence'],
123
+ 'events': json['events'] == null ? undefined : ((json['events'] as Array<any>).map(UnifiedEventFromJSON)),
124
+ 'url': json['url'] == null ? undefined : json['url'],
125
+ 'image': json['image'] == null ? undefined : json['image'],
126
+ 'sourceExchange': json['sourceExchange'] == null ? undefined : json['sourceExchange'],
127
+ 'sourceMetadata': json['sourceMetadata'] == null ? undefined : json['sourceMetadata'],
128
+ };
129
+ }
130
+
131
+ export function UnifiedSeriesToJSON(json: any): UnifiedSeries {
132
+ return UnifiedSeriesToJSONTyped(json, false);
133
+ }
134
+
135
+ export function UnifiedSeriesToJSONTyped(value?: UnifiedSeries | null, ignoreDiscriminator: boolean = false): any {
136
+ if (value == null) {
137
+ return value;
138
+ }
139
+
140
+ return {
141
+
142
+ 'id': value['id'],
143
+ 'ticker': value['ticker'],
144
+ 'slug': value['slug'],
145
+ 'title': value['title'],
146
+ 'description': value['description'],
147
+ 'recurrence': value['recurrence'],
148
+ 'events': value['events'] == null ? undefined : ((value['events'] as Array<any>).map(UnifiedEventToJSON)),
149
+ 'url': value['url'],
150
+ 'image': value['image'],
151
+ 'sourceExchange': value['sourceExchange'],
152
+ 'sourceMetadata': value['sourceMetadata'],
153
+ };
154
+ }
155
+
@@ -60,6 +60,7 @@ export * from './FetchOrderBookParams';
60
60
  export * from './FetchOrderBooks200Response';
61
61
  export * from './FetchOrderBooksRequest';
62
62
  export * from './FetchPositions200Response';
63
+ export * from './FetchSeries200Response';
63
64
  export * from './FetchTrades200Response';
64
65
  export * from './FilterEventsRequest';
65
66
  export * from './FilterEventsRequestArgsInner';
@@ -101,4 +102,5 @@ export * from './Trade';
101
102
  export * from './TradesParams';
102
103
  export * from './UnifiedEvent';
103
104
  export * from './UnifiedMarket';
105
+ export * from './UnifiedSeries';
104
106
  export * from './UserTrade';
package/index.ts CHANGED
@@ -30,6 +30,7 @@ export { Router } from "./pmxt/router.js";
30
30
  export { ServerManager } from "./pmxt/server-manager.js";
31
31
  export { HOSTED_URL, LOCAL_URL, ENV, resolvePmxtBaseUrl } from "./pmxt/constants.js";
32
32
  export { MarketList } from "./pmxt/models.js";
33
+ export type { UnifiedSeries } from "./pmxt/models.js";
33
34
  export type * from "./pmxt/models.js";
34
35
  export * from "./pmxt/errors.js";
35
36
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxtjs",
3
- "version": "2.46.14",
3
+ "version": "2.48.0",
4
4
  "description": "Unified prediction market data API - The ccxt for prediction markets",
5
5
  "author": "PMXT Contributors",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  "unified"
44
44
  ],
45
45
  "dependencies": {
46
- "pmxt-core": "2.46.14",
46
+ "pmxt-core": "2.48.0",
47
47
  "ws": "^8.18.0"
48
48
  },
49
49
  "devDependencies": {
package/pmxt/client.ts CHANGED
@@ -36,12 +36,14 @@ import {
36
36
  PaginatedMarketsResult,
37
37
  PaginatedEventsResult,
38
38
  Position,
39
+ SeriesFetchParams,
39
40
  PriceCandle,
40
41
  SubscribedAddressSnapshot,
41
42
  SubscriptionOption,
42
43
  Trade,
43
44
  UnifiedEvent,
44
45
  UnifiedMarket,
46
+ UnifiedSeries,
45
47
  UserTrade,
46
48
  FirehoseEvent,
47
49
  } from "./models.js";
@@ -172,6 +174,10 @@ function convertEvent(raw: any): UnifiedEvent {
172
174
  return { ...raw, markets };
173
175
  }
174
176
 
177
+ function convertSeries(raw: any): UnifiedSeries {
178
+ const events = Array.isArray(raw.events) ? raw.events.map(convertEvent) : undefined;
179
+ return { ...raw, ...(events !== undefined ? { events } : {}) };
180
+ }
175
181
 
176
182
  function convertSubscriptionSnapshot(raw: any): SubscribedAddressSnapshot {
177
183
  return {
@@ -863,6 +869,32 @@ export abstract class Exchange {
863
869
  }
864
870
  }
865
871
 
872
+ async fetchSeries(params?: SeriesFetchParams): Promise<UnifiedSeries[]> {
873
+ await this.initPromise;
874
+ try {
875
+ const args: any[] = [];
876
+ if (params !== undefined) args.push(params);
877
+ const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchSeries`, {
878
+ method: 'POST',
879
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
880
+ body: JSON.stringify({ args, credentials: this.getCredentials() }),
881
+ });
882
+ if (!response.ok) {
883
+ const body = await response.json().catch(() => ({}));
884
+ if (body.error && typeof body.error === "object") {
885
+ throw fromServerError(body.error);
886
+ }
887
+ throw new PmxtError(body.error?.message || response.statusText);
888
+ }
889
+ const json = await response.json();
890
+ const data = this.handleResponse(json);
891
+ return data.map(convertSeries);
892
+ } catch (error) {
893
+ if (error instanceof PmxtError) throw error;
894
+ throw new PmxtError(`Failed to fetchSeries: ${error}`);
895
+ }
896
+ }
897
+
866
898
  async fetchMarket(params?: MarketFetchParams): Promise<UnifiedMarket> {
867
899
  await this.initPromise;
868
900
  try {
@@ -1215,32 +1247,24 @@ export abstract class Exchange {
1215
1247
 
1216
1248
  async unwatchOrderBook(outcomeId: string | MarketOutcome): Promise<void> {
1217
1249
  await this.initPromise;
1218
- const resolvedOutcomeId = resolveOutcomeId(outcomeId);
1219
- const args: any[] = [resolvedOutcomeId];
1220
1250
  try {
1221
- const ws = await this.getOrCreateWs();
1222
- if (!ws) {
1223
- throw this.wsTransportUnavailableError("unwatchOrderBook");
1251
+ const args: any[] = [];
1252
+ args.push(resolveOutcomeId(outcomeId));
1253
+ const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/unwatchOrderBook`, {
1254
+ method: 'POST',
1255
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
1256
+ body: JSON.stringify({ args, credentials: this.getCredentials() }),
1257
+ });
1258
+ if (!response.ok) {
1259
+ const body = await response.json().catch(() => ({}));
1260
+ if (body.error && typeof body.error === "object") {
1261
+ throw fromServerError(body.error);
1262
+ }
1263
+ throw new PmxtError(body.error?.message || response.statusText);
1224
1264
  }
1225
-
1226
- const requestId = this.getWsSubscriptionId(ws, "watchOrderBook", args)
1227
- ?? `req-${Math.random().toString(36).slice(2, 14)}`;
1228
-
1229
- await this.sendWsMessage(
1230
- ws,
1231
- {
1232
- id: requestId,
1233
- action: "unsubscribe",
1234
- exchange: this.exchangeName,
1235
- method: "unwatchOrderBook",
1236
- args,
1237
- },
1238
- );
1239
- this.clearWsSubscription(ws, "watchOrderBook", args);
1265
+ const json = await response.json();
1266
+ this.handleResponse(json);
1240
1267
  } catch (error) {
1241
- if (this.isWsTransportUnavailableError(error)) {
1242
- throw this.wsTransportUnavailableError("unwatchOrderBook");
1243
- }
1244
1268
  if (error instanceof PmxtError) throw error;
1245
1269
  throw new PmxtError(`Failed to unwatchOrderBook: ${error}`);
1246
1270
  }