pmxtjs 2.38.0 → 2.39.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.
@@ -994,12 +994,12 @@ class DefaultApi extends runtime.BaseAPI {
994
994
  if (requestParameters['exchange'] == null) {
995
995
  throw new runtime.RequiredError('exchange', 'Required parameter "exchange" was null or undefined when calling fetchOHLCV().');
996
996
  }
997
- if (requestParameters['id'] == null) {
998
- throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling fetchOHLCV().');
997
+ if (requestParameters['outcomeId'] == null) {
998
+ throw new runtime.RequiredError('outcomeId', 'Required parameter "outcomeId" was null or undefined when calling fetchOHLCV().');
999
999
  }
1000
1000
  const queryParameters = {};
1001
- if (requestParameters['id'] != null) {
1002
- queryParameters['id'] = requestParameters['id'];
1001
+ if (requestParameters['outcomeId'] != null) {
1002
+ queryParameters['outcomeId'] = requestParameters['outcomeId'];
1003
1003
  }
1004
1004
  if (requestParameters['resolution'] != null) {
1005
1005
  queryParameters['resolution'] = requestParameters['resolution'];
@@ -1105,12 +1105,12 @@ class DefaultApi extends runtime.BaseAPI {
1105
1105
  if (requestParameters['exchange'] == null) {
1106
1106
  throw new runtime.RequiredError('exchange', 'Required parameter "exchange" was null or undefined when calling fetchOrderBook().');
1107
1107
  }
1108
- if (requestParameters['id'] == null) {
1109
- throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling fetchOrderBook().');
1108
+ if (requestParameters['outcomeId'] == null) {
1109
+ throw new runtime.RequiredError('outcomeId', 'Required parameter "outcomeId" was null or undefined when calling fetchOrderBook().');
1110
1110
  }
1111
1111
  const queryParameters = {};
1112
- if (requestParameters['id'] != null) {
1113
- queryParameters['id'] = requestParameters['id'];
1112
+ if (requestParameters['outcomeId'] != null) {
1113
+ queryParameters['outcomeId'] = requestParameters['outcomeId'];
1114
1114
  }
1115
1115
  if (requestParameters['side'] != null) {
1116
1116
  queryParameters['side'] = requestParameters['side'];
@@ -1237,12 +1237,12 @@ class DefaultApi extends runtime.BaseAPI {
1237
1237
  if (requestParameters['exchange'] == null) {
1238
1238
  throw new runtime.RequiredError('exchange', 'Required parameter "exchange" was null or undefined when calling fetchTrades().');
1239
1239
  }
1240
- if (requestParameters['id'] == null) {
1241
- throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling fetchTrades().');
1240
+ if (requestParameters['outcomeId'] == null) {
1241
+ throw new runtime.RequiredError('outcomeId', 'Required parameter "outcomeId" was null or undefined when calling fetchTrades().');
1242
1242
  }
1243
1243
  const queryParameters = {};
1244
- if (requestParameters['id'] != null) {
1245
- queryParameters['id'] = requestParameters['id'];
1244
+ if (requestParameters['outcomeId'] != null) {
1245
+ queryParameters['outcomeId'] = requestParameters['outcomeId'];
1246
1246
  }
1247
1247
  if (requestParameters['start'] != null) {
1248
1248
  queryParameters['start'] = requestParameters['start'].toISOString();
@@ -5,7 +5,7 @@
5
5
  * OpenAPI client, matching the Python API exactly.
6
6
  */
7
7
  import { Configuration, DefaultApi, ExchangeCredentials } from "../generated/src/index.js";
8
- import { Balance, BuiltOrder, CreateOrderParams, EventFilterCriteria, EventFilterFunction, ExecutionPriceResult, MarketFilterCriteria, MarketFilterFunction, MarketOutcome, Order, OrderBook, PaginatedMarketsResult, PaginatedEventsResult, Position, PriceCandle, SubscribedAddressSnapshot, SubscriptionOption, Trade, UnifiedEvent, UnifiedMarket, UserTrade } from "./models.js";
8
+ import { Balance, BuiltOrder, CreateOrderParams, EventFetchParams, EventFilterCriteria, EventFilterFunction, ExecutionPriceResult, MarketFetchParams, MarketFilterCriteria, MarketFilterFunction, MarketOutcome, MyTradesParams, Order, OrderBook, OrderHistoryParams, PaginatedMarketsResult, Position, PriceCandle, SubscribedAddressSnapshot, SubscriptionOption, Trade, UnifiedEvent, UnifiedMarket, UserTrade } from "./models.js";
9
9
  import { ServerManager } from "./server-manager.js";
10
10
  /**
11
11
  * Base exchange client options.
@@ -149,29 +149,32 @@ export declare abstract class Exchange {
149
149
  */
150
150
  protected sidecarReadRequest(methodName: string, query: Record<string, unknown>, args: unknown[]): Promise<any>;
151
151
  loadMarkets(reload?: boolean): Promise<Record<string, UnifiedMarket>>;
152
- fetchMarkets(params?: any): Promise<UnifiedMarket[]>;
152
+ fetchMarkets(params?: MarketFetchParams): Promise<UnifiedMarket[]>;
153
153
  fetchMarketsPaginated(params?: any): Promise<PaginatedMarketsResult>;
154
- fetchEvents(params?: any): Promise<UnifiedEvent[]>;
155
- fetchEventsPaginated(params?: any): Promise<PaginatedEventsResult>;
156
- fetchMarket(params?: any): Promise<UnifiedMarket>;
157
- fetchEvent(params?: any): Promise<UnifiedEvent>;
158
- fetchOrderBook(id: string): Promise<OrderBook>;
154
+ fetchEvents(params?: EventFetchParams): Promise<UnifiedEvent[]>;
155
+ fetchMarket(params?: MarketFetchParams): Promise<UnifiedMarket>;
156
+ fetchEvent(params?: EventFetchParams): Promise<UnifiedEvent>;
157
+ fetchOrderBook(outcomeId: string | MarketOutcome, side?: any): Promise<OrderBook>;
159
158
  submitOrder(built: BuiltOrder): Promise<Order>;
160
159
  cancelOrder(orderId: string): Promise<Order>;
161
160
  fetchOrder(orderId: string): Promise<Order>;
162
161
  fetchOpenOrders(marketId?: string): Promise<Order[]>;
163
- fetchMyTrades(params?: any): Promise<UserTrade[]>;
164
- fetchClosedOrders(params?: any): Promise<Order[]>;
165
- fetchAllOrders(params?: any): Promise<Order[]>;
162
+ fetchMyTrades(params?: MyTradesParams): Promise<UserTrade[]>;
163
+ fetchClosedOrders(params?: OrderHistoryParams): Promise<Order[]>;
164
+ fetchAllOrders(params?: OrderHistoryParams): Promise<Order[]>;
166
165
  fetchPositions(address?: string): Promise<Position[]>;
167
166
  fetchBalance(address?: string): Promise<Balance[]>;
168
- unwatchOrderBook(id: string): Promise<void>;
167
+ unwatchOrderBook(outcomeId: string | MarketOutcome): Promise<void>;
169
168
  unwatchAddress(address: string): Promise<void>;
169
+ testDummyMethod(param?: string): Promise<string>;
170
170
  close(): Promise<void>;
171
- fetchMarketMatches(params: any): Promise<any[]>;
171
+ fetchMarketMatches(params?: any): Promise<any[]>;
172
172
  fetchMatches(params: any): Promise<any[]>;
173
- fetchEventMatches(params: any): Promise<any[]>;
173
+ fetchEventMatches(params?: any): Promise<any[]>;
174
174
  compareMarketPrices(params: any): Promise<any[]>;
175
+ fetchRelatedMarkets(params: any): Promise<any[]>;
176
+ fetchMatchedMarkets(params?: any): Promise<any[]>;
177
+ fetchMatchedPrices(params?: any): Promise<any[]>;
175
178
  fetchHedges(params: any): Promise<any[]>;
176
179
  fetchArbitrage(params?: any): Promise<any[]>;
177
180
  /**
@@ -69,160 +69,52 @@ function queryHasNestedObject(query) {
69
69
  }
70
70
  // Converter functions
71
71
  function convertMarket(raw) {
72
- const outcomes = (raw.outcomes || []).map((o) => ({
73
- outcomeId: o.outcomeId,
74
- marketId: o.marketId,
75
- label: o.label,
76
- price: o.price,
77
- priceChange24h: o.priceChange24h,
78
- metadata: o.metadata,
79
- }));
80
- const convertOutcome = (o) => o ? ({
81
- outcomeId: o.outcomeId,
82
- marketId: o.marketId,
83
- label: o.label,
84
- price: o.price,
85
- priceChange24h: o.priceChange24h,
86
- metadata: o.metadata,
87
- }) : undefined;
88
72
  return {
89
- marketId: raw.marketId,
90
- title: raw.title,
91
- slug: raw.slug,
92
- outcomes,
93
- volume24h: raw.volume24h || 0,
94
- liquidity: raw.liquidity || 0,
95
- url: raw.url,
96
- description: raw.description,
73
+ ...raw,
97
74
  resolutionDate: raw.resolutionDate ? new Date(raw.resolutionDate) : undefined,
98
- volume: raw.volume,
99
- openInterest: raw.openInterest,
100
- image: raw.image,
101
- category: raw.category,
102
- tags: raw.tags,
103
- tickSize: raw.tickSize,
104
- status: raw.status,
105
- contractAddress: raw.contractAddress,
106
- sourceExchange: raw.sourceExchange,
107
- eventId: raw.eventId,
108
- yes: convertOutcome(raw.yes),
109
- no: convertOutcome(raw.no),
110
- up: convertOutcome(raw.up),
111
- down: convertOutcome(raw.down),
75
+ outcomes: (raw.outcomes || []).map((o) => ({ ...o })),
76
+ yes: raw.yes ? { ...raw.yes } : undefined,
77
+ no: raw.no ? { ...raw.no } : undefined,
78
+ up: raw.up ? { ...raw.up } : undefined,
79
+ down: raw.down ? { ...raw.down } : undefined,
112
80
  };
113
81
  }
114
82
  function convertCandle(raw) {
115
- return {
116
- timestamp: raw.timestamp,
117
- open: raw.open,
118
- high: raw.high,
119
- low: raw.low,
120
- close: raw.close,
121
- volume: raw.volume,
122
- };
83
+ return { ...raw };
123
84
  }
124
85
  function convertOrderBook(raw) {
125
- const bids = (raw.bids || []).map((b) => ({
126
- price: b.price,
127
- size: b.size,
128
- }));
129
- const asks = (raw.asks || []).map((a) => ({
130
- price: a.price,
131
- size: a.size,
132
- }));
133
86
  return {
134
- bids,
135
- asks,
136
- timestamp: raw.timestamp,
87
+ ...raw,
88
+ bids: (raw.bids || []).map((b) => ({ ...b })),
89
+ asks: (raw.asks || []).map((a) => ({ ...a })),
137
90
  };
138
91
  }
139
92
  function convertTrade(raw) {
140
- return {
141
- id: raw.id,
142
- timestamp: raw.timestamp,
143
- price: raw.price,
144
- amount: raw.amount,
145
- side: raw.side || "unknown",
146
- };
93
+ return { ...raw, side: raw.side || "unknown" };
147
94
  }
148
95
  function convertOrder(raw) {
149
- return {
150
- id: raw.id,
151
- marketId: raw.marketId,
152
- outcomeId: raw.outcomeId,
153
- side: raw.side,
154
- type: raw.type,
155
- amount: raw.amount,
156
- status: raw.status,
157
- filled: raw.filled,
158
- remaining: raw.remaining,
159
- timestamp: raw.timestamp,
160
- price: raw.price,
161
- fee: raw.fee,
162
- };
96
+ return { ...raw };
163
97
  }
164
98
  function convertPosition(raw) {
165
- return {
166
- marketId: raw.marketId,
167
- outcomeId: raw.outcomeId,
168
- outcomeLabel: raw.outcomeLabel,
169
- size: raw.size,
170
- entryPrice: raw.entryPrice,
171
- currentPrice: raw.currentPrice,
172
- unrealizedPnL: raw.unrealizedPnL,
173
- realizedPnL: raw.realizedPnL,
174
- };
99
+ return { ...raw };
175
100
  }
176
101
  function convertBalance(raw) {
177
- return {
178
- currency: raw.currency,
179
- total: raw.total,
180
- available: raw.available,
181
- locked: raw.locked,
182
- };
102
+ return { ...raw };
183
103
  }
184
104
  function convertUserTrade(raw) {
185
- return {
186
- id: raw.id,
187
- price: raw.price,
188
- amount: raw.amount,
189
- side: raw.side || "unknown",
190
- timestamp: raw.timestamp,
191
- orderId: raw.orderId,
192
- outcomeId: raw.outcomeId,
193
- marketId: raw.marketId,
194
- };
105
+ return { ...raw, side: raw.side || "unknown" };
195
106
  }
196
107
  function convertEvent(raw) {
197
108
  const markets = models_js_1.MarketList.from((raw.markets || []).map(convertMarket));
198
- const event = {
199
- id: raw.id,
200
- title: raw.title,
201
- description: raw.description,
202
- slug: raw.slug,
203
- markets,
204
- volume24h: raw.volume24h,
205
- volume: raw.volume,
206
- url: raw.url,
207
- image: raw.image,
208
- category: raw.category,
209
- tags: raw.tags,
210
- sourceExchange: raw.sourceExchange,
211
- };
212
- return event;
109
+ return { ...raw, markets };
213
110
  }
214
111
  function convertSubscriptionSnapshot(raw) {
215
- const trades = (raw.trades ?? []).map(convertTrade);
216
- const balances = (raw.balances ?? []).map(convertBalance);
217
- const positions = (raw.positions ?? []).map(convertPosition);
218
- const snapShot = {
219
- address: raw.address,
220
- trades,
221
- balances,
222
- positions,
223
- timestamp: raw.timestamp,
112
+ return {
113
+ ...raw,
114
+ trades: (raw.trades ?? []).map(convertTrade),
115
+ balances: (raw.balances ?? []).map(convertBalance),
116
+ positions: (raw.positions ?? []).map(convertPosition),
224
117
  };
225
- return snapShot;
226
118
  }
227
119
  /**
228
120
  * Base class for prediction market exchanges.
@@ -671,38 +563,6 @@ class Exchange {
671
563
  throw new errors_js_1.PmxtError(`Failed to fetchEvents: ${error}`);
672
564
  }
673
565
  }
674
- async fetchEventsPaginated(params) {
675
- await this.initPromise;
676
- try {
677
- const args = [];
678
- if (params !== undefined)
679
- args.push(params);
680
- const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchEventsPaginated`, {
681
- method: 'POST',
682
- headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
683
- body: JSON.stringify({ args, credentials: this.getCredentials() }),
684
- });
685
- if (!response.ok) {
686
- const body = await response.json().catch(() => ({}));
687
- if (body.error && typeof body.error === "object") {
688
- throw (0, errors_js_1.fromServerError)(body.error);
689
- }
690
- throw new errors_js_1.PmxtError(body.error?.message || response.statusText);
691
- }
692
- const json = await response.json();
693
- const data = this.handleResponse(json);
694
- return {
695
- data: (data.data || []).map(convertEvent),
696
- total: data.total,
697
- nextCursor: data.nextCursor,
698
- };
699
- }
700
- catch (error) {
701
- if (error instanceof errors_js_1.PmxtError)
702
- throw error;
703
- throw new errors_js_1.PmxtError(`Failed to fetchEventsPaginated: ${error}`);
704
- }
705
- }
706
566
  async fetchMarket(params) {
707
567
  await this.initPromise;
708
568
  try {
@@ -759,11 +619,13 @@ class Exchange {
759
619
  throw new errors_js_1.PmxtError(`Failed to fetchEvent: ${error}`);
760
620
  }
761
621
  }
762
- async fetchOrderBook(id) {
622
+ async fetchOrderBook(outcomeId, side) {
763
623
  await this.initPromise;
764
624
  try {
765
625
  const args = [];
766
- args.push(id);
626
+ args.push(resolveOutcomeId(outcomeId));
627
+ if (side !== undefined)
628
+ args.push(side);
767
629
  const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchOrderBook`, {
768
630
  method: 'POST',
769
631
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -787,11 +649,6 @@ class Exchange {
787
649
  }
788
650
  }
789
651
  async submitOrder(built) {
790
- if (this.isHosted) {
791
- throw new errors_js_1.PmxtError("Trade execution is not available through the hosted API. " +
792
- "Use the local PMXT SDK with your venue credentials instead. " +
793
- "See https://pmxt.dev/docs/quickstart for setup instructions.");
794
- }
795
652
  await this.initPromise;
796
653
  try {
797
654
  const args = [];
@@ -819,11 +676,6 @@ class Exchange {
819
676
  }
820
677
  }
821
678
  async cancelOrder(orderId) {
822
- if (this.isHosted) {
823
- throw new errors_js_1.PmxtError("Trade execution is not available through the hosted API. " +
824
- "Use the local PMXT SDK with your venue credentials instead. " +
825
- "See https://pmxt.dev/docs/quickstart for setup instructions.");
826
- }
827
679
  await this.initPromise;
828
680
  try {
829
681
  const args = [];
@@ -1045,11 +897,11 @@ class Exchange {
1045
897
  throw new errors_js_1.PmxtError(`Failed to fetchBalance: ${error}`);
1046
898
  }
1047
899
  }
1048
- async unwatchOrderBook(id) {
900
+ async unwatchOrderBook(outcomeId) {
1049
901
  await this.initPromise;
1050
902
  try {
1051
903
  const args = [];
1052
- args.push(id);
904
+ args.push(resolveOutcomeId(outcomeId));
1053
905
  const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/unwatchOrderBook`, {
1054
906
  method: 'POST',
1055
907
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -1097,6 +949,33 @@ class Exchange {
1097
949
  throw new errors_js_1.PmxtError(`Failed to unwatchAddress: ${error}`);
1098
950
  }
1099
951
  }
952
+ async testDummyMethod(param) {
953
+ await this.initPromise;
954
+ try {
955
+ const args = [];
956
+ if (param !== undefined)
957
+ args.push(param);
958
+ const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/testDummyMethod`, {
959
+ method: 'POST',
960
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
961
+ body: JSON.stringify({ args, credentials: this.getCredentials() }),
962
+ });
963
+ if (!response.ok) {
964
+ const body = await response.json().catch(() => ({}));
965
+ if (body.error && typeof body.error === "object") {
966
+ throw (0, errors_js_1.fromServerError)(body.error);
967
+ }
968
+ throw new errors_js_1.PmxtError(body.error?.message || response.statusText);
969
+ }
970
+ const json = await response.json();
971
+ return this.handleResponse(json);
972
+ }
973
+ catch (error) {
974
+ if (error instanceof errors_js_1.PmxtError)
975
+ throw error;
976
+ throw new errors_js_1.PmxtError(`Failed to testDummyMethod: ${error}`);
977
+ }
978
+ }
1100
979
  async close() {
1101
980
  await this.initPromise;
1102
981
  try {
@@ -1126,7 +1005,8 @@ class Exchange {
1126
1005
  await this.initPromise;
1127
1006
  try {
1128
1007
  const args = [];
1129
- args.push(params);
1008
+ if (params !== undefined)
1009
+ args.push(params);
1130
1010
  const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchMarketMatches`, {
1131
1011
  method: 'POST',
1132
1012
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -1178,7 +1058,8 @@ class Exchange {
1178
1058
  await this.initPromise;
1179
1059
  try {
1180
1060
  const args = [];
1181
- args.push(params);
1061
+ if (params !== undefined)
1062
+ args.push(params);
1182
1063
  const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchEventMatches`, {
1183
1064
  method: 'POST',
1184
1065
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -1226,6 +1107,86 @@ class Exchange {
1226
1107
  throw new errors_js_1.PmxtError(`Failed to compareMarketPrices: ${error}`);
1227
1108
  }
1228
1109
  }
1110
+ async fetchRelatedMarkets(params) {
1111
+ await this.initPromise;
1112
+ try {
1113
+ const args = [];
1114
+ args.push(params);
1115
+ const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchRelatedMarkets`, {
1116
+ method: 'POST',
1117
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
1118
+ body: JSON.stringify({ args, credentials: this.getCredentials() }),
1119
+ });
1120
+ if (!response.ok) {
1121
+ const body = await response.json().catch(() => ({}));
1122
+ if (body.error && typeof body.error === "object") {
1123
+ throw (0, errors_js_1.fromServerError)(body.error);
1124
+ }
1125
+ throw new errors_js_1.PmxtError(body.error?.message || response.statusText);
1126
+ }
1127
+ const json = await response.json();
1128
+ return this.handleResponse(json);
1129
+ }
1130
+ catch (error) {
1131
+ if (error instanceof errors_js_1.PmxtError)
1132
+ throw error;
1133
+ throw new errors_js_1.PmxtError(`Failed to fetchRelatedMarkets: ${error}`);
1134
+ }
1135
+ }
1136
+ async fetchMatchedMarkets(params) {
1137
+ await this.initPromise;
1138
+ try {
1139
+ const args = [];
1140
+ if (params !== undefined)
1141
+ args.push(params);
1142
+ const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchMatchedMarkets`, {
1143
+ method: 'POST',
1144
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
1145
+ body: JSON.stringify({ args, credentials: this.getCredentials() }),
1146
+ });
1147
+ if (!response.ok) {
1148
+ const body = await response.json().catch(() => ({}));
1149
+ if (body.error && typeof body.error === "object") {
1150
+ throw (0, errors_js_1.fromServerError)(body.error);
1151
+ }
1152
+ throw new errors_js_1.PmxtError(body.error?.message || response.statusText);
1153
+ }
1154
+ const json = await response.json();
1155
+ return this.handleResponse(json);
1156
+ }
1157
+ catch (error) {
1158
+ if (error instanceof errors_js_1.PmxtError)
1159
+ throw error;
1160
+ throw new errors_js_1.PmxtError(`Failed to fetchMatchedMarkets: ${error}`);
1161
+ }
1162
+ }
1163
+ async fetchMatchedPrices(params) {
1164
+ await this.initPromise;
1165
+ try {
1166
+ const args = [];
1167
+ if (params !== undefined)
1168
+ args.push(params);
1169
+ const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchMatchedPrices`, {
1170
+ method: 'POST',
1171
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
1172
+ body: JSON.stringify({ args, credentials: this.getCredentials() }),
1173
+ });
1174
+ if (!response.ok) {
1175
+ const body = await response.json().catch(() => ({}));
1176
+ if (body.error && typeof body.error === "object") {
1177
+ throw (0, errors_js_1.fromServerError)(body.error);
1178
+ }
1179
+ throw new errors_js_1.PmxtError(body.error?.message || response.statusText);
1180
+ }
1181
+ const json = await response.json();
1182
+ return this.handleResponse(json);
1183
+ }
1184
+ catch (error) {
1185
+ if (error instanceof errors_js_1.PmxtError)
1186
+ throw error;
1187
+ throw new errors_js_1.PmxtError(`Failed to fetchMatchedPrices: ${error}`);
1188
+ }
1189
+ }
1229
1190
  async fetchHedges(params) {
1230
1191
  await this.initPromise;
1231
1192
  try {
@@ -266,8 +266,24 @@ export interface MarketFilterParams {
266
266
  offset?: number;
267
267
  /** Sort order */
268
268
  sort?: SortOption;
269
+ /** Filter by market status (default: 'active') */
270
+ status?: 'active' | 'inactive' | 'closed' | 'all';
269
271
  /** Where to search (for filterMarkets) */
270
272
  searchIn?: SearchIn;
273
+ /** Keyword search query */
274
+ query?: string;
275
+ /** Slug/ticker lookup */
276
+ slug?: string;
277
+ /** Direct lookup by market ID */
278
+ marketId?: string;
279
+ /** Reverse lookup -- find market containing this outcome */
280
+ outcomeId?: string;
281
+ /** Find markets belonging to an event */
282
+ eventId?: string;
283
+ /** Pagination page (used by Limitless) */
284
+ page?: number;
285
+ /** Semantic search threshold (used by Limitless) */
286
+ similarityThreshold?: number;
271
287
  /** Filter by market category (e.g. "sports", "politics", "crypto") */
272
288
  category?: string;
273
289
  /** Filter by tags attached to the market */
@@ -334,6 +350,64 @@ export interface CreateOrderParams {
334
350
  /** Optional fee rate (e.g., 1000 for 0.1%) */
335
351
  fee?: number;
336
352
  }
353
+ /** Alias matching the core MarketFetchParams name. */
354
+ export type MarketFetchParams = MarketFilterParams;
355
+ /**
356
+ * Parameters for fetching OHLCV candle data.
357
+ */
358
+ export interface OHLCVParams {
359
+ /** Candle resolution (e.g. '1m', '5m', '1h', '1d') */
360
+ resolution: CandleInterval;
361
+ /** Start of the time range */
362
+ start?: Date;
363
+ /** End of the time range */
364
+ end?: Date;
365
+ /** Maximum number of candles */
366
+ limit?: number;
367
+ }
368
+ /**
369
+ * Parameters for fetching public trades.
370
+ */
371
+ export interface TradesParams {
372
+ /** Start of the time range */
373
+ start?: Date;
374
+ /** End of the time range */
375
+ end?: Date;
376
+ /** Maximum number of results */
377
+ limit?: number;
378
+ }
379
+ /**
380
+ * Parameters for fetching the authenticated user's trade history.
381
+ */
382
+ export interface MyTradesParams {
383
+ /** Filter by outcome ID */
384
+ outcomeId?: string;
385
+ /** Filter by market ID */
386
+ marketId?: string;
387
+ /** Only return records after this date */
388
+ since?: Date;
389
+ /** Only return records before this date */
390
+ until?: Date;
391
+ /** Maximum number of results */
392
+ limit?: number;
393
+ /** Cursor for pagination */
394
+ cursor?: string;
395
+ }
396
+ /**
397
+ * Parameters for fetching closed/all order history.
398
+ */
399
+ export interface OrderHistoryParams {
400
+ /** Filter by market ID */
401
+ marketId?: string;
402
+ /** Only return records after this date */
403
+ since?: Date;
404
+ /** Only return records before this date */
405
+ until?: Date;
406
+ /** Maximum number of results */
407
+ limit?: number;
408
+ /** Cursor for pagination */
409
+ cursor?: string;
410
+ }
337
411
  /**
338
412
  * An order payload built but not yet submitted to the exchange.
339
413
  */