@pear-protocol/types 2.21.0 → 2.22.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 (169) hide show
  1. package/dist/bundle.d.ts +1 -0
  2. package/dist/fee/entities.d.ts +1 -0
  3. package/dist/fee/responses.d.ts +26 -0
  4. package/dist/index.js +7355 -3
  5. package/dist/rewards/entities.d.ts +28 -0
  6. package/dist/rewards/payloads.d.ts +7 -0
  7. package/dist/rewards/responses.d.ts +73 -0
  8. package/dist/users/entities.d.ts +4 -0
  9. package/dist/users/response.d.ts +2 -0
  10. package/package.json +3 -2
  11. package/dist/auth/api-keys.js +0 -44
  12. package/dist/auth/entities.js +0 -25
  13. package/dist/auth/index.js +0 -4
  14. package/dist/auth/payloads.js +0 -84
  15. package/dist/auth/response.js +0 -82
  16. package/dist/baskets/recommended/entities.js +0 -22
  17. package/dist/baskets/recommended/index.js +0 -2
  18. package/dist/baskets/recommended/responses.js +0 -8
  19. package/dist/baskets/saved/entities.js +0 -23
  20. package/dist/baskets/saved/payloads.js +0 -18
  21. package/dist/baskets/saved/responses.js +0 -14
  22. package/dist/bundle.js +0 -36
  23. package/dist/common/address.js +0 -5
  24. package/dist/common/array.js +0 -17
  25. package/dist/common/client-id.js +0 -5
  26. package/dist/common/hex-string.js +0 -5
  27. package/dist/common/index.js +0 -4
  28. package/dist/common/refinement.js +0 -64
  29. package/dist/common/request.js +0 -24
  30. package/dist/common/response.js +0 -28
  31. package/dist/common/schema.js +0 -18
  32. package/dist/common/trade-legs.js +0 -50
  33. package/dist/connector/index.js +0 -12
  34. package/dist/copy/entities.js +0 -151
  35. package/dist/copy/index.js +0 -5
  36. package/dist/copy/payloads.js +0 -8
  37. package/dist/copy/performance.js +0 -63
  38. package/dist/copy/queries.js +0 -20
  39. package/dist/copy/responses.js +0 -89
  40. package/dist/execution/entities.js +0 -196
  41. package/dist/execution/index.js +0 -3
  42. package/dist/execution/queries.js +0 -18
  43. package/dist/execution/responses.js +0 -12
  44. package/dist/fee/entities.js +0 -34
  45. package/dist/fee/index.js +0 -3
  46. package/dist/fee/queries.js +0 -12
  47. package/dist/fee/responses.js +0 -29
  48. package/dist/fill/entities.js +0 -82
  49. package/dist/fill/index.js +0 -3
  50. package/dist/fill/queries.js +0 -14
  51. package/dist/fill/responses.js +0 -23
  52. package/dist/funding/entities.js +0 -16
  53. package/dist/funding/index.js +0 -3
  54. package/dist/funding/queries.js +0 -8
  55. package/dist/funding/responses.js +0 -11
  56. package/dist/instrument/entities.js +0 -102
  57. package/dist/instrument/index.js +0 -3
  58. package/dist/instrument/queries.js +0 -15
  59. package/dist/instrument/responses.js +0 -20
  60. package/dist/instrument-precision/index.js +0 -56
  61. package/dist/ladder/entities.js +0 -24
  62. package/dist/ladder/index.js +0 -4
  63. package/dist/ladder/payloads.js +0 -96
  64. package/dist/ladder/queries.js +0 -12
  65. package/dist/ladder/responses.js +0 -18
  66. package/dist/leverage/index.js +0 -2
  67. package/dist/leverage/payloads.js +0 -14
  68. package/dist/leverage/response.js +0 -5
  69. package/dist/margin/index.js +0 -2
  70. package/dist/margin/payloads.js +0 -20
  71. package/dist/margin/response.js +0 -11
  72. package/dist/market/entities.js +0 -52
  73. package/dist/market/index.js +0 -4
  74. package/dist/market/payloads.js +0 -11
  75. package/dist/market/queries.js +0 -19
  76. package/dist/market/responses.js +0 -18
  77. package/dist/misc/index.js +0 -2
  78. package/dist/misc/payloads.js +0 -99
  79. package/dist/misc/responses.js +0 -85
  80. package/dist/notification/entities.js +0 -274
  81. package/dist/notification/index.js +0 -4
  82. package/dist/notification/payloads.js +0 -15
  83. package/dist/notification/queries.js +0 -29
  84. package/dist/notification/responses.js +0 -20
  85. package/dist/order/entities.js +0 -81
  86. package/dist/order/index.js +0 -1
  87. package/dist/portfolio/entities.js +0 -77
  88. package/dist/portfolio/index.js +0 -3
  89. package/dist/portfolio/queries.js +0 -34
  90. package/dist/portfolio/responses.js +0 -33
  91. package/dist/position/entities.js +0 -433
  92. package/dist/position/index.js +0 -3
  93. package/dist/position/queries.js +0 -109
  94. package/dist/position/responses.js +0 -41
  95. package/dist/price/entities.js +0 -10
  96. package/dist/price/index.js +0 -3
  97. package/dist/price/queries.js +0 -8
  98. package/dist/price/responses.js +0 -15
  99. package/dist/realtime/channels.js +0 -16
  100. package/dist/realtime/frames.js +0 -140
  101. package/dist/realtime/index.js +0 -6
  102. package/dist/realtime/messages.js +0 -118
  103. package/dist/realtime/public-events.js +0 -92
  104. package/dist/realtime/user-events.js +0 -32
  105. package/dist/realtime/vault-events.js +0 -42
  106. package/dist/rebalance/entities.js +0 -86
  107. package/dist/rebalance/index.js +0 -4
  108. package/dist/rebalance/payloads.js +0 -56
  109. package/dist/rebalance/queries.js +0 -14
  110. package/dist/rebalance/responses.js +0 -41
  111. package/dist/schedule/entities.js +0 -239
  112. package/dist/schedule/index.js +0 -5
  113. package/dist/schedule/payloads.js +0 -85
  114. package/dist/schedule/queries.js +0 -30
  115. package/dist/schedule/randomization.js +0 -15
  116. package/dist/schedule/responses.js +0 -22
  117. package/dist/schedule/twap-config.js +0 -29
  118. package/dist/statistics/entities.js +0 -105
  119. package/dist/statistics/index.js +0 -3
  120. package/dist/statistics/queries.js +0 -111
  121. package/dist/statistics/responses.js +0 -67
  122. package/dist/sync/index.js +0 -2
  123. package/dist/sync/payloads.js +0 -136
  124. package/dist/sync/responses.js +0 -28
  125. package/dist/tca/entities.js +0 -9
  126. package/dist/tca/index.js +0 -3
  127. package/dist/tca/queries.js +0 -14
  128. package/dist/tca/responses.js +0 -126
  129. package/dist/trade/entities.js +0 -101
  130. package/dist/trade/index.js +0 -4
  131. package/dist/trade/payloads.js +0 -84
  132. package/dist/trade/queries.js +0 -9
  133. package/dist/trade/responses.js +0 -25
  134. package/dist/trade-accounts/entities.js +0 -61
  135. package/dist/trade-accounts/index.js +0 -4
  136. package/dist/trade-accounts/payloads.js +0 -132
  137. package/dist/trade-accounts/queries.js +0 -7
  138. package/dist/trade-accounts/response.js +0 -79
  139. package/dist/traders/index.js +0 -2
  140. package/dist/traders/performance.js +0 -21
  141. package/dist/traders/public.js +0 -192
  142. package/dist/trigger/common/index.js +0 -39
  143. package/dist/trigger/entities/conditions.js +0 -174
  144. package/dist/trigger/entities/index.js +0 -257
  145. package/dist/trigger/index.js +0 -9
  146. package/dist/trigger/oracle.js +0 -22
  147. package/dist/trigger/payloads/conditions.js +0 -213
  148. package/dist/trigger/payloads/config.js +0 -3
  149. package/dist/trigger/payloads/index.js +0 -173
  150. package/dist/trigger/queries.js +0 -16
  151. package/dist/trigger/refinement/index.js +0 -2
  152. package/dist/trigger/refinement/static.refinement.js +0 -50
  153. package/dist/trigger/refinement/trailing.refinement.js +0 -83
  154. package/dist/trigger/responses.js +0 -18
  155. package/dist/triggers/entities.js +0 -27
  156. package/dist/triggers/index.js +0 -3
  157. package/dist/triggers/queries.js +0 -10
  158. package/dist/triggers/responses.js +0 -9
  159. package/dist/users/entities.js +0 -45
  160. package/dist/users/index.js +0 -4
  161. package/dist/users/payloads.js +0 -33
  162. package/dist/users/queries.js +0 -8
  163. package/dist/users/response.js +0 -28
  164. package/dist/vaults/entities.js +0 -96
  165. package/dist/vaults/index.js +0 -4
  166. package/dist/vaults/payloads.js +0 -65
  167. package/dist/vaults/queries.js +0 -66
  168. package/dist/vaults/responses.js +0 -368
  169. /package/dist/{baskets/saved/index.js → rewards/index.d.ts} +0 -0
@@ -1,24 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- const CursorFindParams = z.object({
4
- /**
5
- * The maximum number of items to retrieve.
6
- */
7
- limit: z.coerce.number().int().positive().max(2e3).optional().default(20),
8
- /**
9
- * Opaque pagination cursor returned by the API.
10
- */
11
- cursor: z.string().optional()
12
- });
13
- const PaginationFindParams = z.object({
14
- /**
15
- * The maximum number of items to retrieve.
16
- */
17
- limit: z.coerce.number().int().positive().max(100).optional().default(20),
18
- /**
19
- * The number of items to skip before retrieving the returned items.
20
- */
21
- offset: z.coerce.number().int().min(0).optional().default(0)
22
- });
23
-
24
- export { CursorFindParams, PaginationFindParams };
@@ -1,28 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- const PaginatedResponse = z.object({
4
- /**
5
- * The maximum number of items retrieved.
6
- */
7
- limit: z.number(),
8
- /**
9
- * The number of items to skip before retrieving the returned items.
10
- */
11
- offset: z.number(),
12
- /**
13
- * The total number of items.
14
- */
15
- count: z.number()
16
- });
17
- const CursorResponse = z.object({
18
- /**
19
- * The maximum number of items retrieved.
20
- */
21
- limit: z.number(),
22
- /**
23
- * The cursor to use for pagination.
24
- */
25
- nextCursor: z.string().optional()
26
- });
27
-
28
- export { CursorResponse, PaginatedResponse };
@@ -1,18 +0,0 @@
1
- import z from 'zod';
2
-
3
- const UnsignedDecimalString = z.string().regex(/^\d+(\.\d+)?$/, "Must be a valid decimal string");
4
- const DecimalString = z.string().regex(/^[+-]?\d+(\.\d+)?$/, "Must be a valid decimal string");
5
- const SignedDecimalString = z.string().regex(/^[+-]\d+(\.\d+)?$/, "Must be a valid signed decimal string").transform((val) => val);
6
- const Side = z.enum([
7
- "BUY",
8
- "SELL"
9
- ], {
10
- message: "Side must be either BUY or SELL"
11
- });
12
- const AssetWeight = z.number().positive({
13
- message: "Weight must be greater than 0"
14
- }).max(1, {
15
- message: "Weight must be less than 1"
16
- });
17
-
18
- export { AssetWeight, DecimalString, Side, SignedDecimalString, UnsignedDecimalString };
@@ -1,50 +0,0 @@
1
- import { z } from 'zod';
2
- import { InstrumentId } from '../instrument';
3
- import { RefineLegIdMatchesSymbol } from './refinement';
4
- import { UnsignedDecimalString, Side } from './schema';
5
-
6
- const TradeLegMode = z.enum([
7
- "QUANTITY",
8
- "USD"
9
- ]);
10
- const TradeLegShape = z.object({
11
- /** SYMBOL-MIGRATION switch-to-id: mirrors `symbol` today; becomes required once requests always carry `id`. */
12
- id: InstrumentId.optional(),
13
- /**
14
- * Instrument ID
15
- */
16
- symbol: InstrumentId,
17
- /**
18
- * Side
19
- */
20
- side: Side,
21
- /**
22
- * Mode to interpret the amount
23
- */
24
- mode: TradeLegMode,
25
- /**
26
- * Quantity or USD amount
27
- */
28
- amount: UnsignedDecimalString,
29
- /**
30
- * Reduce only flag
31
- */
32
- reduceOnly: z.boolean()
33
- });
34
- const TradeLegMaxImpactPrice = {
35
- /** Reject the former wire field instead of silently stripping a caller's price constraint. */
36
- limitPrice: z.never({
37
- error: "limitPrice is no longer supported; use maxImpactPrice instead."
38
- }).optional(),
39
- maxImpactPrice: UnsignedDecimalString.refine((value) => Number(value) > 0, "Max impact price must be positive").optional()
40
- };
41
- const TradeLeg = TradeLegShape.superRefine(RefineLegIdMatchesSymbol);
42
- const TradeLegPostOnly = TradeLegShape.omit({
43
- reduceOnly: true
44
- }).superRefine(RefineLegIdMatchesSymbol);
45
- const TradeLegWithMaxImpactPrice = TradeLegShape.extend(TradeLegMaxImpactPrice).strict().superRefine(RefineLegIdMatchesSymbol);
46
- const TradeLegPostOnlyWithMaxImpactPrice = TradeLegShape.omit({
47
- reduceOnly: true
48
- }).extend(TradeLegMaxImpactPrice).strict().superRefine(RefineLegIdMatchesSymbol);
49
-
50
- export { TradeLeg, TradeLegPostOnly, TradeLegPostOnlyWithMaxImpactPrice, TradeLegWithMaxImpactPrice };
@@ -1,12 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- const Connector = z.enum([
4
- "hyperliquid",
5
- "binance",
6
- "bybit",
7
- "okx",
8
- "lighter",
9
- "lighter_rhc"
10
- ]);
11
-
12
- export { Connector };
@@ -1,151 +0,0 @@
1
- import { z } from 'zod';
2
- import { SignedDecimalString, UnsignedDecimalString } from '../common/schema';
3
- import { Connector } from '../connector';
4
- import { InstrumentId } from '../instrument';
5
- import { CopyPerformance, CopyEndCaptureStatus, CopyStartSnapshot } from './performance';
6
-
7
- const CopySubscriptionStatus = z.enum([
8
- "ACTIVE",
9
- "ENDED"
10
- ]);
11
- const CopySizing = z.discriminatedUnion("mode", [
12
- z.object({
13
- /**
14
- * Entry is the leader's own notional-over-equity fraction applied to the follower's equity, taken
15
- * at the moment of entry. There is nothing for the follower to size.
16
- */
17
- mode: z.literal("LEADER_EQUITY_FRACTION")
18
- })
19
- ]);
20
- const CopySubscriptionMetrics = z.object({
21
- volume: UnsignedDecimalString.describe("Lifetime executed USD turnover across opens and closes; excludes fees and funding"),
22
- grossRealizedPnl: SignedDecimalString.describe("Gross realized USD PnL over attributed positions during the copy period, including partial reductions; excludes fees and funding"),
23
- grossUpnl: SignedDecimalString.describe("Gross unrealized USD PnL observed for the subscription; fixed at the actual asynchronous end capture for ended subscriptions; excludes fees and funding"),
24
- fundingPayment: SignedDecimalString.describe("Signed USD funding attributed to exposure during the copy period; positive values are received funding"),
25
- tradeFee: SignedDecimalString.describe("Signed USD trade fees on attributed position fills; negative values are rebates"),
26
- pearFee: SignedDecimalString.describe("Signed USD Pear fees on attributed position fills; negative values are rebates"),
27
- totalNetPnl: SignedDecimalString.describe("Gross realized plus gross unrealized plus fundingPayment minus tradeFee and pearFee in USD")
28
- });
29
- const CopySubscription = z.object({
30
- id: z.uuid(),
31
- leaderTradeAccountId: z.uuid().describe("The account being copied"),
32
- followerTradeAccountId: z.uuid().describe("The account copies land in"),
33
- connector: Connector,
34
- status: CopySubscriptionStatus,
35
- sizing: CopySizing,
36
- startSnapshot: CopyStartSnapshot.optional(),
37
- endCapture: CopyEndCaptureStatus.optional(),
38
- endReason: z.enum([
39
- "UNSUBSCRIBED",
40
- "MANUAL_TRADE",
41
- "EXTERNAL_POSITION_DETECTED",
42
- "LEADER_EXTERNAL_ACTIVITY",
43
- "FAILURE_THRESHOLD"
44
- ]).optional(),
45
- performance: CopyPerformance.optional(),
46
- ...CopySubscriptionMetrics.omit({
47
- volume: true
48
- }).partial().shape,
49
- roi: SignedDecimalString.optional().describe("Whole-subscription net PnL divided by positive starting account equity, times 100; included with complete period performance"),
50
- provisional: z.literal(true).optional(),
51
- latestFillAt: z.string().datetime().optional().describe("Latest confirmed fill included in period accounting"),
52
- createdAt: z.string().describe("ISO 8601"),
53
- endedAt: z.string().optional().describe("ISO 8601; set once the follower unsubscribed")
54
- });
55
- const CopySubscriptionWithMetrics = CopySubscription.extend({
56
- ...CopySubscriptionMetrics.shape,
57
- status: z.literal("ACTIVE")
58
- });
59
- const CopyEndedSubscriptionWithVolume = CopySubscription.extend({
60
- status: z.literal("ENDED"),
61
- volume: CopySubscriptionMetrics.shape.volume
62
- });
63
- const CopySubscriptionRead = z.discriminatedUnion("status", [
64
- CopySubscriptionWithMetrics,
65
- CopyEndedSubscriptionWithVolume
66
- ]);
67
- const CopyActivityOutcome = z.enum([
68
- "COPIED",
69
- "PARTIAL",
70
- "SKIPPED",
71
- "FAILED"
72
- ]);
73
- const CopyActivityState = z.enum([
74
- "RECORDED",
75
- "DISPATCHED",
76
- "SETTLED"
77
- ]);
78
- const CopyActivityLeg = z.object({
79
- symbol: InstrumentId,
80
- targetQuantity: SignedDecimalString,
81
- deltaQuantity: SignedDecimalString
82
- });
83
- const CopySkipReason = z.enum([
84
- "SUBSCRIPTION_NOT_ACTIVE",
85
- "POSITION_EXCLUDED",
86
- "INCLUDED_IN_JOIN",
87
- "VENUE_MISMATCH",
88
- "BELOW_VENUE_MINIMUM",
89
- "PAIR_ALREADY_ENTERED",
90
- "ENTRY_EXPIRED",
91
- "FOLLOWER_LEG_ABSENT",
92
- "LEADER_LEG_REOPENED",
93
- "NO_FOLLOWER_DELTA",
94
- "LEADER_EQUITY_UNREADABLE",
95
- "FOLLOWER_EQUITY_UNREADABLE",
96
- "PRICE_UNAVAILABLE",
97
- "LEVERAGE_NOT_APPLIED"
98
- ]);
99
- const CopyLeaderAction = z.enum([
100
- "OPEN",
101
- "ADJUST",
102
- "CLOSE",
103
- "REVERSE"
104
- ]);
105
- const CopyExecutionSource = z.discriminatedUnion("origin", [
106
- z.object({
107
- origin: z.literal("DIRECT")
108
- }),
109
- z.object({
110
- origin: z.literal("SCHEDULE"),
111
- scheduleId: z.string()
112
- }),
113
- z.object({
114
- origin: z.literal("TRIGGER"),
115
- triggerId: z.string(),
116
- triggerIntent: z.enum([
117
- "OPEN",
118
- "ADJUST",
119
- "CLOSE"
120
- ]),
121
- bracketType: z.string().optional(),
122
- ladderId: z.string().optional()
123
- }),
124
- z.object({
125
- origin: z.literal("AUTO_REBALANCE"),
126
- configId: z.string()
127
- })
128
- ]);
129
- const CopyActivity = z.object({
130
- id: z.uuid(),
131
- leaderAction: CopyLeaderAction.describe("What the leader did"),
132
- executionSource: CopyExecutionSource.optional().describe("Leader source; absent for admission position joins"),
133
- state: CopyActivityState,
134
- outcome: CopyActivityOutcome.optional().describe("Absent until dispatch work settles"),
135
- skipReason: CopySkipReason.optional().describe("Why nothing was placed; set when the outcome is SKIPPED"),
136
- failureReason: z.string().optional().describe("Why execution stopped; set when the outcome is FAILED or PARTIAL"),
137
- followerLegs: z.array(CopyActivityLeg).describe("Actual fills received by the follower"),
138
- leaderEquityFraction: z.string().optional().describe("The leader position notional over their equity at that moment; absent when unvaluable"),
139
- createdAt: z.string().describe("ISO 8601")
140
- });
141
- const CopyFollower = z.object({
142
- tradeAccountId: z.uuid(),
143
- status: z.literal("ACTIVE"),
144
- followedAt: z.string().describe("ISO 8601 subscription creation time"),
145
- xUserId: z.string().optional(),
146
- xHandle: z.string().optional(),
147
- xName: z.string().optional(),
148
- xAvatarUrl: z.string().optional()
149
- });
150
-
151
- export { CopyActivity, CopyActivityLeg, CopyActivityOutcome, CopyActivityState, CopyEndedSubscriptionWithVolume, CopyExecutionSource, CopyFollower, CopyLeaderAction, CopySizing, CopySkipReason, CopySubscription, CopySubscriptionMetrics, CopySubscriptionRead, CopySubscriptionStatus, CopySubscriptionWithMetrics };
@@ -1,5 +0,0 @@
1
- export * from './entities';
2
- export * from './payloads';
3
- export * from './performance';
4
- export * from './queries';
5
- export * from './responses';
@@ -1,8 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- const CreateCopySubscription = z.object({
4
- leaderTradeAccountId: z.uuid().describe("The account to copy"),
5
- syncExistingPositions: z.boolean().default(true).describe("Copy existing leader positions when subscribing")
6
- });
7
-
8
- export { CreateCopySubscription };
@@ -1,63 +0,0 @@
1
- import { z } from 'zod';
2
- import { SignedDecimalString } from '../common/schema';
3
-
4
- const Decimal = z.string().regex(/^[+-]?\d+(?:\.\d+)?$/);
5
- const CopyPnlBreakdown = z.object({
6
- grossRealizedPnl: SignedDecimalString,
7
- unrealizedPnl: SignedDecimalString,
8
- funding: SignedDecimalString,
9
- tradingFees: SignedDecimalString,
10
- platformFees: SignedDecimalString,
11
- netPnl: SignedDecimalString
12
- });
13
- const CopyStartingAccount = z.object({
14
- tradeAccountId: z.string(),
15
- capturedAt: z.string().datetime(),
16
- initialEquityUsd: Decimal,
17
- pnl: CopyPnlBreakdown
18
- });
19
- const CopyStartSnapshot = z.object({
20
- leader: CopyStartingAccount,
21
- follower: CopyStartingAccount
22
- });
23
- const CopyAccountPerformance = z.object({
24
- tradeAccountId: z.string(),
25
- capturedAt: z.string().datetime(),
26
- provisional: z.literal(true),
27
- latestFillAt: z.string().datetime().optional(),
28
- pnl: CopyPnlBreakdown,
29
- returnOnStartingEquityPercent: SignedDecimalString.optional()
30
- });
31
- const CopyCaptureTiming = z.literal("DELAYED");
32
- const CopyPerformance = z.object({
33
- kind: z.literal("OBSERVED"),
34
- boundaryAt: z.string().datetime(),
35
- timing: z.union([
36
- z.literal("LIVE"),
37
- CopyCaptureTiming
38
- ]),
39
- accountTimings: z.object({
40
- leader: CopyCaptureTiming,
41
- follower: CopyCaptureTiming
42
- }).optional(),
43
- leader: CopyAccountPerformance,
44
- follower: CopyAccountPerformance
45
- });
46
- const CopyEndCapture = z.object({
47
- leader: CopyAccountPerformance,
48
- follower: CopyAccountPerformance
49
- });
50
- const CopyEndCaptureStatus = z.discriminatedUnion("status", [
51
- z.object({
52
- status: z.literal("PENDING")
53
- }),
54
- z.object({
55
- status: z.literal("FAILED")
56
- }),
57
- z.object({
58
- status: z.literal("COMPLETE"),
59
- snapshot: CopyEndCapture
60
- })
61
- ]);
62
-
63
- export { CopyAccountPerformance, CopyCaptureTiming, CopyEndCapture, CopyEndCaptureStatus, CopyPerformance, CopyPnlBreakdown, CopyStartSnapshot, CopyStartingAccount };
@@ -1,20 +0,0 @@
1
- import { z } from 'zod';
2
- import { CopySubscriptionStatus } from './entities';
3
-
4
- const CopySubscriptionListQuery = z.object({
5
- status: CopySubscriptionStatus.optional()
6
- });
7
- const CopyActivityListParams = z.object({
8
- limit: z.coerce.number().int().min(1).max(200).default(50)
9
- });
10
- const CopyStatsParams = z.object({
11
- startDate: z.coerce.date().optional(),
12
- endDate: z.coerce.date().optional()
13
- }).refine((params) => !params.startDate || !params.endDate || params.startDate < params.endDate, {
14
- message: "startDate must be before endDate",
15
- path: [
16
- "startDate"
17
- ]
18
- });
19
-
20
- export { CopyActivityListParams, CopyStatsParams, CopySubscriptionListQuery };
@@ -1,89 +0,0 @@
1
- import { z } from 'zod';
2
- import { UnsignedDecimalString } from '../common/schema';
3
- import { CopySubscriptionWithMetrics, CopyFollower, CopySubscription, CopySkipReason, CopySubscriptionRead, CopyActivity, CopySubscriptionStatus } from './entities';
4
-
5
- const CopyStateResponse = z.discriminatedUnion("state", [
6
- z.object({
7
- state: z.literal("NONE")
8
- }),
9
- z.object({
10
- state: z.literal("ACTIVE"),
11
- subscription: CopySubscriptionWithMetrics
12
- })
13
- ]);
14
- const CopyFollowersResponse = z.object({
15
- followers: z.array(CopyFollower),
16
- followerCount: z.number().int().nonnegative()
17
- });
18
- const CopySubscriptionResponse = z.object({
19
- subscription: CopySubscription
20
- });
21
- const EndCopySubscriptionResponse = CopySubscriptionResponse;
22
- const CopyJoinResult = z.discriminatedUnion("outcome", [
23
- z.object({
24
- leaderPositionId: z.uuid(),
25
- outcome: z.literal("COPIED"),
26
- positionId: z.uuid()
27
- }),
28
- z.object({
29
- leaderPositionId: z.uuid(),
30
- outcome: z.literal("PARTIAL"),
31
- positionId: z.uuid(),
32
- reason: z.string()
33
- }),
34
- z.object({
35
- leaderPositionId: z.uuid(),
36
- outcome: z.literal("SKIPPED"),
37
- reason: CopySkipReason
38
- }),
39
- z.object({
40
- leaderPositionId: z.uuid(),
41
- outcome: z.literal("FAILED"),
42
- reason: z.string()
43
- }),
44
- z.object({
45
- leaderPositionId: z.uuid(),
46
- outcome: z.literal("UNCONFIRMED")
47
- })
48
- ]);
49
- const CreateCopySubscriptionResponse = CopySubscriptionResponse.extend({
50
- joinResults: z.array(CopyJoinResult)
51
- });
52
- const CopySubscriptionListResponse = z.object({
53
- subscriptions: z.array(CopySubscriptionRead)
54
- });
55
- const CopyActivityListResponse = z.object({
56
- activities: z.array(CopyActivity)
57
- });
58
- const CopyHealthResponse = z.object({
59
- status: z.enum([
60
- "ok",
61
- "degraded"
62
- ]),
63
- consumerRunning: z.boolean(),
64
- acceptanceBlocked: z.boolean().optional(),
65
- outbox: z.object({
66
- pending: z.number().int().nonnegative(),
67
- failed: z.number().int().nonnegative()
68
- }).optional()
69
- });
70
- const CopyFollowerStats = CopyFollower.pick({
71
- tradeAccountId: true,
72
- xUserId: true,
73
- xHandle: true,
74
- xName: true,
75
- xAvatarUrl: true
76
- }).extend({
77
- status: CopySubscriptionStatus,
78
- copiedTrades: z.number().int().nonnegative(),
79
- copiedVolumeUsd: UnsignedDecimalString
80
- });
81
- const CopyStatsResponse = z.object({
82
- currentFollowerCount: z.number().int().nonnegative(),
83
- lifetimeFollowerCount: z.number().int().nonnegative(),
84
- copiedTrades: z.number().int().nonnegative(),
85
- copiedVolumeUsd: UnsignedDecimalString,
86
- followers: z.array(CopyFollowerStats)
87
- });
88
-
89
- export { CopyActivityListResponse, CopyFollowerStats, CopyFollowersResponse, CopyHealthResponse, CopyJoinResult, CopyStateResponse, CopyStatsResponse, CopySubscriptionListResponse, CopySubscriptionResponse, CreateCopySubscriptionResponse, EndCopySubscriptionResponse };
@@ -1,196 +0,0 @@
1
- import { z } from 'zod';
2
- import { UnsignedDecimalString, Side } from '../common/schema';
3
- import { Connector } from '../connector';
4
- import { InstrumentId } from '../instrument';
5
- import { Order } from '../order';
6
- import { Position } from '../position';
7
-
8
- const ExecutionIntent = z.enum([
9
- "OPEN",
10
- "CLOSE",
11
- "ADJUST",
12
- "REVERSE"
13
- ]);
14
- const ExecutionOrderType = z.enum([
15
- "MARKET"
16
- ]);
17
- const ExecutionStatus = z.enum([
18
- "IDLE",
19
- "ACTIVE",
20
- "COMPLETED",
21
- "FAILED",
22
- "CANCELLED"
23
- ]);
24
- const ExecutionFulfillment = z.enum([
25
- "COMPLETE",
26
- "PARTIAL",
27
- "NONE",
28
- "PENDING"
29
- ]);
30
- const ExecutionLegMode = z.enum([
31
- "QUANTITY",
32
- "USD"
33
- ]);
34
- const ExecutionLeg = z.object({
35
- /** SYMBOL-MIGRATION switch-to-id: mirrors `symbol` today; becomes required once requests always carry `id`. */
36
- id: InstrumentId.optional(),
37
- /**
38
- * Instrument ID
39
- */
40
- symbol: InstrumentId,
41
- /**
42
- * Side
43
- */
44
- side: Side,
45
- /**
46
- * Mode to interpret the amount
47
- */
48
- mode: ExecutionLegMode,
49
- /**
50
- * Quantity or USD amount
51
- */
52
- amount: UnsignedDecimalString,
53
- /**
54
- * Optional worst acceptable execution price; replaces the slippage-derived price when present
55
- */
56
- maxImpactPrice: UnsignedDecimalString.optional(),
57
- /**
58
- * Reduce only flag
59
- */
60
- reduceOnly: z.boolean()
61
- });
62
- const BaseExecution = z.object({
63
- /**
64
- * Execution UUID
65
- */
66
- id: z.uuid(),
67
- /**
68
- * Connector
69
- */
70
- connector: Connector,
71
- /**
72
- * Intent
73
- */
74
- intent: ExecutionIntent,
75
- /**
76
- * Order type
77
- */
78
- orderType: ExecutionOrderType,
79
- /**
80
- * Status
81
- */
82
- status: ExecutionStatus,
83
- /**
84
- * Error message
85
- */
86
- error: z.string().optional(),
87
- /**
88
- * Created at timestamp
89
- */
90
- createdAt: z.string(),
91
- /**
92
- * Updated at timestamp
93
- */
94
- updatedAt: z.string(),
95
- /**
96
- * Orders
97
- */
98
- orders: z.array(Order).optional(),
99
- /**
100
- * Filled-quantity outcome across this execution's orders; absent when the server does not
101
- * publish it. It never claims venue-side certainty, only what the order rows report filled.
102
- */
103
- fulfillment: ExecutionFulfillment.optional()
104
- });
105
- const MarketOpenExecution = BaseExecution.extend({
106
- /**
107
- * Intent
108
- */
109
- intent: z.literal("OPEN"),
110
- /**
111
- * Order type
112
- */
113
- orderType: z.literal("MARKET"),
114
- /**
115
- * Position opened by this execution; absent when the position link was severed (a FAILED
116
- * execution unlinks its position). Id only: an open carries no exposure snapshot, so read
117
- * the position itself for its exposure.
118
- */
119
- position: Position.pick({
120
- id: true
121
- }).optional(),
122
- /**
123
- * Requested legs
124
- */
125
- legs: z.tuple([
126
- ExecutionLeg
127
- ]).rest(ExecutionLeg)
128
- });
129
- const MarketAdjustExecution = BaseExecution.extend({
130
- /**
131
- * Intent
132
- */
133
- intent: z.literal("ADJUST"),
134
- /**
135
- * Order type
136
- */
137
- orderType: z.literal("MARKET"),
138
- /**
139
- * Position; absent when the position link was severed (a FAILED execution unlinks its position)
140
- */
141
- position: Position.pick({
142
- id: true,
143
- exposure: true
144
- }).optional(),
145
- /**
146
- * Requested legs
147
- */
148
- legs: z.tuple([
149
- ExecutionLeg
150
- ]).rest(ExecutionLeg)
151
- });
152
- const MarketCloseExecution = BaseExecution.extend({
153
- /**
154
- * Intent
155
- */
156
- intent: z.literal("CLOSE"),
157
- /**
158
- * Order type
159
- */
160
- orderType: z.literal("MARKET"),
161
- /**
162
- * Position; absent when the position link was severed (a FAILED execution unlinks its position)
163
- */
164
- position: Position.pick({
165
- id: true,
166
- exposure: true
167
- }).optional()
168
- });
169
- const MarketReverseExecution = BaseExecution.extend({
170
- /**
171
- * Intent
172
- */
173
- intent: z.literal("REVERSE"),
174
- /**
175
- * Order type
176
- */
177
- orderType: z.literal("MARKET"),
178
- /**
179
- * Position; absent when the position link was severed (a FAILED execution unlinks its position)
180
- */
181
- position: Position.pick({
182
- id: true,
183
- exposure: true
184
- }).optional()
185
- });
186
- const MarketExecution = z.discriminatedUnion("intent", [
187
- MarketOpenExecution,
188
- MarketAdjustExecution,
189
- MarketCloseExecution,
190
- MarketReverseExecution
191
- ]);
192
- const Execution = z.discriminatedUnion("orderType", [
193
- MarketExecution
194
- ]);
195
-
196
- export { BaseExecution, Execution, ExecutionFulfillment, ExecutionIntent, ExecutionLegMode, ExecutionOrderType, ExecutionStatus, MarketAdjustExecution, MarketCloseExecution, MarketExecution, MarketOpenExecution, MarketReverseExecution };
@@ -1,3 +0,0 @@
1
- export * from './entities';
2
- export * from './queries';
3
- export * from './responses';