pmxtjs 2.19.6 → 2.20.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 (59) hide show
  1. package/dist/esm/generated/src/apis/DefaultApi.d.ts +53 -1
  2. package/dist/esm/generated/src/apis/DefaultApi.js +83 -1
  3. package/dist/esm/generated/src/models/FetchBalanceRequest.d.ts +2 -2
  4. package/dist/esm/generated/src/models/FetchPositionsRequest.d.ts +2 -2
  5. package/dist/esm/generated/src/models/UnwatchAddressRequest.d.ts +39 -0
  6. package/dist/esm/generated/src/models/UnwatchAddressRequest.js +46 -0
  7. package/dist/esm/generated/src/models/WatchAddress200Response.d.ts +45 -0
  8. package/dist/esm/generated/src/models/WatchAddress200Response.js +46 -0
  9. package/dist/esm/generated/src/models/WatchAddressRequest.d.ts +40 -0
  10. package/dist/esm/generated/src/models/WatchAddressRequest.js +47 -0
  11. package/dist/esm/generated/src/models/WatchAddressRequestArgsInner.d.ts +21 -0
  12. package/dist/esm/generated/src/models/WatchAddressRequestArgsInner.js +37 -0
  13. package/dist/esm/generated/src/models/index.d.ts +4 -0
  14. package/dist/esm/generated/src/models/index.js +4 -0
  15. package/dist/esm/pmxt/args.d.ts +1 -0
  16. package/dist/esm/pmxt/args.js +3 -0
  17. package/dist/esm/pmxt/client.d.ts +94 -6
  18. package/dist/esm/pmxt/client.js +217 -55
  19. package/dist/esm/pmxt/models.d.ts +45 -0
  20. package/dist/generated/src/apis/DefaultApi.d.ts +53 -1
  21. package/dist/generated/src/apis/DefaultApi.js +83 -1
  22. package/dist/generated/src/models/FetchBalanceRequest.d.ts +2 -2
  23. package/dist/generated/src/models/FetchPositionsRequest.d.ts +2 -2
  24. package/dist/generated/src/models/UnwatchAddressRequest.d.ts +39 -0
  25. package/dist/generated/src/models/UnwatchAddressRequest.js +53 -0
  26. package/dist/generated/src/models/WatchAddress200Response.d.ts +45 -0
  27. package/dist/generated/src/models/WatchAddress200Response.js +53 -0
  28. package/dist/generated/src/models/WatchAddressRequest.d.ts +40 -0
  29. package/dist/generated/src/models/WatchAddressRequest.js +54 -0
  30. package/dist/generated/src/models/WatchAddressRequestArgsInner.d.ts +21 -0
  31. package/dist/generated/src/models/WatchAddressRequestArgsInner.js +43 -0
  32. package/dist/generated/src/models/index.d.ts +4 -0
  33. package/dist/generated/src/models/index.js +4 -0
  34. package/dist/pmxt/args.d.ts +1 -0
  35. package/dist/pmxt/args.js +6 -0
  36. package/dist/pmxt/client.d.ts +94 -6
  37. package/dist/pmxt/client.js +216 -54
  38. package/dist/pmxt/models.d.ts +45 -0
  39. package/generated/.openapi-generator/FILES +8 -0
  40. package/generated/docs/DefaultApi.md +142 -0
  41. package/generated/docs/FetchBalanceRequest.md +1 -1
  42. package/generated/docs/FetchPositionsRequest.md +1 -1
  43. package/generated/docs/UnwatchAddressRequest.md +36 -0
  44. package/generated/docs/WatchAddress200Response.md +38 -0
  45. package/generated/docs/WatchAddressRequest.md +36 -0
  46. package/generated/docs/WatchAddressRequestArgsInner.md +32 -0
  47. package/generated/package.json +1 -1
  48. package/generated/src/apis/DefaultApi.ts +127 -0
  49. package/generated/src/models/FetchBalanceRequest.ts +2 -2
  50. package/generated/src/models/FetchPositionsRequest.ts +2 -2
  51. package/generated/src/models/UnwatchAddressRequest.ts +82 -0
  52. package/generated/src/models/WatchAddress200Response.ts +89 -0
  53. package/generated/src/models/WatchAddressRequest.ts +89 -0
  54. package/generated/src/models/WatchAddressRequestArgsInner.ts +49 -0
  55. package/generated/src/models/index.ts +4 -0
  56. package/package.json +2 -2
  57. package/pmxt/args.ts +3 -0
  58. package/pmxt/client.ts +262 -60
  59. package/pmxt/models.ts +55 -1
package/pmxt/client.ts CHANGED
@@ -6,37 +6,43 @@
6
6
  */
7
7
 
8
8
  import {
9
- DefaultApi,
10
9
  Configuration,
11
- FetchOHLCVRequest,
12
- FetchTradesRequest,
13
10
  CreateOrderRequest,
11
+ DefaultApi,
14
12
  ExchangeCredentials,
13
+ FetchOHLCVRequest,
14
+ FetchTradesRequest,
15
+ BuildOrderRequest,
16
+ SubmitOrderRequest,
15
17
  } from "../generated/src/index.js";
16
18
 
17
19
  import {
18
- UnifiedMarket,
19
- MarketOutcome,
20
+ Balance,
21
+ BuiltOrder,
22
+ CreateOrderParams,
23
+ EventFilterCriteria,
24
+ EventFilterFunction,
25
+ ExecutionPriceResult,
26
+ MarketFilterCriteria,
27
+ MarketFilterFunction,
20
28
  MarketList,
21
- PriceCandle,
29
+ MarketOutcome,
30
+ Order,
22
31
  OrderBook,
23
32
  OrderLevel,
24
- Trade,
25
- UserTrade,
26
- Order,
33
+ PaginatedMarketsResult,
27
34
  Position,
28
- Balance,
29
- SearchIn,
35
+ PriceCandle,
36
+ SubscribedAddressSnapshot,
37
+ SubscriptionOption,
38
+ Trade,
30
39
  UnifiedEvent,
31
- ExecutionPriceResult,
32
- PaginatedMarketsResult,
33
- MarketFilterCriteria,
34
- MarketFilterFunction,
35
- EventFilterCriteria,
36
- EventFilterFunction,
40
+ UnifiedMarket,
41
+ UserTrade,
37
42
  } from "./models.js";
38
43
 
39
44
  import { ServerManager } from "./server-manager.js";
45
+ import { buildArgsWithOptionalOptions } from "./args.js";
40
46
 
41
47
  // Converter functions
42
48
  function convertMarket(raw: any): UnifiedMarket {
@@ -190,6 +196,22 @@ function convertEvent(raw: any): UnifiedEvent {
190
196
  return event;
191
197
  }
192
198
 
199
+
200
+ function convertSubscriptionSnapshot(raw: any): SubscribedAddressSnapshot {
201
+ const trades = (raw.trades?? []).map(convertTrade);
202
+ const balances = (raw.balances?? []).map(convertBalance);
203
+ const positions = (raw.positions?? []).map(convertPosition);
204
+
205
+ const snapShot: SubscribedAddressSnapshot = {
206
+ address: raw.address,
207
+ trades,
208
+ balances,
209
+ positions,
210
+ timestamp: raw.timestamp,
211
+ };
212
+ return snapShot;
213
+ }
214
+
193
215
  /**
194
216
  * Base exchange client options.
195
217
  */
@@ -384,8 +406,7 @@ export abstract class Exchange {
384
406
  async fetchMarkets(params?: any): Promise<UnifiedMarket[]> {
385
407
  await this.initPromise;
386
408
  try {
387
- const args: any[] = [];
388
- if (params !== undefined) args.push(params);
409
+ const args = buildArgsWithOptionalOptions(params);
389
410
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMarkets`, {
390
411
  method: 'POST',
391
412
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -406,8 +427,7 @@ export abstract class Exchange {
406
427
  async fetchMarketsPaginated(params?: any): Promise<PaginatedMarketsResult> {
407
428
  await this.initPromise;
408
429
  try {
409
- const args: any[] = [];
410
- if (params !== undefined) args.push(params);
430
+ const args = buildArgsWithOptionalOptions(params);
411
431
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMarketsPaginated`, {
412
432
  method: 'POST',
413
433
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -432,8 +452,7 @@ export abstract class Exchange {
432
452
  async fetchEvents(params?: any): Promise<UnifiedEvent[]> {
433
453
  await this.initPromise;
434
454
  try {
435
- const args: any[] = [];
436
- if (params !== undefined) args.push(params);
455
+ const args = buildArgsWithOptionalOptions(params);
437
456
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchEvents`, {
438
457
  method: 'POST',
439
458
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -454,8 +473,7 @@ export abstract class Exchange {
454
473
  async fetchMarket(params?: any): Promise<UnifiedMarket> {
455
474
  await this.initPromise;
456
475
  try {
457
- const args: any[] = [];
458
- if (params !== undefined) args.push(params);
476
+ const args = buildArgsWithOptionalOptions(params);
459
477
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMarket`, {
460
478
  method: 'POST',
461
479
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -476,8 +494,7 @@ export abstract class Exchange {
476
494
  async fetchEvent(params?: any): Promise<UnifiedEvent> {
477
495
  await this.initPromise;
478
496
  try {
479
- const args: any[] = [];
480
- if (params !== undefined) args.push(params);
497
+ const args = buildArgsWithOptionalOptions(params);
481
498
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchEvent`, {
482
499
  method: 'POST',
483
500
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -517,27 +534,6 @@ export abstract class Exchange {
517
534
  }
518
535
  }
519
536
 
520
- async submitOrder(built: any): Promise<Order> {
521
- await this.initPromise;
522
- try {
523
- const args: any[] = [];
524
- args.push(built);
525
- const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/submitOrder`, {
526
- method: 'POST',
527
- headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
528
- body: JSON.stringify({ args, credentials: this.getCredentials() }),
529
- });
530
- if (!response.ok) {
531
- const error = await response.json().catch(() => ({}));
532
- throw new Error(error.error?.message || response.statusText);
533
- }
534
- const json = await response.json();
535
- const data = this.handleResponse(json);
536
- return convertOrder(data);
537
- } catch (error) {
538
- throw new Error(`Failed to submitOrder: ${error}`);
539
- }
540
- }
541
537
 
542
538
  async cancelOrder(orderId: string): Promise<Order> {
543
539
  await this.initPromise;
@@ -586,8 +582,7 @@ export abstract class Exchange {
586
582
  async fetchOpenOrders(marketId?: string): Promise<Order[]> {
587
583
  await this.initPromise;
588
584
  try {
589
- const args: any[] = [];
590
- if (marketId !== undefined) args.push(marketId);
585
+ const args = buildArgsWithOptionalOptions(marketId);
591
586
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchOpenOrders`, {
592
587
  method: 'POST',
593
588
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -608,8 +603,7 @@ export abstract class Exchange {
608
603
  async fetchMyTrades(params?: any): Promise<UserTrade[]> {
609
604
  await this.initPromise;
610
605
  try {
611
- const args: any[] = [];
612
- if (params !== undefined) args.push(params);
606
+ const args = buildArgsWithOptionalOptions(params);
613
607
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchMyTrades`, {
614
608
  method: 'POST',
615
609
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -630,8 +624,7 @@ export abstract class Exchange {
630
624
  async fetchClosedOrders(params?: any): Promise<Order[]> {
631
625
  await this.initPromise;
632
626
  try {
633
- const args: any[] = [];
634
- if (params !== undefined) args.push(params);
627
+ const args = buildArgsWithOptionalOptions(params);
635
628
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchClosedOrders`, {
636
629
  method: 'POST',
637
630
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -652,8 +645,7 @@ export abstract class Exchange {
652
645
  async fetchAllOrders(params?: any): Promise<Order[]> {
653
646
  await this.initPromise;
654
647
  try {
655
- const args: any[] = [];
656
- if (params !== undefined) args.push(params);
648
+ const args = buildArgsWithOptionalOptions(params);
657
649
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchAllOrders`, {
658
650
  method: 'POST',
659
651
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -671,10 +663,10 @@ export abstract class Exchange {
671
663
  }
672
664
  }
673
665
 
674
- async fetchPositions(): Promise<Position[]> {
666
+ async fetchPositions(address?: string): Promise<Position[]> {
675
667
  await this.initPromise;
676
668
  try {
677
- const args: any[] = [];
669
+ const args: any[] = address? [address] : [];
678
670
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchPositions`, {
679
671
  method: 'POST',
680
672
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -692,10 +684,10 @@ export abstract class Exchange {
692
684
  }
693
685
  }
694
686
 
695
- async fetchBalance(): Promise<Balance[]> {
687
+ async fetchBalance(address?: string): Promise<Balance[]> {
696
688
  await this.initPromise;
697
689
  try {
698
- const args: any[] = [];
690
+ const args: any[] = address? [address] : [];
699
691
  const response = await fetch(`${this.config.basePath}/api/${this.exchangeName}/fetchBalance`, {
700
692
  method: 'POST',
701
693
  headers: { 'Content-Type': 'application/json', ...this.getAuthHeaders() },
@@ -877,6 +869,7 @@ export abstract class Exchange {
877
869
  * Call repeatedly in a loop to stream updates (CCXT Pro pattern).
878
870
  *
879
871
  * @param outcomeId - Outcome ID to watch
872
+ * @param address - Public wallet to be watched
880
873
  * @param since - Optional timestamp to filter trades from
881
874
  * @param limit - Optional limit for number of trades
882
875
  * @returns Next trade update(s)
@@ -894,12 +887,16 @@ export abstract class Exchange {
894
887
  */
895
888
  async watchTrades(
896
889
  outcomeId: string,
890
+ address?: string,
897
891
  since?: number,
898
892
  limit?: number
899
893
  ): Promise<Trade[]> {
900
894
  await this.initPromise;
901
895
  try {
902
896
  const args: any[] = [outcomeId];
897
+ if (address !== undefined) {
898
+ args.push(address);
899
+ }
903
900
  if (since !== undefined) {
904
901
  args.push(since);
905
902
  }
@@ -924,8 +921,213 @@ export abstract class Exchange {
924
921
  }
925
922
  }
926
923
 
924
+ /**
925
+ * Watch real-time updates of a public wallet via WebSocket.
926
+ *
927
+ * Returns a promise that resolves with the next update(s).
928
+ * Call repeatedly in a loop to stream updates (CCXT Pro pattern).
929
+ *
930
+ * @param address - Public wallet to be watched
931
+ * @param types - Subscription options including 'trades', 'positions', and 'balances'
932
+ * @returns Next update(s)
933
+ *
934
+ * @example
935
+ * ```typescript
936
+ * // Stream updates of a public wallet address
937
+ * while (true) {
938
+ * const snapshots = await exchange.watchAddress(address, types);
939
+ * for (const snapshot of snapshots) {
940
+ * console.log(`Trade: ${snapshot.trades}`);
941
+ * }
942
+ * }
943
+ * ```
944
+ */
945
+ async watchAddress(
946
+ address: string,
947
+ types?: SubscriptionOption[],
948
+ ): Promise<SubscribedAddressSnapshot> {
949
+ await this.initPromise;
950
+ try {
951
+ const args: any[] = [address];
952
+ if (types !== undefined) {
953
+ args.push(types);
954
+ }
955
+ const requestBody: any = {
956
+ args,
957
+ credentials: this.getCredentials()
958
+ };
959
+
960
+ const response = await this.api.watchAddress({
961
+ exchange: this.exchangeName as any,
962
+ watchAddressRequest: requestBody,
963
+ });
964
+
965
+ const data = this.handleResponse(response);
966
+ return convertSubscriptionSnapshot(data);
967
+ } catch (error) {
968
+ throw new Error(`Failed to watch address: ${error}`);
969
+ }
970
+ }
971
+
972
+ /**
973
+ * Stop watching a previously registered wallet address and release its resource updates.
974
+ *
975
+ * @param address - Public wallet to be watched
976
+ * @returns
977
+ */
978
+ async unwatchAddress(
979
+ address: string,
980
+ ): Promise<Trade[]> {
981
+ await this.initPromise;
982
+ try {
983
+ const args: any[] = [address];
984
+
985
+ const requestBody: any = {
986
+ args,
987
+ credentials: this.getCredentials()
988
+ };
989
+
990
+ const response = await this.api.unwatchAddress({
991
+ exchange: this.exchangeName as any,
992
+ unwatchAddressRequest: requestBody,
993
+ });
994
+
995
+ return this.handleResponse(response);
996
+ } catch (error) {
997
+ throw new Error(`Failed to unwatch address: ${error}`);
998
+ }
999
+ }
1000
+
927
1001
  // Trading Methods (require authentication)
928
1002
 
1003
+ /**
1004
+ * Build an order payload without submitting it to the exchange.
1005
+ * Returns the exchange-native signed order or transaction payload for
1006
+ * inspection, forwarding through a middleware layer, or deferred
1007
+ * submission via {@link submitOrder}.
1008
+ *
1009
+ * You can specify the market either with explicit marketId/outcomeId,
1010
+ * or by passing an outcome object directly (e.g., market.yes).
1011
+ *
1012
+ * @param params - Order parameters (same as createOrder)
1013
+ * @returns A BuiltOrder containing the exchange-native payload
1014
+ *
1015
+ * @example
1016
+ * ```typescript
1017
+ * // Build, inspect, then submit:
1018
+ * const built = await exchange.buildOrder({
1019
+ * marketId: "663583",
1020
+ * outcomeId: "10991849...",
1021
+ * side: "buy",
1022
+ * type: "limit",
1023
+ * amount: 10,
1024
+ * price: 0.55
1025
+ * });
1026
+ *
1027
+ * console.log(built.signedOrder); // inspect before submitting
1028
+ * const order = await exchange.submitOrder(built);
1029
+ *
1030
+ * // Using outcome shorthand:
1031
+ * const built2 = await exchange.buildOrder({
1032
+ * outcome: market.yes,
1033
+ * side: "buy",
1034
+ * type: "market",
1035
+ * amount: 10
1036
+ * });
1037
+ * ```
1038
+ */
1039
+ async buildOrder(params: CreateOrderParams & { outcome?: MarketOutcome }): Promise<BuiltOrder> {
1040
+ await this.initPromise;
1041
+ try {
1042
+ let marketId = params.marketId;
1043
+ let outcomeId = params.outcomeId;
1044
+
1045
+ if (params.outcome) {
1046
+ if (marketId !== undefined || outcomeId !== undefined) {
1047
+ throw new Error(
1048
+ "Cannot specify both 'outcome' and 'marketId'/'outcomeId'. Use one or the other."
1049
+ );
1050
+ }
1051
+ const outcome: MarketOutcome = params.outcome;
1052
+ if (!outcome.marketId) {
1053
+ throw new Error(
1054
+ "outcome.marketId is not set. Ensure the outcome comes from a fetched market."
1055
+ );
1056
+ }
1057
+ marketId = outcome.marketId;
1058
+ outcomeId = outcome.outcomeId;
1059
+ }
1060
+
1061
+ const paramsDict: any = {
1062
+ marketId,
1063
+ outcomeId,
1064
+ side: params.side,
1065
+ type: params.type,
1066
+ amount: params.amount,
1067
+ };
1068
+ if (params.price !== undefined) {
1069
+ paramsDict.price = params.price;
1070
+ }
1071
+ if (params.fee !== undefined) {
1072
+ paramsDict.fee = params.fee;
1073
+ }
1074
+
1075
+ const requestBody: BuildOrderRequest = {
1076
+ args: [paramsDict],
1077
+ credentials: this.getCredentials()
1078
+ };
1079
+
1080
+ const response = await this.api.buildOrder({
1081
+ exchange: this.exchangeName as any,
1082
+ buildOrderRequest: requestBody,
1083
+ });
1084
+
1085
+ const data = this.handleResponse(response);
1086
+ return data as BuiltOrder;
1087
+ } catch (error) {
1088
+ throw new Error(`Failed to build order: ${error}`);
1089
+ }
1090
+ }
1091
+
1092
+ /**
1093
+ * Submit a pre-built order returned by {@link buildOrder}.
1094
+ *
1095
+ * @param built - The BuiltOrder payload from buildOrder()
1096
+ * @returns The submitted order
1097
+ *
1098
+ * @example
1099
+ * ```typescript
1100
+ * const built = await exchange.buildOrder({
1101
+ * outcome: market.yes,
1102
+ * side: "buy",
1103
+ * type: "limit",
1104
+ * amount: 10,
1105
+ * price: 0.55
1106
+ * });
1107
+ * const order = await exchange.submitOrder(built);
1108
+ * console.log(order.id, order.status);
1109
+ * ```
1110
+ */
1111
+ async submitOrder(built: BuiltOrder): Promise<Order> {
1112
+ await this.initPromise;
1113
+ try {
1114
+ const requestBody: SubmitOrderRequest = {
1115
+ args: [built as any],
1116
+ credentials: this.getCredentials()
1117
+ };
1118
+
1119
+ const response = await this.api.submitOrder({
1120
+ exchange: this.exchangeName as any,
1121
+ submitOrderRequest: requestBody,
1122
+ });
1123
+
1124
+ const data = this.handleResponse(response);
1125
+ return convertOrder(data);
1126
+ } catch (error) {
1127
+ throw new Error(`Failed to submit order: ${error}`);
1128
+ }
1129
+ }
1130
+
929
1131
  /**
930
1132
  * Create a new order.
931
1133
  *
package/pmxt/models.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Data models for PMXT TypeScript SDK.
3
- *
3
+ *
4
4
  * These are clean TypeScript interfaces that provide a user-friendly API.
5
5
  */
6
6
 
@@ -368,6 +368,29 @@ export interface CreateOrderParams {
368
368
  /** Optional fee rate (e.g., 1000 for 0.1%) */
369
369
  fee?: number;
370
370
  }
371
+
372
+ /**
373
+ * An order payload built but not yet submitted to the exchange.
374
+ */
375
+ export interface BuiltOrder {
376
+ /** The exchange name this order was built for. */
377
+ exchange: string;
378
+ /** The original params used to build this order. */
379
+ params: CreateOrderParams;
380
+ /** For CLOB exchanges (Polymarket): the EIP-712 signed order. */
381
+ signedOrder?: Record<string, unknown>;
382
+ /** For on-chain AMM exchanges: the EVM transaction payload. */
383
+ tx?: {
384
+ to: string;
385
+ data: string;
386
+ value: string;
387
+ chainId: number;
388
+ };
389
+ /** The raw, exchange-native payload. Always present. */
390
+ raw: unknown;
391
+ }
392
+
393
+
371
394
  /**
372
395
  * A list of UnifiedMarket objects with a convenience match() method.
373
396
  * Extends Array so all standard array operations work unchanged.
@@ -545,3 +568,34 @@ export interface EventFilterCriteria {
545
568
  * Function type for custom event filtering logic.
546
569
  */
547
570
  export type EventFilterFunction = (event: UnifiedEvent) => boolean;
571
+
572
+ /**
573
+ * Subscription options.
574
+ */
575
+ export type SubscriptionOption = 'trades' | 'positions' | 'balances';
576
+
577
+ /**
578
+ * Subscription snapshot of a watched public wallet address.
579
+ */
580
+ export interface SubscribedAddressSnapshot {
581
+ /** The wallet address being watched */
582
+ address: string;
583
+
584
+ /** Recent trades for this address
585
+ * (if the above SubscriptionOption 'trades' option was requested)
586
+ */
587
+ trades?: Trade[];
588
+
589
+ /** Current open positions for this address
590
+ * (if the above SubscriptionOption 'positions' option was requested)
591
+ */
592
+ positions?: Position[];
593
+
594
+ /** Current balances for this address
595
+ * (if the above SubscriptionOption 'balances' option was requested)
596
+ */
597
+ balances?: Balance[];
598
+
599
+ /** Unix timestamp (ms) of this snapshot */
600
+ timestamp: number;
601
+ }