pmxtjs 2.50.16 → 2.51.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.
@@ -57,6 +57,18 @@ export interface UserTrade {
57
57
  * @memberof UserTrade
58
58
  */
59
59
  orderId?: string;
60
+ /**
61
+ * The market this trade belongs to, when the venue exposes it (e.g. derivable from the fill's coin/asset).
62
+ * @type {string}
63
+ * @memberof UserTrade
64
+ */
65
+ marketId?: string;
66
+ /**
67
+ * Trading fee paid by the user for this fill, when the venue exposes it.
68
+ * @type {number}
69
+ * @memberof UserTrade
70
+ */
71
+ fee?: number;
60
72
  /**
61
73
  * Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
62
74
  * @type {string}
@@ -50,6 +50,8 @@ export function UserTradeFromJSONTyped(json, ignoreDiscriminator) {
50
50
  'side': json['side'],
51
51
  'outcomeId': json['outcomeId'] == null ? undefined : json['outcomeId'],
52
52
  'orderId': json['orderId'] == null ? undefined : json['orderId'],
53
+ 'marketId': json['marketId'] == null ? undefined : json['marketId'],
54
+ 'fee': json['fee'] == null ? undefined : json['fee'],
53
55
  'txHash': json['txHash'] == null ? undefined : json['txHash'],
54
56
  'chain': json['chain'] == null ? undefined : json['chain'],
55
57
  'blockNumber': json['blockNumber'] == null ? undefined : json['blockNumber'],
@@ -70,6 +72,8 @@ export function UserTradeToJSONTyped(value, ignoreDiscriminator = false) {
70
72
  'side': value['side'],
71
73
  'outcomeId': value['outcomeId'],
72
74
  'orderId': value['orderId'],
75
+ 'marketId': value['marketId'],
76
+ 'fee': value['fee'],
73
77
  'txHash': value['txHash'],
74
78
  'chain': value['chain'],
75
79
  'blockNumber': value['blockNumber'],
@@ -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, EventFetchParams, EventFilterCriteria, EventFilterFunction, ExecutionPriceResult, FetchOrderBookParams, MarketFetchParams, MarketFilterCriteria, MarketFilterFunction, MarketOutcome, MyTradesParams, Order, OrderBook, OrderHistoryParams, PaginatedMarketsResult, Position, SeriesFetchParams, PriceCandle, SubscribedAddressSnapshot, SubscriptionOption, Trade, UnifiedEvent, UnifiedMarket, UnifiedSeries, UserTrade, FirehoseEvent, FetchMatchedMarketClustersParams } from "./models.js";
8
+ import { Balance, BuiltOrder, CreateOrderParams, EventFetchParams, EventFilterCriteria, EventFilterFunction, ExecutionPriceResult, FetchOrderBookParams, MarketFetchParams, MarketFilterCriteria, MarketFilterFunction, MarketOutcome, MyTradesParams, Order, OrderBook, OrderHistoryParams, PaginatedMarketsResult, PaginatedEventsResult, Position, SeriesFetchParams, PriceCandle, SubscribedAddressSnapshot, SubscriptionOption, Trade, UnifiedEvent, UnifiedMarket, UnifiedSeries, UserTrade, FirehoseEvent, FetchMatchedMarketClustersParams } from "./models.js";
9
9
  import { ServerManager } from "./server-manager.js";
10
10
  import type { Signer } from "./signers.js";
11
11
  import { Escrow } from "./escrow.js";
@@ -212,6 +212,7 @@ export declare abstract class Exchange {
212
212
  loadMarkets(reload?: boolean): Promise<Record<string, UnifiedMarket>>;
213
213
  fetchMarkets(params?: MarketFetchParams): Promise<UnifiedMarket[]>;
214
214
  fetchMarketsPaginated(params?: any): Promise<PaginatedMarketsResult>;
215
+ fetchEventsPaginated(params?: any): Promise<PaginatedEventsResult>;
215
216
  fetchEvents(params?: EventFetchParams): Promise<UnifiedEvent[]>;
216
217
  fetchSeries(params?: SeriesFetchParams): Promise<UnifiedSeries[]>;
217
218
  fetchMarket(params?: MarketFetchParams): Promise<UnifiedMarket>;
@@ -740,6 +740,38 @@ export class Exchange {
740
740
  throw new PmxtError(`Failed to fetchMarketsPaginated: ${error}`);
741
741
  }
742
742
  }
743
+ async fetchEventsPaginated(params) {
744
+ await this.initPromise;
745
+ try {
746
+ const args = [];
747
+ if (params !== undefined)
748
+ args.push(params);
749
+ const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchEventsPaginated`, {
750
+ method: 'POST',
751
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
752
+ body: JSON.stringify({ args, credentials: this.getCredentials() }),
753
+ });
754
+ if (!response.ok) {
755
+ const body = await response.json().catch(() => ({}));
756
+ if (body.error && typeof body.error === "object") {
757
+ throw fromServerError(body.error);
758
+ }
759
+ throw new PmxtError(body.error?.message || response.statusText);
760
+ }
761
+ const json = await response.json();
762
+ const data = this.handleResponse(json);
763
+ return {
764
+ data: (data.data || []).map(convertEvent),
765
+ total: data.total,
766
+ nextCursor: data.nextCursor,
767
+ };
768
+ }
769
+ catch (error) {
770
+ if (error instanceof PmxtError)
771
+ throw error;
772
+ throw new PmxtError(`Failed to fetchEventsPaginated: ${error}`);
773
+ }
774
+ }
743
775
  async fetchEvents(params) {
744
776
  await this.initPromise;
745
777
  try {
@@ -1567,7 +1599,7 @@ export class Exchange {
1567
1599
  paramsDict.limit = params.limit;
1568
1600
  }
1569
1601
  const args = [resolvedOutcomeId, paramsDict];
1570
- const query = { id: resolvedOutcomeId, ...paramsDict };
1602
+ const query = { outcomeId: resolvedOutcomeId, ...paramsDict };
1571
1603
  const json = await this.sidecarReadRequest('fetchOHLCV', query, args);
1572
1604
  const data = this.handleResponse(json);
1573
1605
  return data.map(convertCandle);
@@ -1605,7 +1637,7 @@ export class Exchange {
1605
1637
  paramsDict.end = params.end instanceof Date ? params.end.toISOString() : params.end;
1606
1638
  }
1607
1639
  const args = [resolvedOutcomeId, paramsDict];
1608
- const query = { id: resolvedOutcomeId, ...paramsDict };
1640
+ const query = { outcomeId: resolvedOutcomeId, ...paramsDict };
1609
1641
  const json = await this.sidecarReadRequest('fetchTrades', query, args);
1610
1642
  const data = this.handleResponse(json);
1611
1643
  return data.map(convertTrade);
@@ -57,6 +57,18 @@ export interface UserTrade {
57
57
  * @memberof UserTrade
58
58
  */
59
59
  orderId?: string;
60
+ /**
61
+ * The market this trade belongs to, when the venue exposes it (e.g. derivable from the fill's coin/asset).
62
+ * @type {string}
63
+ * @memberof UserTrade
64
+ */
65
+ marketId?: string;
66
+ /**
67
+ * Trading fee paid by the user for this fill, when the venue exposes it.
68
+ * @type {number}
69
+ * @memberof UserTrade
70
+ */
71
+ fee?: number;
60
72
  /**
61
73
  * Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
62
74
  * @type {string}
@@ -58,6 +58,8 @@ function UserTradeFromJSONTyped(json, ignoreDiscriminator) {
58
58
  'side': json['side'],
59
59
  'outcomeId': json['outcomeId'] == null ? undefined : json['outcomeId'],
60
60
  'orderId': json['orderId'] == null ? undefined : json['orderId'],
61
+ 'marketId': json['marketId'] == null ? undefined : json['marketId'],
62
+ 'fee': json['fee'] == null ? undefined : json['fee'],
61
63
  'txHash': json['txHash'] == null ? undefined : json['txHash'],
62
64
  'chain': json['chain'] == null ? undefined : json['chain'],
63
65
  'blockNumber': json['blockNumber'] == null ? undefined : json['blockNumber'],
@@ -78,6 +80,8 @@ function UserTradeToJSONTyped(value, ignoreDiscriminator = false) {
78
80
  'side': value['side'],
79
81
  'outcomeId': value['outcomeId'],
80
82
  'orderId': value['orderId'],
83
+ 'marketId': value['marketId'],
84
+ 'fee': value['fee'],
81
85
  'txHash': value['txHash'],
82
86
  'chain': value['chain'],
83
87
  'blockNumber': value['blockNumber'],
@@ -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, EventFetchParams, EventFilterCriteria, EventFilterFunction, ExecutionPriceResult, FetchOrderBookParams, MarketFetchParams, MarketFilterCriteria, MarketFilterFunction, MarketOutcome, MyTradesParams, Order, OrderBook, OrderHistoryParams, PaginatedMarketsResult, Position, SeriesFetchParams, PriceCandle, SubscribedAddressSnapshot, SubscriptionOption, Trade, UnifiedEvent, UnifiedMarket, UnifiedSeries, UserTrade, FirehoseEvent, FetchMatchedMarketClustersParams } from "./models.js";
8
+ import { Balance, BuiltOrder, CreateOrderParams, EventFetchParams, EventFilterCriteria, EventFilterFunction, ExecutionPriceResult, FetchOrderBookParams, MarketFetchParams, MarketFilterCriteria, MarketFilterFunction, MarketOutcome, MyTradesParams, Order, OrderBook, OrderHistoryParams, PaginatedMarketsResult, PaginatedEventsResult, Position, SeriesFetchParams, PriceCandle, SubscribedAddressSnapshot, SubscriptionOption, Trade, UnifiedEvent, UnifiedMarket, UnifiedSeries, UserTrade, FirehoseEvent, FetchMatchedMarketClustersParams } from "./models.js";
9
9
  import { ServerManager } from "./server-manager.js";
10
10
  import type { Signer } from "./signers.js";
11
11
  import { Escrow } from "./escrow.js";
@@ -212,6 +212,7 @@ export declare abstract class Exchange {
212
212
  loadMarkets(reload?: boolean): Promise<Record<string, UnifiedMarket>>;
213
213
  fetchMarkets(params?: MarketFetchParams): Promise<UnifiedMarket[]>;
214
214
  fetchMarketsPaginated(params?: any): Promise<PaginatedMarketsResult>;
215
+ fetchEventsPaginated(params?: any): Promise<PaginatedEventsResult>;
215
216
  fetchEvents(params?: EventFetchParams): Promise<UnifiedEvent[]>;
216
217
  fetchSeries(params?: SeriesFetchParams): Promise<UnifiedSeries[]>;
217
218
  fetchMarket(params?: MarketFetchParams): Promise<UnifiedMarket>;
@@ -743,6 +743,38 @@ class Exchange {
743
743
  throw new errors_js_1.PmxtError(`Failed to fetchMarketsPaginated: ${error}`);
744
744
  }
745
745
  }
746
+ async fetchEventsPaginated(params) {
747
+ await this.initPromise;
748
+ try {
749
+ const args = [];
750
+ if (params !== undefined)
751
+ args.push(params);
752
+ const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchEventsPaginated`, {
753
+ method: 'POST',
754
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
755
+ body: JSON.stringify({ args, credentials: this.getCredentials() }),
756
+ });
757
+ if (!response.ok) {
758
+ const body = await response.json().catch(() => ({}));
759
+ if (body.error && typeof body.error === "object") {
760
+ throw (0, errors_js_1.fromServerError)(body.error);
761
+ }
762
+ throw new errors_js_1.PmxtError(body.error?.message || response.statusText);
763
+ }
764
+ const json = await response.json();
765
+ const data = this.handleResponse(json);
766
+ return {
767
+ data: (data.data || []).map(convertEvent),
768
+ total: data.total,
769
+ nextCursor: data.nextCursor,
770
+ };
771
+ }
772
+ catch (error) {
773
+ if (error instanceof errors_js_1.PmxtError)
774
+ throw error;
775
+ throw new errors_js_1.PmxtError(`Failed to fetchEventsPaginated: ${error}`);
776
+ }
777
+ }
746
778
  async fetchEvents(params) {
747
779
  await this.initPromise;
748
780
  try {
@@ -1570,7 +1602,7 @@ class Exchange {
1570
1602
  paramsDict.limit = params.limit;
1571
1603
  }
1572
1604
  const args = [resolvedOutcomeId, paramsDict];
1573
- const query = { id: resolvedOutcomeId, ...paramsDict };
1605
+ const query = { outcomeId: resolvedOutcomeId, ...paramsDict };
1574
1606
  const json = await this.sidecarReadRequest('fetchOHLCV', query, args);
1575
1607
  const data = this.handleResponse(json);
1576
1608
  return data.map(convertCandle);
@@ -1608,7 +1640,7 @@ class Exchange {
1608
1640
  paramsDict.end = params.end instanceof Date ? params.end.toISOString() : params.end;
1609
1641
  }
1610
1642
  const args = [resolvedOutcomeId, paramsDict];
1611
- const query = { id: resolvedOutcomeId, ...paramsDict };
1643
+ const query = { outcomeId: resolvedOutcomeId, ...paramsDict };
1612
1644
  const json = await this.sidecarReadRequest('fetchTrades', query, args);
1613
1645
  const data = this.handleResponse(json);
1614
1646
  return data.map(convertTrade);
@@ -13,6 +13,8 @@ Name | Type
13
13
  `side` | string
14
14
  `outcomeId` | string
15
15
  `orderId` | string
16
+ `marketId` | string
17
+ `fee` | number
16
18
  `txHash` | string
17
19
  `chain` | string
18
20
  `blockNumber` | number
@@ -31,6 +33,8 @@ const example = {
31
33
  "side": null,
32
34
  "outcomeId": null,
33
35
  "orderId": null,
36
+ "marketId": null,
37
+ "fee": null,
34
38
  "txHash": null,
35
39
  "chain": null,
36
40
  "blockNumber": null,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxtjs",
3
- "version": "2.50.16",
3
+ "version": "2.51.0",
4
4
  "description": "OpenAPI client for pmxtjs",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
@@ -61,6 +61,18 @@ export interface UserTrade {
61
61
  * @memberof UserTrade
62
62
  */
63
63
  orderId?: string;
64
+ /**
65
+ * The market this trade belongs to, when the venue exposes it (e.g. derivable from the fill's coin/asset).
66
+ * @type {string}
67
+ * @memberof UserTrade
68
+ */
69
+ marketId?: string;
70
+ /**
71
+ * Trading fee paid by the user for this fill, when the venue exposes it.
72
+ * @type {number}
73
+ * @memberof UserTrade
74
+ */
75
+ fee?: number;
64
76
  /**
65
77
  * Populated in hosted mode after on-chain settlement; null for local-mode and for non-on-chain venues.
66
78
  * @type {string}
@@ -122,6 +134,8 @@ export function UserTradeFromJSONTyped(json: any, ignoreDiscriminator: boolean):
122
134
  'side': json['side'],
123
135
  'outcomeId': json['outcomeId'] == null ? undefined : json['outcomeId'],
124
136
  'orderId': json['orderId'] == null ? undefined : json['orderId'],
137
+ 'marketId': json['marketId'] == null ? undefined : json['marketId'],
138
+ 'fee': json['fee'] == null ? undefined : json['fee'],
125
139
  'txHash': json['txHash'] == null ? undefined : json['txHash'],
126
140
  'chain': json['chain'] == null ? undefined : json['chain'],
127
141
  'blockNumber': json['blockNumber'] == null ? undefined : json['blockNumber'],
@@ -146,6 +160,8 @@ export function UserTradeToJSONTyped(value?: UserTrade | null, ignoreDiscriminat
146
160
  'side': value['side'],
147
161
  'outcomeId': value['outcomeId'],
148
162
  'orderId': value['orderId'],
163
+ 'marketId': value['marketId'],
164
+ 'fee': value['fee'],
149
165
  'txHash': value['txHash'],
150
166
  'chain': value['chain'],
151
167
  'blockNumber': value['blockNumber'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmxtjs",
3
- "version": "2.50.16",
3
+ "version": "2.51.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.50.16",
46
+ "pmxt-core": "2.51.0",
47
47
  "ws": "^8.18.0"
48
48
  },
49
49
  "peerDependencies": {
package/pmxt/client.ts CHANGED
@@ -963,6 +963,36 @@ export abstract class Exchange {
963
963
  }
964
964
  }
965
965
 
966
+ async fetchEventsPaginated(params?: any): Promise<PaginatedEventsResult> {
967
+ await this.initPromise;
968
+ try {
969
+ const args: any[] = [];
970
+ if (params !== undefined) args.push(params);
971
+ const response = await this.fetchWithRetry(`${this.resolveBaseUrl()}/api/${this.exchangeName}/fetchEventsPaginated`, {
972
+ method: 'POST',
973
+ headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
974
+ body: JSON.stringify({ args, credentials: this.getCredentials() }),
975
+ });
976
+ if (!response.ok) {
977
+ const body = await response.json().catch(() => ({}));
978
+ if (body.error && typeof body.error === "object") {
979
+ throw fromServerError(body.error);
980
+ }
981
+ throw new PmxtError(body.error?.message || response.statusText);
982
+ }
983
+ const json = await response.json();
984
+ const data = this.handleResponse(json);
985
+ return {
986
+ data: (data.data || []).map(convertEvent),
987
+ total: data.total,
988
+ nextCursor: data.nextCursor,
989
+ };
990
+ } catch (error) {
991
+ if (error instanceof PmxtError) throw error;
992
+ throw new PmxtError(`Failed to fetchEventsPaginated: ${error}`);
993
+ }
994
+ }
995
+
966
996
  async fetchEvents(params?: EventFetchParams): Promise<UnifiedEvent[]> {
967
997
  await this.initPromise;
968
998
  try {
@@ -1750,7 +1780,7 @@ export abstract class Exchange {
1750
1780
  }
1751
1781
 
1752
1782
  const args = [resolvedOutcomeId, paramsDict];
1753
- const query = { id: resolvedOutcomeId, ...paramsDict };
1783
+ const query = { outcomeId: resolvedOutcomeId, ...paramsDict };
1754
1784
  const json = await this.sidecarReadRequest('fetchOHLCV', query, args);
1755
1785
  const data = this.handleResponse(json);
1756
1786
  return data.map(convertCandle);
@@ -1791,7 +1821,7 @@ export abstract class Exchange {
1791
1821
  }
1792
1822
 
1793
1823
  const args = [resolvedOutcomeId, paramsDict];
1794
- const query = { id: resolvedOutcomeId, ...paramsDict };
1824
+ const query = { outcomeId: resolvedOutcomeId, ...paramsDict };
1795
1825
  const json = await this.sidecarReadRequest('fetchTrades', query, args);
1796
1826
  const data = this.handleResponse(json);
1797
1827
  return data.map(convertTrade);