@pear-protocol/types 0.0.1

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 (131) hide show
  1. package/dist/auth/entities.d.ts +9 -0
  2. package/dist/auth/entities.js +8 -0
  3. package/dist/auth/index.d.ts +3 -0
  4. package/dist/auth/index.js +3 -0
  5. package/dist/auth/payloads.d.ts +50 -0
  6. package/dist/auth/payloads.js +39 -0
  7. package/dist/auth/response.d.ts +55 -0
  8. package/dist/auth/response.js +21 -0
  9. package/dist/bundle.d.ts +17 -0
  10. package/dist/bundle.js +17 -0
  11. package/dist/common/array.d.ts +10 -0
  12. package/dist/common/array.js +10 -0
  13. package/dist/common/index.d.ts +3 -0
  14. package/dist/common/index.js +3 -0
  15. package/dist/common/refinement.d.ts +20 -0
  16. package/dist/common/refinement.js +60 -0
  17. package/dist/common/request.d.ts +11 -0
  18. package/dist/common/request.js +24 -0
  19. package/dist/common/response.d.ts +12 -0
  20. package/dist/common/response.js +28 -0
  21. package/dist/common/schema.d.ts +8 -0
  22. package/dist/common/schema.js +10 -0
  23. package/dist/common/trade-legs.d.ts +34 -0
  24. package/dist/common/trade-legs.js +30 -0
  25. package/dist/connector/index.d.ts +8 -0
  26. package/dist/connector/index.js +5 -0
  27. package/dist/execution/entities.d.ts +741 -0
  28. package/dist/execution/entities.js +125 -0
  29. package/dist/execution/index.d.ts +3 -0
  30. package/dist/execution/index.js +3 -0
  31. package/dist/execution/queries.d.ts +20 -0
  32. package/dist/execution/queries.js +14 -0
  33. package/dist/execution/responses.d.ts +218 -0
  34. package/dist/execution/responses.js +9 -0
  35. package/dist/fill/entities.d.ts +25 -0
  36. package/dist/fill/entities.js +61 -0
  37. package/dist/fill/index.d.ts +3 -0
  38. package/dist/fill/index.js +3 -0
  39. package/dist/fill/queries.d.ts +13 -0
  40. package/dist/fill/queries.js +11 -0
  41. package/dist/fill/responses.d.ts +55 -0
  42. package/dist/fill/responses.js +12 -0
  43. package/dist/funding/entities.d.ts +11 -0
  44. package/dist/funding/entities.js +16 -0
  45. package/dist/funding/index.d.ts +3 -0
  46. package/dist/funding/index.js +3 -0
  47. package/dist/funding/queries.d.ts +10 -0
  48. package/dist/funding/queries.js +8 -0
  49. package/dist/funding/responses.d.ts +8 -0
  50. package/dist/funding/responses.js +11 -0
  51. package/dist/index.d.ts +2 -0
  52. package/dist/index.js +3 -0
  53. package/dist/instrument/entities.d.ts +43 -0
  54. package/dist/instrument/entities.js +48 -0
  55. package/dist/instrument/index.d.ts +3 -0
  56. package/dist/instrument/index.js +3 -0
  57. package/dist/instrument/queries.d.ts +10 -0
  58. package/dist/instrument/queries.js +8 -0
  59. package/dist/instrument/responses.d.ts +37 -0
  60. package/dist/instrument/responses.js +11 -0
  61. package/dist/instrument-precision/index.d.ts +18 -0
  62. package/dist/instrument-precision/index.js +51 -0
  63. package/dist/misc/index.d.ts +3 -0
  64. package/dist/misc/index.js +1 -0
  65. package/dist/order/entities.d.ts +73 -0
  66. package/dist/order/entities.js +73 -0
  67. package/dist/order/index.d.ts +1 -0
  68. package/dist/order/index.js +1 -0
  69. package/dist/position/entities.d.ts +53 -0
  70. package/dist/position/entities.js +55 -0
  71. package/dist/position/index.d.ts +3 -0
  72. package/dist/position/index.js +3 -0
  73. package/dist/position/queries.d.ts +16 -0
  74. package/dist/position/queries.js +28 -0
  75. package/dist/position/responses.d.ts +28 -0
  76. package/dist/position/responses.js +8 -0
  77. package/dist/price/entities.d.ts +8 -0
  78. package/dist/price/entities.js +7 -0
  79. package/dist/price/index.d.ts +3 -0
  80. package/dist/price/index.js +3 -0
  81. package/dist/price/queries.d.ts +10 -0
  82. package/dist/price/queries.js +8 -0
  83. package/dist/price/responses.d.ts +6 -0
  84. package/dist/price/responses.js +15 -0
  85. package/dist/schedule/entities.d.ts +380 -0
  86. package/dist/schedule/entities.js +159 -0
  87. package/dist/schedule/index.d.ts +4 -0
  88. package/dist/schedule/index.js +4 -0
  89. package/dist/schedule/payloads.d.ts +72 -0
  90. package/dist/schedule/payloads.js +102 -0
  91. package/dist/schedule/queries.d.ts +18 -0
  92. package/dist/schedule/queries.js +12 -0
  93. package/dist/schedule/responses.d.ts +279 -0
  94. package/dist/schedule/responses.js +10 -0
  95. package/dist/trade/index.d.ts +2 -0
  96. package/dist/trade/index.js +2 -0
  97. package/dist/trade/payloads.d.ts +217 -0
  98. package/dist/trade/payloads.js +35 -0
  99. package/dist/trade/responses.d.ts +861 -0
  100. package/dist/trade/responses.js +9 -0
  101. package/dist/trade-accounts/entities.d.ts +50 -0
  102. package/dist/trade-accounts/entities.js +18 -0
  103. package/dist/trade-accounts/index.d.ts +3 -0
  104. package/dist/trade-accounts/index.js +3 -0
  105. package/dist/trade-accounts/payloads.d.ts +137 -0
  106. package/dist/trade-accounts/payloads.js +84 -0
  107. package/dist/trade-accounts/response.d.ts +65 -0
  108. package/dist/trade-accounts/response.js +41 -0
  109. package/dist/trigger/entities/conditions.d.ts +407 -0
  110. package/dist/trigger/entities/conditions.js +239 -0
  111. package/dist/trigger/entities/index.d.ts +1549 -0
  112. package/dist/trigger/entities/index.js +123 -0
  113. package/dist/trigger/index.d.ts +6 -0
  114. package/dist/trigger/index.js +6 -0
  115. package/dist/trigger/payloads/conditions.d.ts +340 -0
  116. package/dist/trigger/payloads/conditions.js +109 -0
  117. package/dist/trigger/payloads/index.d.ts +470 -0
  118. package/dist/trigger/payloads/index.js +47 -0
  119. package/dist/trigger/queries.d.ts +18 -0
  120. package/dist/trigger/queries.js +12 -0
  121. package/dist/trigger/responses.d.ts +1001 -0
  122. package/dist/trigger/responses.js +10 -0
  123. package/dist/users/entities.d.ts +16 -0
  124. package/dist/users/entities.js +14 -0
  125. package/dist/users/index.d.ts +3 -0
  126. package/dist/users/index.js +3 -0
  127. package/dist/users/payloads.d.ts +5 -0
  128. package/dist/users/payloads.js +7 -0
  129. package/dist/users/response.d.ts +23 -0
  130. package/dist/users/response.js +12 -0
  131. package/package.json +35 -0
@@ -0,0 +1,102 @@
1
+ import { z } from 'zod';
2
+ import { UnsignedDecimalString, Side } from '../common/schema';
3
+ import { InstrumentId } from '../instrument';
4
+ import { ScheduleSliceMode } from './entities';
5
+
6
+ const SliceInterval = z.int().min(6e4).max(26784e5);
7
+ const TWAPSliceOpenLeg = z.object({
8
+ /**
9
+ * Instrument ID
10
+ */
11
+ symbol: InstrumentId,
12
+ /**
13
+ * Direction to take
14
+ */
15
+ side: Side,
16
+ /**
17
+ * Mode to interpret the step amount
18
+ * @example QUANTITY: 0.001 means 0.001 BTC units
19
+ * @example USD: 100 means $100 USD
20
+ */
21
+ mode: ScheduleSliceMode,
22
+ /**
23
+ * Step amount for each slice depending on the mode
24
+ */
25
+ stepAmount: UnsignedDecimalString
26
+ });
27
+ const TWAPSliceCloseLeg = z.object({
28
+ /**
29
+ * Instrument ID
30
+ */
31
+ symbol: InstrumentId,
32
+ /**
33
+ * Step amount for each slice in base units
34
+ */
35
+ stepAmount: UnsignedDecimalString
36
+ });
37
+ const BaseSchedule = z.object({
38
+ /**
39
+ * Start at date
40
+ */
41
+ startAt: z.coerce.date().optional().default(/* @__PURE__ */ new Date()),
42
+ /**
43
+ * End at date
44
+ */
45
+ endAt: z.coerce.date().optional().default(new Date(Date.now() + 30 * 24 * 60 * 60 * 1e3))
46
+ // 30 days from now
47
+ });
48
+ const CreateTWAPOpen = BaseSchedule.extend({
49
+ /**
50
+ * Strategy
51
+ */
52
+ strategy: z.literal("TWAP"),
53
+ /**
54
+ * Intent
55
+ */
56
+ intent: z.literal("OPEN"),
57
+ /**
58
+ * Execution type
59
+ */
60
+ executionType: z.literal("MARKET"),
61
+ /**
62
+ * Step configuration for each leg
63
+ */
64
+ sliceLegs: z.array(TWAPSliceOpenLeg),
65
+ /**
66
+ * Target notional
67
+ */
68
+ targetNotional: UnsignedDecimalString,
69
+ /**
70
+ * Slice interval in milliseconds
71
+ */
72
+ sliceIntervalMs: SliceInterval
73
+ });
74
+ const CreateTWAPClose = BaseSchedule.extend({
75
+ /**
76
+ * Strategy
77
+ */
78
+ strategy: z.literal("TWAP"),
79
+ /**
80
+ * Intent
81
+ */
82
+ intent: z.literal("CLOSE"),
83
+ /**
84
+ * Execution type
85
+ */
86
+ executionType: z.literal("MARKET"),
87
+ /**
88
+ * Step configuration for each leg
89
+ */
90
+ sliceLegs: z.array(TWAPSliceCloseLeg),
91
+ /**
92
+ * Position UUID
93
+ */
94
+ positionId: z.uuid(),
95
+ /**
96
+ * Slice interval in milliseconds
97
+ */
98
+ sliceIntervalMs: SliceInterval
99
+ });
100
+ const CreateSchedule = z.discriminatedUnion("intent", [CreateTWAPOpen, CreateTWAPClose]);
101
+
102
+ export { CreateSchedule };
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ export declare const ScheduleListParams: z.ZodObject<{
3
+ limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<number>>>;
4
+ cursor: z.ZodOptional<z.ZodString>;
5
+ connector: z.ZodOptional<z.ZodEnum<{
6
+ hyperliquid: "hyperliquid";
7
+ binanceusdm: "binanceusdm";
8
+ bybit: "bybit";
9
+ okx: "okx";
10
+ }>>;
11
+ status: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[] | (("CANCELLED" | "ACTIVE" | "COMPLETED")[] & any[]) | undefined, ("CANCELLED" | "ACTIVE" | "COMPLETED")[]>, z.ZodArray<z.ZodEnum<{
12
+ CANCELLED: "CANCELLED";
13
+ ACTIVE: "ACTIVE";
14
+ COMPLETED: "COMPLETED";
15
+ }>>>>;
16
+ }, z.core.$strip>;
17
+ export type ScheduleListParamsInput = z.input<typeof ScheduleListParams>;
18
+ export type ScheduleListParams = z.output<typeof ScheduleListParams>;
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import { normalizeArray, CursorFindParams } from '../common';
3
+ import { Connector } from '../connector';
4
+
5
+ const StatusEnum = z.enum(["ACTIVE", "COMPLETED", "CANCELLED"]);
6
+ const StatusArray = z.preprocess((arg) => normalizeArray(arg), z.array(StatusEnum));
7
+ const ScheduleListParams = CursorFindParams.extend({
8
+ connector: Connector.optional(),
9
+ status: StatusArray.optional()
10
+ });
11
+
12
+ export { ScheduleListParams };
@@ -0,0 +1,279 @@
1
+ import { z } from 'zod';
2
+ export declare const ScheduleListResponse: z.ZodObject<{
3
+ limit: z.ZodNumber;
4
+ nextCursor: z.ZodUnion<[z.ZodString, z.ZodUndefined]>;
5
+ schedules: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
6
+ id: z.ZodUUID;
7
+ connector: z.ZodEnum<{
8
+ hyperliquid: "hyperliquid";
9
+ binanceusdm: "binanceusdm";
10
+ bybit: "bybit";
11
+ okx: "okx";
12
+ }>;
13
+ status: z.ZodEnum<{
14
+ CANCELLED: "CANCELLED";
15
+ ACTIVE: "ACTIVE";
16
+ COMPLETED: "COMPLETED";
17
+ FAILED: "FAILED";
18
+ }>;
19
+ positionKey: z.ZodString;
20
+ executionType: z.ZodEnum<{
21
+ MARKET: "MARKET";
22
+ }>;
23
+ lastSliceAt: z.ZodOptional<z.ZodString>;
24
+ startAt: z.ZodString;
25
+ endAt: z.ZodString;
26
+ cancelledAt: z.ZodOptional<z.ZodString>;
27
+ cancelledReason: z.ZodOptional<z.ZodEnum<{
28
+ USER: "USER";
29
+ POSITION_CLOSED: "POSITION_CLOSED";
30
+ SYSTEM: "SYSTEM";
31
+ }>>;
32
+ createdAt: z.ZodString;
33
+ updatedAt: z.ZodString;
34
+ fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ id: z.ZodUUID;
36
+ cloid: z.ZodOptional<z.ZodUUID>;
37
+ tradeAccountId: z.ZodUUID;
38
+ symbol: z.ZodString;
39
+ positionId: z.ZodUUID;
40
+ connector: z.ZodEnum<{
41
+ hyperliquid: "hyperliquid";
42
+ binanceusdm: "binanceusdm";
43
+ bybit: "bybit";
44
+ okx: "okx";
45
+ }>;
46
+ side: z.ZodEnum<{
47
+ BUY: "BUY";
48
+ SELL: "SELL";
49
+ }>;
50
+ reduceOnly: z.ZodBoolean;
51
+ quantity: z.ZodString;
52
+ price: z.ZodString;
53
+ usd: z.ZodString;
54
+ fee: z.ZodOptional<z.ZodString>;
55
+ timestamp: z.ZodString;
56
+ }, z.core.$strip>>>;
57
+ strategy: z.ZodLiteral<"TWAP">;
58
+ intent: z.ZodLiteral<"OPEN">;
59
+ sliceIntervalMs: z.ZodNumber;
60
+ sliceLegs: z.ZodArray<z.ZodObject<{
61
+ symbol: z.ZodString;
62
+ side: z.ZodEnum<{
63
+ BUY: "BUY";
64
+ SELL: "SELL";
65
+ }>;
66
+ mode: z.ZodEnum<{
67
+ QUANTITY: "QUANTITY";
68
+ USD: "USD";
69
+ }>;
70
+ stepAmount: z.ZodString;
71
+ }, z.core.$strip>>;
72
+ targetNotional: z.ZodString;
73
+ remainingNotional: z.ZodString;
74
+ }, z.core.$strip>, z.ZodObject<{
75
+ id: z.ZodUUID;
76
+ connector: z.ZodEnum<{
77
+ hyperliquid: "hyperliquid";
78
+ binanceusdm: "binanceusdm";
79
+ bybit: "bybit";
80
+ okx: "okx";
81
+ }>;
82
+ status: z.ZodEnum<{
83
+ CANCELLED: "CANCELLED";
84
+ ACTIVE: "ACTIVE";
85
+ COMPLETED: "COMPLETED";
86
+ FAILED: "FAILED";
87
+ }>;
88
+ positionKey: z.ZodString;
89
+ executionType: z.ZodEnum<{
90
+ MARKET: "MARKET";
91
+ }>;
92
+ lastSliceAt: z.ZodOptional<z.ZodString>;
93
+ startAt: z.ZodString;
94
+ endAt: z.ZodString;
95
+ cancelledAt: z.ZodOptional<z.ZodString>;
96
+ cancelledReason: z.ZodOptional<z.ZodEnum<{
97
+ USER: "USER";
98
+ POSITION_CLOSED: "POSITION_CLOSED";
99
+ SYSTEM: "SYSTEM";
100
+ }>>;
101
+ createdAt: z.ZodString;
102
+ updatedAt: z.ZodString;
103
+ fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
104
+ id: z.ZodUUID;
105
+ cloid: z.ZodOptional<z.ZodUUID>;
106
+ tradeAccountId: z.ZodUUID;
107
+ symbol: z.ZodString;
108
+ positionId: z.ZodUUID;
109
+ connector: z.ZodEnum<{
110
+ hyperliquid: "hyperliquid";
111
+ binanceusdm: "binanceusdm";
112
+ bybit: "bybit";
113
+ okx: "okx";
114
+ }>;
115
+ side: z.ZodEnum<{
116
+ BUY: "BUY";
117
+ SELL: "SELL";
118
+ }>;
119
+ reduceOnly: z.ZodBoolean;
120
+ quantity: z.ZodString;
121
+ price: z.ZodString;
122
+ usd: z.ZodString;
123
+ fee: z.ZodOptional<z.ZodString>;
124
+ timestamp: z.ZodString;
125
+ }, z.core.$strip>>>;
126
+ strategy: z.ZodLiteral<"TWAP">;
127
+ intent: z.ZodLiteral<"CLOSE">;
128
+ sliceIntervalMs: z.ZodNumber;
129
+ positionId: z.ZodUUID;
130
+ sliceLegs: z.ZodArray<z.ZodObject<{
131
+ symbol: z.ZodString;
132
+ stepAmount: z.ZodString;
133
+ }, z.core.$strip>>;
134
+ initialExposure: z.ZodRecord<z.ZodString, z.ZodString>;
135
+ }, z.core.$strip>], "intent">>;
136
+ }, z.core.$strip>;
137
+ export type ScheduleListResponse = z.output<typeof ScheduleListResponse>;
138
+ export declare const CreateScheduleResponse: z.ZodObject<{
139
+ schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
140
+ id: z.ZodUUID;
141
+ connector: z.ZodEnum<{
142
+ hyperliquid: "hyperliquid";
143
+ binanceusdm: "binanceusdm";
144
+ bybit: "bybit";
145
+ okx: "okx";
146
+ }>;
147
+ status: z.ZodEnum<{
148
+ CANCELLED: "CANCELLED";
149
+ ACTIVE: "ACTIVE";
150
+ COMPLETED: "COMPLETED";
151
+ FAILED: "FAILED";
152
+ }>;
153
+ positionKey: z.ZodString;
154
+ executionType: z.ZodEnum<{
155
+ MARKET: "MARKET";
156
+ }>;
157
+ lastSliceAt: z.ZodOptional<z.ZodString>;
158
+ startAt: z.ZodString;
159
+ endAt: z.ZodString;
160
+ cancelledAt: z.ZodOptional<z.ZodString>;
161
+ cancelledReason: z.ZodOptional<z.ZodEnum<{
162
+ USER: "USER";
163
+ POSITION_CLOSED: "POSITION_CLOSED";
164
+ SYSTEM: "SYSTEM";
165
+ }>>;
166
+ createdAt: z.ZodString;
167
+ updatedAt: z.ZodString;
168
+ fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
169
+ id: z.ZodUUID;
170
+ cloid: z.ZodOptional<z.ZodUUID>;
171
+ tradeAccountId: z.ZodUUID;
172
+ symbol: z.ZodString;
173
+ positionId: z.ZodUUID;
174
+ connector: z.ZodEnum<{
175
+ hyperliquid: "hyperliquid";
176
+ binanceusdm: "binanceusdm";
177
+ bybit: "bybit";
178
+ okx: "okx";
179
+ }>;
180
+ side: z.ZodEnum<{
181
+ BUY: "BUY";
182
+ SELL: "SELL";
183
+ }>;
184
+ reduceOnly: z.ZodBoolean;
185
+ quantity: z.ZodString;
186
+ price: z.ZodString;
187
+ usd: z.ZodString;
188
+ fee: z.ZodOptional<z.ZodString>;
189
+ timestamp: z.ZodString;
190
+ }, z.core.$strip>>>;
191
+ strategy: z.ZodLiteral<"TWAP">;
192
+ intent: z.ZodLiteral<"OPEN">;
193
+ sliceIntervalMs: z.ZodNumber;
194
+ sliceLegs: z.ZodArray<z.ZodObject<{
195
+ symbol: z.ZodString;
196
+ side: z.ZodEnum<{
197
+ BUY: "BUY";
198
+ SELL: "SELL";
199
+ }>;
200
+ mode: z.ZodEnum<{
201
+ QUANTITY: "QUANTITY";
202
+ USD: "USD";
203
+ }>;
204
+ stepAmount: z.ZodString;
205
+ }, z.core.$strip>>;
206
+ targetNotional: z.ZodString;
207
+ remainingNotional: z.ZodString;
208
+ }, z.core.$strip>, z.ZodObject<{
209
+ id: z.ZodUUID;
210
+ connector: z.ZodEnum<{
211
+ hyperliquid: "hyperliquid";
212
+ binanceusdm: "binanceusdm";
213
+ bybit: "bybit";
214
+ okx: "okx";
215
+ }>;
216
+ status: z.ZodEnum<{
217
+ CANCELLED: "CANCELLED";
218
+ ACTIVE: "ACTIVE";
219
+ COMPLETED: "COMPLETED";
220
+ FAILED: "FAILED";
221
+ }>;
222
+ positionKey: z.ZodString;
223
+ executionType: z.ZodEnum<{
224
+ MARKET: "MARKET";
225
+ }>;
226
+ lastSliceAt: z.ZodOptional<z.ZodString>;
227
+ startAt: z.ZodString;
228
+ endAt: z.ZodString;
229
+ cancelledAt: z.ZodOptional<z.ZodString>;
230
+ cancelledReason: z.ZodOptional<z.ZodEnum<{
231
+ USER: "USER";
232
+ POSITION_CLOSED: "POSITION_CLOSED";
233
+ SYSTEM: "SYSTEM";
234
+ }>>;
235
+ createdAt: z.ZodString;
236
+ updatedAt: z.ZodString;
237
+ fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
238
+ id: z.ZodUUID;
239
+ cloid: z.ZodOptional<z.ZodUUID>;
240
+ tradeAccountId: z.ZodUUID;
241
+ symbol: z.ZodString;
242
+ positionId: z.ZodUUID;
243
+ connector: z.ZodEnum<{
244
+ hyperliquid: "hyperliquid";
245
+ binanceusdm: "binanceusdm";
246
+ bybit: "bybit";
247
+ okx: "okx";
248
+ }>;
249
+ side: z.ZodEnum<{
250
+ BUY: "BUY";
251
+ SELL: "SELL";
252
+ }>;
253
+ reduceOnly: z.ZodBoolean;
254
+ quantity: z.ZodString;
255
+ price: z.ZodString;
256
+ usd: z.ZodString;
257
+ fee: z.ZodOptional<z.ZodString>;
258
+ timestamp: z.ZodString;
259
+ }, z.core.$strip>>>;
260
+ strategy: z.ZodLiteral<"TWAP">;
261
+ intent: z.ZodLiteral<"CLOSE">;
262
+ sliceIntervalMs: z.ZodNumber;
263
+ positionId: z.ZodUUID;
264
+ sliceLegs: z.ZodArray<z.ZodObject<{
265
+ symbol: z.ZodString;
266
+ stepAmount: z.ZodString;
267
+ }, z.core.$strip>>;
268
+ initialExposure: z.ZodRecord<z.ZodString, z.ZodString>;
269
+ }, z.core.$strip>], "intent">;
270
+ }, z.core.$strip>;
271
+ export type CreateScheduleResponse = z.output<typeof CreateScheduleResponse>;
272
+ export declare const CancelScheduleResponse: z.ZodObject<{
273
+ id: z.ZodUUID;
274
+ }, z.core.$strip>;
275
+ export type CancelScheduleResponse = z.output<typeof CancelScheduleResponse>;
276
+ export declare const CancelAllSchedulesResponse: z.ZodObject<{
277
+ ids: z.ZodArray<z.ZodUUID>;
278
+ }, z.core.$strip>;
279
+ export type CancelAllSchedulesResponse = z.output<typeof CancelAllSchedulesResponse>;
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { CursorResponse } from '../common';
3
+ import { Schedule } from './entities';
4
+
5
+ const ScheduleListResponse = CursorResponse.extend({ schedules: z.array(Schedule) });
6
+ const CreateScheduleResponse = z.object({ schedule: Schedule });
7
+ const CancelScheduleResponse = z.object({ id: z.uuid() });
8
+ const CancelAllSchedulesResponse = z.object({ ids: z.array(z.uuid()) });
9
+
10
+ export { CancelAllSchedulesResponse, CancelScheduleResponse, CreateScheduleResponse, ScheduleListResponse };
@@ -0,0 +1,2 @@
1
+ export * from './payloads';
2
+ export * from './responses';
@@ -0,0 +1,2 @@
1
+ export * from './payloads';
2
+ export * from './responses';
@@ -0,0 +1,217 @@
1
+ import { z } from 'zod';
2
+ export declare const CreateMarketOpen: z.ZodObject<{
3
+ type: z.ZodLiteral<"MARKET">;
4
+ legs: z.ZodTuple<[z.ZodObject<{
5
+ symbol: z.ZodString;
6
+ side: z.ZodEnum<{
7
+ BUY: "BUY";
8
+ SELL: "SELL";
9
+ }>;
10
+ mode: z.ZodEnum<{
11
+ QUANTITY: "QUANTITY";
12
+ USD: "USD";
13
+ }>;
14
+ amount: z.ZodString;
15
+ }, z.core.$strip>], z.ZodObject<{
16
+ symbol: z.ZodString;
17
+ side: z.ZodEnum<{
18
+ BUY: "BUY";
19
+ SELL: "SELL";
20
+ }>;
21
+ mode: z.ZodEnum<{
22
+ QUANTITY: "QUANTITY";
23
+ USD: "USD";
24
+ }>;
25
+ amount: z.ZodString;
26
+ }, z.core.$strip>>;
27
+ trigger: z.ZodOptional<z.ZodObject<{
28
+ intent: z.ZodLiteral<"CLOSE">;
29
+ type: z.ZodLiteral<"MARKET">;
30
+ condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
31
+ type: z.ZodLiteral<"position_value_v1">;
32
+ data: z.ZodObject<{
33
+ priceSource: z.ZodEnum<{
34
+ mid: "mid";
35
+ mark: "mark";
36
+ }>;
37
+ direction: z.ZodEnum<{
38
+ ABOVE: "ABOVE";
39
+ BELOW: "BELOW";
40
+ }>;
41
+ threshold: z.ZodNumber;
42
+ }, z.core.$strip>;
43
+ }, z.core.$strip>, z.ZodObject<{
44
+ type: z.ZodLiteral<"position_upnl_value_v1">;
45
+ data: z.ZodObject<{
46
+ priceSource: z.ZodEnum<{
47
+ mid: "mid";
48
+ mark: "mark";
49
+ }>;
50
+ direction: z.ZodEnum<{
51
+ ABOVE: "ABOVE";
52
+ BELOW: "BELOW";
53
+ }>;
54
+ threshold: z.ZodNumber;
55
+ }, z.core.$strip>;
56
+ }, z.core.$strip>, z.ZodObject<{
57
+ type: z.ZodLiteral<"position_upnl_percentage_v1">;
58
+ data: z.ZodObject<{
59
+ priceSource: z.ZodEnum<{
60
+ mid: "mid";
61
+ mark: "mark";
62
+ }>;
63
+ direction: z.ZodEnum<{
64
+ ABOVE: "ABOVE";
65
+ BELOW: "BELOW";
66
+ }>;
67
+ threshold_bps: z.ZodNumber;
68
+ }, z.core.$strip>;
69
+ }, z.core.$strip>], "type">;
70
+ }, z.core.$strip>>;
71
+ }, z.core.$strip>;
72
+ export declare const CreateMarketAdjust: z.ZodObject<{
73
+ type: z.ZodLiteral<"MARKET">;
74
+ legs: z.ZodTuple<[z.ZodObject<{
75
+ symbol: z.ZodString;
76
+ side: z.ZodEnum<{
77
+ BUY: "BUY";
78
+ SELL: "SELL";
79
+ }>;
80
+ mode: z.ZodEnum<{
81
+ QUANTITY: "QUANTITY";
82
+ USD: "USD";
83
+ }>;
84
+ amount: z.ZodString;
85
+ reduceOnly: z.ZodBoolean;
86
+ }, z.core.$strip>], z.ZodObject<{
87
+ symbol: z.ZodString;
88
+ side: z.ZodEnum<{
89
+ BUY: "BUY";
90
+ SELL: "SELL";
91
+ }>;
92
+ mode: z.ZodEnum<{
93
+ QUANTITY: "QUANTITY";
94
+ USD: "USD";
95
+ }>;
96
+ amount: z.ZodString;
97
+ reduceOnly: z.ZodBoolean;
98
+ }, z.core.$strip>>;
99
+ }, z.core.$strip>;
100
+ export declare const CreateMarketClose: z.ZodObject<{
101
+ type: z.ZodLiteral<"MARKET">;
102
+ }, z.core.$strip>;
103
+ export declare const CreateMarketCloseAll: z.ZodObject<{
104
+ type: z.ZodLiteral<"MARKET">;
105
+ }, z.core.$strip>;
106
+ export declare const CreateTradeOpen: z.ZodDiscriminatedUnion<[z.ZodObject<{
107
+ type: z.ZodLiteral<"MARKET">;
108
+ legs: z.ZodTuple<[z.ZodObject<{
109
+ symbol: z.ZodString;
110
+ side: z.ZodEnum<{
111
+ BUY: "BUY";
112
+ SELL: "SELL";
113
+ }>;
114
+ mode: z.ZodEnum<{
115
+ QUANTITY: "QUANTITY";
116
+ USD: "USD";
117
+ }>;
118
+ amount: z.ZodString;
119
+ }, z.core.$strip>], z.ZodObject<{
120
+ symbol: z.ZodString;
121
+ side: z.ZodEnum<{
122
+ BUY: "BUY";
123
+ SELL: "SELL";
124
+ }>;
125
+ mode: z.ZodEnum<{
126
+ QUANTITY: "QUANTITY";
127
+ USD: "USD";
128
+ }>;
129
+ amount: z.ZodString;
130
+ }, z.core.$strip>>;
131
+ trigger: z.ZodOptional<z.ZodObject<{
132
+ intent: z.ZodLiteral<"CLOSE">;
133
+ type: z.ZodLiteral<"MARKET">;
134
+ condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
135
+ type: z.ZodLiteral<"position_value_v1">;
136
+ data: z.ZodObject<{
137
+ priceSource: z.ZodEnum<{
138
+ mid: "mid";
139
+ mark: "mark";
140
+ }>;
141
+ direction: z.ZodEnum<{
142
+ ABOVE: "ABOVE";
143
+ BELOW: "BELOW";
144
+ }>;
145
+ threshold: z.ZodNumber;
146
+ }, z.core.$strip>;
147
+ }, z.core.$strip>, z.ZodObject<{
148
+ type: z.ZodLiteral<"position_upnl_value_v1">;
149
+ data: z.ZodObject<{
150
+ priceSource: z.ZodEnum<{
151
+ mid: "mid";
152
+ mark: "mark";
153
+ }>;
154
+ direction: z.ZodEnum<{
155
+ ABOVE: "ABOVE";
156
+ BELOW: "BELOW";
157
+ }>;
158
+ threshold: z.ZodNumber;
159
+ }, z.core.$strip>;
160
+ }, z.core.$strip>, z.ZodObject<{
161
+ type: z.ZodLiteral<"position_upnl_percentage_v1">;
162
+ data: z.ZodObject<{
163
+ priceSource: z.ZodEnum<{
164
+ mid: "mid";
165
+ mark: "mark";
166
+ }>;
167
+ direction: z.ZodEnum<{
168
+ ABOVE: "ABOVE";
169
+ BELOW: "BELOW";
170
+ }>;
171
+ threshold_bps: z.ZodNumber;
172
+ }, z.core.$strip>;
173
+ }, z.core.$strip>], "type">;
174
+ }, z.core.$strip>>;
175
+ }, z.core.$strip>], "type">;
176
+ export declare const CreateTradeAdjust: z.ZodDiscriminatedUnion<[z.ZodObject<{
177
+ type: z.ZodLiteral<"MARKET">;
178
+ legs: z.ZodTuple<[z.ZodObject<{
179
+ symbol: z.ZodString;
180
+ side: z.ZodEnum<{
181
+ BUY: "BUY";
182
+ SELL: "SELL";
183
+ }>;
184
+ mode: z.ZodEnum<{
185
+ QUANTITY: "QUANTITY";
186
+ USD: "USD";
187
+ }>;
188
+ amount: z.ZodString;
189
+ reduceOnly: z.ZodBoolean;
190
+ }, z.core.$strip>], z.ZodObject<{
191
+ symbol: z.ZodString;
192
+ side: z.ZodEnum<{
193
+ BUY: "BUY";
194
+ SELL: "SELL";
195
+ }>;
196
+ mode: z.ZodEnum<{
197
+ QUANTITY: "QUANTITY";
198
+ USD: "USD";
199
+ }>;
200
+ amount: z.ZodString;
201
+ reduceOnly: z.ZodBoolean;
202
+ }, z.core.$strip>>;
203
+ }, z.core.$strip>], "type">;
204
+ export declare const CreateTradeClose: z.ZodDiscriminatedUnion<[z.ZodObject<{
205
+ type: z.ZodLiteral<"MARKET">;
206
+ }, z.core.$strip>], "type">;
207
+ export declare const CreateTradeCloseAll: z.ZodDiscriminatedUnion<[z.ZodObject<{
208
+ type: z.ZodLiteral<"MARKET">;
209
+ }, z.core.$strip>], "type">;
210
+ export type CreateMarketOpen = z.output<typeof CreateMarketOpen>;
211
+ export type CreateMarketAdjust = z.output<typeof CreateMarketAdjust>;
212
+ export type CreateMarketClose = z.output<typeof CreateMarketClose>;
213
+ export type CreateMarketCloseAll = z.output<typeof CreateMarketCloseAll>;
214
+ export type CreateTradeOpen = z.output<typeof CreateTradeOpen>;
215
+ export type CreateTradeAdjust = z.output<typeof CreateTradeAdjust>;
216
+ export type CreateTradeClose = z.output<typeof CreateTradeClose>;
217
+ export type CreateTradeCloseAll = z.output<typeof CreateTradeCloseAll>;
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ import { RefineMinimumOneSymbol, RefineUniqueSymbols } from '../common/refinement';
3
+ import { TradeLegPostOnly, TradeLeg } from '../common/trade-legs';
4
+ import { AttachTriggerMarketClose } from '../trigger';
5
+
6
+ const CreateMarketOpen = z.object({
7
+ type: z.literal("MARKET"),
8
+ /**
9
+ * Requested legs
10
+ */
11
+ legs: z.tuple([TradeLegPostOnly]).rest(TradeLegPostOnly).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols).describe("Array of legs to make up the exposure"),
12
+ /**
13
+ * Close trigger to attach to the execution
14
+ */
15
+ trigger: AttachTriggerMarketClose.optional()
16
+ });
17
+ const CreateMarketAdjust = z.object({
18
+ type: z.literal("MARKET"),
19
+ /**
20
+ * Requested legs
21
+ */
22
+ legs: z.tuple([TradeLeg]).rest(TradeLeg).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols).describe("Array of legs to modify the position")
23
+ });
24
+ const CreateMarketClose = z.object({
25
+ type: z.literal("MARKET")
26
+ });
27
+ const CreateMarketCloseAll = z.object({
28
+ type: z.literal("MARKET")
29
+ });
30
+ const CreateTradeOpen = z.discriminatedUnion("type", [CreateMarketOpen]);
31
+ const CreateTradeAdjust = z.discriminatedUnion("type", [CreateMarketAdjust]);
32
+ const CreateTradeClose = z.discriminatedUnion("type", [CreateMarketClose]);
33
+ const CreateTradeCloseAll = z.discriminatedUnion("type", [CreateMarketCloseAll]);
34
+
35
+ export { CreateMarketAdjust, CreateMarketClose, CreateMarketCloseAll, CreateMarketOpen, CreateTradeAdjust, CreateTradeClose, CreateTradeCloseAll, CreateTradeOpen };