@pear-protocol/types 0.0.16 → 0.0.18
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.
- package/dist/auth/entities.d.ts +10 -1
- package/dist/auth/entities.js +4 -2
- package/dist/auth/response.d.ts +13 -12
- package/dist/auth/response.js +6 -2
- package/dist/bundle.d.ts +1 -0
- package/dist/bundle.js +1 -0
- package/dist/common/address.d.ts +3 -0
- package/dist/common/address.js +5 -0
- package/dist/common/hex-string.d.ts +3 -0
- package/dist/common/hex-string.js +5 -0
- package/dist/common/refinement.d.ts +1 -0
- package/dist/common/refinement.js +9 -1
- package/dist/common/request.js +1 -1
- package/dist/common/schema.d.ts +1 -1
- package/dist/common/schema.js +1 -1
- package/dist/execution/entities.d.ts +6 -6
- package/dist/execution/responses.d.ts +2 -2
- package/dist/fill/entities.d.ts +20 -2
- package/dist/fill/entities.js +30 -5
- package/dist/fill/queries.d.ts +1 -0
- package/dist/fill/queries.js +3 -3
- package/dist/fill/responses.d.ts +46 -4
- package/dist/fill/responses.js +12 -1
- package/dist/instrument/responses.d.ts +4 -0
- package/dist/instrument/responses.js +5 -2
- package/dist/misc/index.d.ts +1 -1
- package/dist/position/entities.d.ts +5 -5
- package/dist/position/responses.d.ts +32 -2
- package/dist/position/responses.js +13 -1
- package/dist/schedule/entities.d.ts +82 -16
- package/dist/schedule/entities.js +5 -5
- package/dist/schedule/payloads.d.ts +4 -4
- package/dist/schedule/payloads.js +7 -7
- package/dist/schedule/responses.d.ts +66 -14
- package/dist/statistics/entities.d.ts +10 -3
- package/dist/statistics/entities.js +9 -3
- package/dist/statistics/queries.d.ts +26 -3
- package/dist/statistics/queries.js +11 -2
- package/dist/statistics/responses.d.ts +12 -3
- package/dist/statistics/responses.js +7 -4
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.js +2 -0
- package/dist/sync/payloads.d.ts +279 -0
- package/dist/sync/payloads.js +78 -0
- package/dist/sync/responses.d.ts +10 -0
- package/dist/sync/responses.js +11 -0
- package/dist/trade/payloads.d.ts +14 -4
- package/dist/trade/responses.d.ts +8 -8
- package/dist/trade-accounts/payloads.d.ts +13 -13
- package/dist/trade-accounts/payloads.js +7 -5
- package/dist/trigger/entities/index.d.ts +216 -46
- package/dist/trigger/entities/index.js +35 -9
- package/dist/trigger/payloads/index.d.ts +21 -6
- package/dist/trigger/payloads/index.js +24 -7
- package/dist/trigger/responses.d.ts +128 -28
- package/package.json +2 -2
|
@@ -29,6 +29,7 @@ export declare const ScheduleCancelledReason: z.ZodEnum<{
|
|
|
29
29
|
USER: "USER";
|
|
30
30
|
POSITION_CLOSED: "POSITION_CLOSED";
|
|
31
31
|
SYSTEM: "SYSTEM";
|
|
32
|
+
POSITION_NETTED: "POSITION_NETTED";
|
|
32
33
|
}>;
|
|
33
34
|
export type ScheduleCancelledReason = z.infer<typeof ScheduleCancelledReason>;
|
|
34
35
|
declare const TWAPSliceOpenLeg: z.ZodObject<{
|
|
@@ -82,12 +83,19 @@ declare const BaseSchedule: z.ZodObject<{
|
|
|
82
83
|
USER: "USER";
|
|
83
84
|
POSITION_CLOSED: "POSITION_CLOSED";
|
|
84
85
|
SYSTEM: "SYSTEM";
|
|
86
|
+
POSITION_NETTED: "POSITION_NETTED";
|
|
85
87
|
}>>;
|
|
86
88
|
createdAt: z.ZodString;
|
|
87
89
|
updatedAt: z.ZodString;
|
|
88
90
|
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
89
91
|
id: z.ZodUUID;
|
|
90
|
-
cloid: z.ZodOptional<z.
|
|
92
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
93
|
+
exchangeFillId: z.ZodOptional<z.ZodString>;
|
|
94
|
+
status: z.ZodEnum<{
|
|
95
|
+
PROVISIONAL: "PROVISIONAL";
|
|
96
|
+
CONFIRMED: "CONFIRMED";
|
|
97
|
+
RECONCILED: "RECONCILED";
|
|
98
|
+
}>;
|
|
91
99
|
tradeAccountId: z.ZodUUID;
|
|
92
100
|
symbol: z.ZodString;
|
|
93
101
|
positionId: z.ZodUUID;
|
|
@@ -103,11 +111,17 @@ declare const BaseSchedule: z.ZodObject<{
|
|
|
103
111
|
SELL: "SELL";
|
|
104
112
|
}>;
|
|
105
113
|
reduceOnly: z.ZodBoolean;
|
|
114
|
+
isExternal: z.ZodBoolean;
|
|
106
115
|
quantity: z.ZodString;
|
|
107
116
|
price: z.ZodString;
|
|
108
117
|
usd: z.ZodString;
|
|
109
|
-
|
|
118
|
+
tradeFee: z.ZodOptional<z.ZodString>;
|
|
119
|
+
pearFee: z.ZodOptional<z.ZodString>;
|
|
110
120
|
timestamp: z.ZodString;
|
|
121
|
+
original: z.ZodOptional<z.ZodObject<{
|
|
122
|
+
exchangeFillId: z.ZodString;
|
|
123
|
+
quantity: z.ZodString;
|
|
124
|
+
}, z.core.$strip>>;
|
|
111
125
|
}, z.core.$strip>>>;
|
|
112
126
|
}, z.core.$strip>;
|
|
113
127
|
export declare const TWAPOpen: z.ZodObject<{
|
|
@@ -137,12 +151,19 @@ export declare const TWAPOpen: z.ZodObject<{
|
|
|
137
151
|
USER: "USER";
|
|
138
152
|
POSITION_CLOSED: "POSITION_CLOSED";
|
|
139
153
|
SYSTEM: "SYSTEM";
|
|
154
|
+
POSITION_NETTED: "POSITION_NETTED";
|
|
140
155
|
}>>;
|
|
141
156
|
createdAt: z.ZodString;
|
|
142
157
|
updatedAt: z.ZodString;
|
|
143
158
|
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
144
159
|
id: z.ZodUUID;
|
|
145
|
-
cloid: z.ZodOptional<z.
|
|
160
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
161
|
+
exchangeFillId: z.ZodOptional<z.ZodString>;
|
|
162
|
+
status: z.ZodEnum<{
|
|
163
|
+
PROVISIONAL: "PROVISIONAL";
|
|
164
|
+
CONFIRMED: "CONFIRMED";
|
|
165
|
+
RECONCILED: "RECONCILED";
|
|
166
|
+
}>;
|
|
146
167
|
tradeAccountId: z.ZodUUID;
|
|
147
168
|
symbol: z.ZodString;
|
|
148
169
|
positionId: z.ZodUUID;
|
|
@@ -158,15 +179,21 @@ export declare const TWAPOpen: z.ZodObject<{
|
|
|
158
179
|
SELL: "SELL";
|
|
159
180
|
}>;
|
|
160
181
|
reduceOnly: z.ZodBoolean;
|
|
182
|
+
isExternal: z.ZodBoolean;
|
|
161
183
|
quantity: z.ZodString;
|
|
162
184
|
price: z.ZodString;
|
|
163
185
|
usd: z.ZodString;
|
|
164
|
-
|
|
186
|
+
tradeFee: z.ZodOptional<z.ZodString>;
|
|
187
|
+
pearFee: z.ZodOptional<z.ZodString>;
|
|
165
188
|
timestamp: z.ZodString;
|
|
189
|
+
original: z.ZodOptional<z.ZodObject<{
|
|
190
|
+
exchangeFillId: z.ZodString;
|
|
191
|
+
quantity: z.ZodString;
|
|
192
|
+
}, z.core.$strip>>;
|
|
166
193
|
}, z.core.$strip>>>;
|
|
167
194
|
strategy: z.ZodLiteral<"TWAP">;
|
|
168
195
|
intent: z.ZodLiteral<"OPEN">;
|
|
169
|
-
|
|
196
|
+
sliceIntervalSec: z.ZodNumber;
|
|
170
197
|
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
171
198
|
symbol: z.ZodString;
|
|
172
199
|
side: z.ZodEnum<{
|
|
@@ -209,12 +236,19 @@ export declare const TWAPClose: z.ZodObject<{
|
|
|
209
236
|
USER: "USER";
|
|
210
237
|
POSITION_CLOSED: "POSITION_CLOSED";
|
|
211
238
|
SYSTEM: "SYSTEM";
|
|
239
|
+
POSITION_NETTED: "POSITION_NETTED";
|
|
212
240
|
}>>;
|
|
213
241
|
createdAt: z.ZodString;
|
|
214
242
|
updatedAt: z.ZodString;
|
|
215
243
|
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
216
244
|
id: z.ZodUUID;
|
|
217
|
-
cloid: z.ZodOptional<z.
|
|
245
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
246
|
+
exchangeFillId: z.ZodOptional<z.ZodString>;
|
|
247
|
+
status: z.ZodEnum<{
|
|
248
|
+
PROVISIONAL: "PROVISIONAL";
|
|
249
|
+
CONFIRMED: "CONFIRMED";
|
|
250
|
+
RECONCILED: "RECONCILED";
|
|
251
|
+
}>;
|
|
218
252
|
tradeAccountId: z.ZodUUID;
|
|
219
253
|
symbol: z.ZodString;
|
|
220
254
|
positionId: z.ZodUUID;
|
|
@@ -230,21 +264,27 @@ export declare const TWAPClose: z.ZodObject<{
|
|
|
230
264
|
SELL: "SELL";
|
|
231
265
|
}>;
|
|
232
266
|
reduceOnly: z.ZodBoolean;
|
|
267
|
+
isExternal: z.ZodBoolean;
|
|
233
268
|
quantity: z.ZodString;
|
|
234
269
|
price: z.ZodString;
|
|
235
270
|
usd: z.ZodString;
|
|
236
|
-
|
|
271
|
+
tradeFee: z.ZodOptional<z.ZodString>;
|
|
272
|
+
pearFee: z.ZodOptional<z.ZodString>;
|
|
237
273
|
timestamp: z.ZodString;
|
|
274
|
+
original: z.ZodOptional<z.ZodObject<{
|
|
275
|
+
exchangeFillId: z.ZodString;
|
|
276
|
+
quantity: z.ZodString;
|
|
277
|
+
}, z.core.$strip>>;
|
|
238
278
|
}, z.core.$strip>>>;
|
|
239
279
|
strategy: z.ZodLiteral<"TWAP">;
|
|
240
280
|
intent: z.ZodLiteral<"CLOSE">;
|
|
241
|
-
|
|
281
|
+
sliceIntervalSec: z.ZodNumber;
|
|
242
282
|
positionId: z.ZodUUID;
|
|
243
283
|
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
244
284
|
symbol: z.ZodString;
|
|
245
285
|
stepAmount: z.ZodString;
|
|
246
286
|
}, z.core.$strip>>;
|
|
247
|
-
initialExposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
287
|
+
initialExposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
248
288
|
}, z.core.$strip>;
|
|
249
289
|
export declare const Schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
250
290
|
id: z.ZodUUID;
|
|
@@ -273,12 +313,19 @@ export declare const Schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
273
313
|
USER: "USER";
|
|
274
314
|
POSITION_CLOSED: "POSITION_CLOSED";
|
|
275
315
|
SYSTEM: "SYSTEM";
|
|
316
|
+
POSITION_NETTED: "POSITION_NETTED";
|
|
276
317
|
}>>;
|
|
277
318
|
createdAt: z.ZodString;
|
|
278
319
|
updatedAt: z.ZodString;
|
|
279
320
|
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
280
321
|
id: z.ZodUUID;
|
|
281
|
-
cloid: z.ZodOptional<z.
|
|
322
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
323
|
+
exchangeFillId: z.ZodOptional<z.ZodString>;
|
|
324
|
+
status: z.ZodEnum<{
|
|
325
|
+
PROVISIONAL: "PROVISIONAL";
|
|
326
|
+
CONFIRMED: "CONFIRMED";
|
|
327
|
+
RECONCILED: "RECONCILED";
|
|
328
|
+
}>;
|
|
282
329
|
tradeAccountId: z.ZodUUID;
|
|
283
330
|
symbol: z.ZodString;
|
|
284
331
|
positionId: z.ZodUUID;
|
|
@@ -294,15 +341,21 @@ export declare const Schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
294
341
|
SELL: "SELL";
|
|
295
342
|
}>;
|
|
296
343
|
reduceOnly: z.ZodBoolean;
|
|
344
|
+
isExternal: z.ZodBoolean;
|
|
297
345
|
quantity: z.ZodString;
|
|
298
346
|
price: z.ZodString;
|
|
299
347
|
usd: z.ZodString;
|
|
300
|
-
|
|
348
|
+
tradeFee: z.ZodOptional<z.ZodString>;
|
|
349
|
+
pearFee: z.ZodOptional<z.ZodString>;
|
|
301
350
|
timestamp: z.ZodString;
|
|
351
|
+
original: z.ZodOptional<z.ZodObject<{
|
|
352
|
+
exchangeFillId: z.ZodString;
|
|
353
|
+
quantity: z.ZodString;
|
|
354
|
+
}, z.core.$strip>>;
|
|
302
355
|
}, z.core.$strip>>>;
|
|
303
356
|
strategy: z.ZodLiteral<"TWAP">;
|
|
304
357
|
intent: z.ZodLiteral<"OPEN">;
|
|
305
|
-
|
|
358
|
+
sliceIntervalSec: z.ZodNumber;
|
|
306
359
|
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
307
360
|
symbol: z.ZodString;
|
|
308
361
|
side: z.ZodEnum<{
|
|
@@ -344,12 +397,19 @@ export declare const Schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
344
397
|
USER: "USER";
|
|
345
398
|
POSITION_CLOSED: "POSITION_CLOSED";
|
|
346
399
|
SYSTEM: "SYSTEM";
|
|
400
|
+
POSITION_NETTED: "POSITION_NETTED";
|
|
347
401
|
}>>;
|
|
348
402
|
createdAt: z.ZodString;
|
|
349
403
|
updatedAt: z.ZodString;
|
|
350
404
|
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
351
405
|
id: z.ZodUUID;
|
|
352
|
-
cloid: z.ZodOptional<z.
|
|
406
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
407
|
+
exchangeFillId: z.ZodOptional<z.ZodString>;
|
|
408
|
+
status: z.ZodEnum<{
|
|
409
|
+
PROVISIONAL: "PROVISIONAL";
|
|
410
|
+
CONFIRMED: "CONFIRMED";
|
|
411
|
+
RECONCILED: "RECONCILED";
|
|
412
|
+
}>;
|
|
353
413
|
tradeAccountId: z.ZodUUID;
|
|
354
414
|
symbol: z.ZodString;
|
|
355
415
|
positionId: z.ZodUUID;
|
|
@@ -365,21 +425,27 @@ export declare const Schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
365
425
|
SELL: "SELL";
|
|
366
426
|
}>;
|
|
367
427
|
reduceOnly: z.ZodBoolean;
|
|
428
|
+
isExternal: z.ZodBoolean;
|
|
368
429
|
quantity: z.ZodString;
|
|
369
430
|
price: z.ZodString;
|
|
370
431
|
usd: z.ZodString;
|
|
371
|
-
|
|
432
|
+
tradeFee: z.ZodOptional<z.ZodString>;
|
|
433
|
+
pearFee: z.ZodOptional<z.ZodString>;
|
|
372
434
|
timestamp: z.ZodString;
|
|
435
|
+
original: z.ZodOptional<z.ZodObject<{
|
|
436
|
+
exchangeFillId: z.ZodString;
|
|
437
|
+
quantity: z.ZodString;
|
|
438
|
+
}, z.core.$strip>>;
|
|
373
439
|
}, z.core.$strip>>>;
|
|
374
440
|
strategy: z.ZodLiteral<"TWAP">;
|
|
375
441
|
intent: z.ZodLiteral<"CLOSE">;
|
|
376
|
-
|
|
442
|
+
sliceIntervalSec: z.ZodNumber;
|
|
377
443
|
positionId: z.ZodUUID;
|
|
378
444
|
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
379
445
|
symbol: z.ZodString;
|
|
380
446
|
stepAmount: z.ZodString;
|
|
381
447
|
}, z.core.$strip>>;
|
|
382
|
-
initialExposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
448
|
+
initialExposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
383
449
|
}, z.core.$strip>], "intent">;
|
|
384
450
|
export type TWAPSliceOpenLeg = z.output<typeof TWAPSliceOpenLeg>;
|
|
385
451
|
export type TWAPSliceCloseLeg = z.output<typeof TWAPSliceCloseLeg>;
|
|
@@ -9,7 +9,7 @@ const ScheduleStatus = z.enum(["ACTIVE", "COMPLETED", "FAILED", "CANCELLED"]);
|
|
|
9
9
|
const ScheduleIntent = z.enum(["OPEN", "CLOSE"]);
|
|
10
10
|
const ScheduleExecutionType = z.enum(["MARKET"]);
|
|
11
11
|
const ScheduleSliceMode = z.enum(["QUANTITY", "USD"]);
|
|
12
|
-
const ScheduleCancelledReason = z.enum(["POSITION_CLOSED", "USER", "SYSTEM"]);
|
|
12
|
+
const ScheduleCancelledReason = z.enum(["POSITION_CLOSED", "USER", "SYSTEM", "POSITION_NETTED"]);
|
|
13
13
|
const TWAPSliceOpenLeg = z.object({
|
|
14
14
|
/**
|
|
15
15
|
* Instrument ID
|
|
@@ -112,9 +112,9 @@ const TWAPOpen = BaseSchedule.extend({
|
|
|
112
112
|
*/
|
|
113
113
|
intent: z.literal("OPEN"),
|
|
114
114
|
/**
|
|
115
|
-
* Slice interval in
|
|
115
|
+
* Slice interval in seconds
|
|
116
116
|
*/
|
|
117
|
-
|
|
117
|
+
sliceIntervalSec: z.number(),
|
|
118
118
|
/**
|
|
119
119
|
* Slice legs
|
|
120
120
|
*/
|
|
@@ -138,9 +138,9 @@ const TWAPClose = BaseSchedule.extend({
|
|
|
138
138
|
*/
|
|
139
139
|
intent: z.literal("CLOSE"),
|
|
140
140
|
/**
|
|
141
|
-
* Slice interval in
|
|
141
|
+
* Slice interval in seconds
|
|
142
142
|
*/
|
|
143
|
-
|
|
143
|
+
sliceIntervalSec: z.number(),
|
|
144
144
|
/**
|
|
145
145
|
* Position UUID
|
|
146
146
|
*/
|
|
@@ -18,7 +18,7 @@ declare const CreateTWAPOpen: z.ZodObject<{
|
|
|
18
18
|
stepAmount: z.ZodString;
|
|
19
19
|
}, z.core.$strip>>;
|
|
20
20
|
targetNotional: z.ZodString;
|
|
21
|
-
|
|
21
|
+
sliceIntervalSec: z.ZodInt;
|
|
22
22
|
}, z.core.$strip>;
|
|
23
23
|
declare const CreateTWAPClose: z.ZodObject<{
|
|
24
24
|
startAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
|
|
@@ -31,7 +31,7 @@ declare const CreateTWAPClose: z.ZodObject<{
|
|
|
31
31
|
stepAmount: z.ZodString;
|
|
32
32
|
}, z.core.$strip>>;
|
|
33
33
|
positionId: z.ZodUUID;
|
|
34
|
-
|
|
34
|
+
sliceIntervalSec: z.ZodInt;
|
|
35
35
|
}, z.core.$strip>;
|
|
36
36
|
export declare const CreateSchedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
37
37
|
startAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
|
|
@@ -52,7 +52,7 @@ export declare const CreateSchedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
52
52
|
stepAmount: z.ZodString;
|
|
53
53
|
}, z.core.$strip>>;
|
|
54
54
|
targetNotional: z.ZodString;
|
|
55
|
-
|
|
55
|
+
sliceIntervalSec: z.ZodInt;
|
|
56
56
|
}, z.core.$strip>, z.ZodObject<{
|
|
57
57
|
startAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
|
|
58
58
|
endAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
|
|
@@ -64,7 +64,7 @@ export declare const CreateSchedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
64
64
|
stepAmount: z.ZodString;
|
|
65
65
|
}, z.core.$strip>>;
|
|
66
66
|
positionId: z.ZodUUID;
|
|
67
|
-
|
|
67
|
+
sliceIntervalSec: z.ZodInt;
|
|
68
68
|
}, z.core.$strip>], "intent">;
|
|
69
69
|
export type CreateTWAPOpen = z.output<typeof CreateTWAPOpen>;
|
|
70
70
|
export type CreateTWAPClose = z.output<typeof CreateTWAPClose>;
|
|
@@ -3,10 +3,10 @@ import { UnsignedDecimalString, Side } from '../common/schema';
|
|
|
3
3
|
import { InstrumentId } from '../instrument';
|
|
4
4
|
import { ScheduleSliceMode } from './entities';
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const THIRTY_ONE_DAYS_SEC = 60 * 60 * 24 * 31;
|
|
7
|
+
const SliceIntervalSec = z.int().min(15).max(THIRTY_ONE_DAYS_SEC);
|
|
8
8
|
const DefaultStartAt = z.coerce.date().optional().transform((value) => value ?? /* @__PURE__ */ new Date());
|
|
9
|
-
const DefaultEndAt = z.coerce.date().optional().transform((value) => value ?? new Date(Date.now() +
|
|
9
|
+
const DefaultEndAt = z.coerce.date().optional().transform((value) => value ?? new Date(Date.now() + THIRTY_ONE_DAYS_SEC * 1e3));
|
|
10
10
|
const TWAPSliceOpenLeg = z.object({
|
|
11
11
|
/**
|
|
12
12
|
* Instrument ID
|
|
@@ -71,9 +71,9 @@ const CreateTWAPOpen = BaseSchedule.safeExtend({
|
|
|
71
71
|
*/
|
|
72
72
|
targetNotional: UnsignedDecimalString,
|
|
73
73
|
/**
|
|
74
|
-
* Slice interval in
|
|
74
|
+
* Slice interval in seconds
|
|
75
75
|
*/
|
|
76
|
-
|
|
76
|
+
sliceIntervalSec: SliceIntervalSec
|
|
77
77
|
});
|
|
78
78
|
const CreateTWAPClose = BaseSchedule.safeExtend({
|
|
79
79
|
/**
|
|
@@ -97,9 +97,9 @@ const CreateTWAPClose = BaseSchedule.safeExtend({
|
|
|
97
97
|
*/
|
|
98
98
|
positionId: z.uuid(),
|
|
99
99
|
/**
|
|
100
|
-
* Slice interval in
|
|
100
|
+
* Slice interval in seconds
|
|
101
101
|
*/
|
|
102
|
-
|
|
102
|
+
sliceIntervalSec: SliceIntervalSec
|
|
103
103
|
});
|
|
104
104
|
const CreateSchedule = z.discriminatedUnion("intent", [CreateTWAPOpen, CreateTWAPClose]);
|
|
105
105
|
|
|
@@ -29,12 +29,19 @@ export declare const ScheduleListResponse: z.ZodObject<{
|
|
|
29
29
|
USER: "USER";
|
|
30
30
|
POSITION_CLOSED: "POSITION_CLOSED";
|
|
31
31
|
SYSTEM: "SYSTEM";
|
|
32
|
+
POSITION_NETTED: "POSITION_NETTED";
|
|
32
33
|
}>>;
|
|
33
34
|
createdAt: z.ZodString;
|
|
34
35
|
updatedAt: z.ZodString;
|
|
35
36
|
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
36
37
|
id: z.ZodUUID;
|
|
37
|
-
cloid: z.ZodOptional<z.
|
|
38
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
39
|
+
exchangeFillId: z.ZodOptional<z.ZodString>;
|
|
40
|
+
status: z.ZodEnum<{
|
|
41
|
+
PROVISIONAL: "PROVISIONAL";
|
|
42
|
+
CONFIRMED: "CONFIRMED";
|
|
43
|
+
RECONCILED: "RECONCILED";
|
|
44
|
+
}>;
|
|
38
45
|
tradeAccountId: z.ZodUUID;
|
|
39
46
|
symbol: z.ZodString;
|
|
40
47
|
positionId: z.ZodUUID;
|
|
@@ -50,15 +57,21 @@ export declare const ScheduleListResponse: z.ZodObject<{
|
|
|
50
57
|
SELL: "SELL";
|
|
51
58
|
}>;
|
|
52
59
|
reduceOnly: z.ZodBoolean;
|
|
60
|
+
isExternal: z.ZodBoolean;
|
|
53
61
|
quantity: z.ZodString;
|
|
54
62
|
price: z.ZodString;
|
|
55
63
|
usd: z.ZodString;
|
|
56
|
-
|
|
64
|
+
tradeFee: z.ZodOptional<z.ZodString>;
|
|
65
|
+
pearFee: z.ZodOptional<z.ZodString>;
|
|
57
66
|
timestamp: z.ZodString;
|
|
67
|
+
original: z.ZodOptional<z.ZodObject<{
|
|
68
|
+
exchangeFillId: z.ZodString;
|
|
69
|
+
quantity: z.ZodString;
|
|
70
|
+
}, z.core.$strip>>;
|
|
58
71
|
}, z.core.$strip>>>;
|
|
59
72
|
strategy: z.ZodLiteral<"TWAP">;
|
|
60
73
|
intent: z.ZodLiteral<"OPEN">;
|
|
61
|
-
|
|
74
|
+
sliceIntervalSec: z.ZodNumber;
|
|
62
75
|
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
63
76
|
symbol: z.ZodString;
|
|
64
77
|
side: z.ZodEnum<{
|
|
@@ -100,12 +113,19 @@ export declare const ScheduleListResponse: z.ZodObject<{
|
|
|
100
113
|
USER: "USER";
|
|
101
114
|
POSITION_CLOSED: "POSITION_CLOSED";
|
|
102
115
|
SYSTEM: "SYSTEM";
|
|
116
|
+
POSITION_NETTED: "POSITION_NETTED";
|
|
103
117
|
}>>;
|
|
104
118
|
createdAt: z.ZodString;
|
|
105
119
|
updatedAt: z.ZodString;
|
|
106
120
|
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
107
121
|
id: z.ZodUUID;
|
|
108
|
-
cloid: z.ZodOptional<z.
|
|
122
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
123
|
+
exchangeFillId: z.ZodOptional<z.ZodString>;
|
|
124
|
+
status: z.ZodEnum<{
|
|
125
|
+
PROVISIONAL: "PROVISIONAL";
|
|
126
|
+
CONFIRMED: "CONFIRMED";
|
|
127
|
+
RECONCILED: "RECONCILED";
|
|
128
|
+
}>;
|
|
109
129
|
tradeAccountId: z.ZodUUID;
|
|
110
130
|
symbol: z.ZodString;
|
|
111
131
|
positionId: z.ZodUUID;
|
|
@@ -121,21 +141,27 @@ export declare const ScheduleListResponse: z.ZodObject<{
|
|
|
121
141
|
SELL: "SELL";
|
|
122
142
|
}>;
|
|
123
143
|
reduceOnly: z.ZodBoolean;
|
|
144
|
+
isExternal: z.ZodBoolean;
|
|
124
145
|
quantity: z.ZodString;
|
|
125
146
|
price: z.ZodString;
|
|
126
147
|
usd: z.ZodString;
|
|
127
|
-
|
|
148
|
+
tradeFee: z.ZodOptional<z.ZodString>;
|
|
149
|
+
pearFee: z.ZodOptional<z.ZodString>;
|
|
128
150
|
timestamp: z.ZodString;
|
|
151
|
+
original: z.ZodOptional<z.ZodObject<{
|
|
152
|
+
exchangeFillId: z.ZodString;
|
|
153
|
+
quantity: z.ZodString;
|
|
154
|
+
}, z.core.$strip>>;
|
|
129
155
|
}, z.core.$strip>>>;
|
|
130
156
|
strategy: z.ZodLiteral<"TWAP">;
|
|
131
157
|
intent: z.ZodLiteral<"CLOSE">;
|
|
132
|
-
|
|
158
|
+
sliceIntervalSec: z.ZodNumber;
|
|
133
159
|
positionId: z.ZodUUID;
|
|
134
160
|
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
135
161
|
symbol: z.ZodString;
|
|
136
162
|
stepAmount: z.ZodString;
|
|
137
163
|
}, z.core.$strip>>;
|
|
138
|
-
initialExposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
164
|
+
initialExposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
139
165
|
}, z.core.$strip>], "intent">>;
|
|
140
166
|
}, z.core.$strip>;
|
|
141
167
|
export type ScheduleListResponse = z.output<typeof ScheduleListResponse>;
|
|
@@ -167,12 +193,19 @@ export declare const CreateScheduleResponse: z.ZodObject<{
|
|
|
167
193
|
USER: "USER";
|
|
168
194
|
POSITION_CLOSED: "POSITION_CLOSED";
|
|
169
195
|
SYSTEM: "SYSTEM";
|
|
196
|
+
POSITION_NETTED: "POSITION_NETTED";
|
|
170
197
|
}>>;
|
|
171
198
|
createdAt: z.ZodString;
|
|
172
199
|
updatedAt: z.ZodString;
|
|
173
200
|
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
174
201
|
id: z.ZodUUID;
|
|
175
|
-
cloid: z.ZodOptional<z.
|
|
202
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
203
|
+
exchangeFillId: z.ZodOptional<z.ZodString>;
|
|
204
|
+
status: z.ZodEnum<{
|
|
205
|
+
PROVISIONAL: "PROVISIONAL";
|
|
206
|
+
CONFIRMED: "CONFIRMED";
|
|
207
|
+
RECONCILED: "RECONCILED";
|
|
208
|
+
}>;
|
|
176
209
|
tradeAccountId: z.ZodUUID;
|
|
177
210
|
symbol: z.ZodString;
|
|
178
211
|
positionId: z.ZodUUID;
|
|
@@ -188,15 +221,21 @@ export declare const CreateScheduleResponse: z.ZodObject<{
|
|
|
188
221
|
SELL: "SELL";
|
|
189
222
|
}>;
|
|
190
223
|
reduceOnly: z.ZodBoolean;
|
|
224
|
+
isExternal: z.ZodBoolean;
|
|
191
225
|
quantity: z.ZodString;
|
|
192
226
|
price: z.ZodString;
|
|
193
227
|
usd: z.ZodString;
|
|
194
|
-
|
|
228
|
+
tradeFee: z.ZodOptional<z.ZodString>;
|
|
229
|
+
pearFee: z.ZodOptional<z.ZodString>;
|
|
195
230
|
timestamp: z.ZodString;
|
|
231
|
+
original: z.ZodOptional<z.ZodObject<{
|
|
232
|
+
exchangeFillId: z.ZodString;
|
|
233
|
+
quantity: z.ZodString;
|
|
234
|
+
}, z.core.$strip>>;
|
|
196
235
|
}, z.core.$strip>>>;
|
|
197
236
|
strategy: z.ZodLiteral<"TWAP">;
|
|
198
237
|
intent: z.ZodLiteral<"OPEN">;
|
|
199
|
-
|
|
238
|
+
sliceIntervalSec: z.ZodNumber;
|
|
200
239
|
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
201
240
|
symbol: z.ZodString;
|
|
202
241
|
side: z.ZodEnum<{
|
|
@@ -238,12 +277,19 @@ export declare const CreateScheduleResponse: z.ZodObject<{
|
|
|
238
277
|
USER: "USER";
|
|
239
278
|
POSITION_CLOSED: "POSITION_CLOSED";
|
|
240
279
|
SYSTEM: "SYSTEM";
|
|
280
|
+
POSITION_NETTED: "POSITION_NETTED";
|
|
241
281
|
}>>;
|
|
242
282
|
createdAt: z.ZodString;
|
|
243
283
|
updatedAt: z.ZodString;
|
|
244
284
|
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
245
285
|
id: z.ZodUUID;
|
|
246
|
-
cloid: z.ZodOptional<z.
|
|
286
|
+
cloid: z.ZodOptional<z.ZodString>;
|
|
287
|
+
exchangeFillId: z.ZodOptional<z.ZodString>;
|
|
288
|
+
status: z.ZodEnum<{
|
|
289
|
+
PROVISIONAL: "PROVISIONAL";
|
|
290
|
+
CONFIRMED: "CONFIRMED";
|
|
291
|
+
RECONCILED: "RECONCILED";
|
|
292
|
+
}>;
|
|
247
293
|
tradeAccountId: z.ZodUUID;
|
|
248
294
|
symbol: z.ZodString;
|
|
249
295
|
positionId: z.ZodUUID;
|
|
@@ -259,21 +305,27 @@ export declare const CreateScheduleResponse: z.ZodObject<{
|
|
|
259
305
|
SELL: "SELL";
|
|
260
306
|
}>;
|
|
261
307
|
reduceOnly: z.ZodBoolean;
|
|
308
|
+
isExternal: z.ZodBoolean;
|
|
262
309
|
quantity: z.ZodString;
|
|
263
310
|
price: z.ZodString;
|
|
264
311
|
usd: z.ZodString;
|
|
265
|
-
|
|
312
|
+
tradeFee: z.ZodOptional<z.ZodString>;
|
|
313
|
+
pearFee: z.ZodOptional<z.ZodString>;
|
|
266
314
|
timestamp: z.ZodString;
|
|
315
|
+
original: z.ZodOptional<z.ZodObject<{
|
|
316
|
+
exchangeFillId: z.ZodString;
|
|
317
|
+
quantity: z.ZodString;
|
|
318
|
+
}, z.core.$strip>>;
|
|
267
319
|
}, z.core.$strip>>>;
|
|
268
320
|
strategy: z.ZodLiteral<"TWAP">;
|
|
269
321
|
intent: z.ZodLiteral<"CLOSE">;
|
|
270
|
-
|
|
322
|
+
sliceIntervalSec: z.ZodNumber;
|
|
271
323
|
positionId: z.ZodUUID;
|
|
272
324
|
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
273
325
|
symbol: z.ZodString;
|
|
274
326
|
stepAmount: z.ZodString;
|
|
275
327
|
}, z.core.$strip>>;
|
|
276
|
-
initialExposure: z.ZodRecord<z.ZodString, z.ZodString
|
|
328
|
+
initialExposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
277
329
|
}, z.core.$strip>], "intent">;
|
|
278
330
|
}, z.core.$strip>;
|
|
279
331
|
export type CreateScheduleResponse = z.output<typeof CreateScheduleResponse>;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
2
|
+
export declare const VolumeStatistics: z.ZodObject<{
|
|
3
|
+
timestamp: z.ZodNumber;
|
|
4
4
|
volume: z.ZodNumber;
|
|
5
5
|
fees: z.ZodNumber;
|
|
6
|
+
trades: z.ZodNumber;
|
|
6
7
|
users: z.ZodNumber;
|
|
7
8
|
newUsers: z.ZodNumber;
|
|
8
9
|
}, z.core.$strip>;
|
|
9
|
-
export type
|
|
10
|
+
export type VolumeStatistics = z.output<typeof VolumeStatistics>;
|
|
11
|
+
export declare const OiStatistics: z.ZodObject<{
|
|
12
|
+
timestamp: z.ZodNumber;
|
|
13
|
+
openInterest: z.ZodNumber;
|
|
14
|
+
openPositions: z.ZodNumber;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type OiStatistics = z.output<typeof OiStatistics>;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
3
|
+
const VolumeStatistics = z.object({
|
|
4
|
+
timestamp: z.number(),
|
|
5
5
|
volume: z.number(),
|
|
6
6
|
fees: z.number(),
|
|
7
|
+
trades: z.number(),
|
|
7
8
|
users: z.number(),
|
|
8
9
|
newUsers: z.number()
|
|
9
10
|
});
|
|
11
|
+
const OiStatistics = z.object({
|
|
12
|
+
timestamp: z.number(),
|
|
13
|
+
openInterest: z.number(),
|
|
14
|
+
openPositions: z.number()
|
|
15
|
+
});
|
|
10
16
|
|
|
11
|
-
export {
|
|
17
|
+
export { OiStatistics, VolumeStatistics };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const VolumeStatisticsQueryParams: z.ZodObject<{
|
|
3
3
|
connector: z.ZodEnum<{
|
|
4
4
|
hyperliquid: "hyperliquid";
|
|
5
5
|
binance: "binance";
|
|
@@ -7,8 +7,31 @@ export declare const DailyStatisticsQueryParams: z.ZodObject<{
|
|
|
7
7
|
okx: "okx";
|
|
8
8
|
lighter: "lighter";
|
|
9
9
|
}>;
|
|
10
|
+
resolution: z.ZodEnum<{
|
|
11
|
+
"1h": "1h";
|
|
12
|
+
"4h": "4h";
|
|
13
|
+
"24h": "24h";
|
|
14
|
+
}>;
|
|
15
|
+
startDate: z.ZodOptional<z.ZodCoercedDate<Date>>;
|
|
16
|
+
endDate: z.ZodDefault<z.ZodCoercedDate<Date>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type VolumeStatisticsQueryParamsInput = z.input<typeof VolumeStatisticsQueryParams>;
|
|
19
|
+
export type VolumeStatisticsQueryParams = z.output<typeof VolumeStatisticsQueryParams>;
|
|
20
|
+
export declare const OiStatisticsQueryParams: z.ZodObject<{
|
|
21
|
+
connector: z.ZodEnum<{
|
|
22
|
+
hyperliquid: "hyperliquid";
|
|
23
|
+
binance: "binance";
|
|
24
|
+
bybit: "bybit";
|
|
25
|
+
okx: "okx";
|
|
26
|
+
lighter: "lighter";
|
|
27
|
+
}>;
|
|
28
|
+
resolution: z.ZodEnum<{
|
|
29
|
+
"1h": "1h";
|
|
30
|
+
"4h": "4h";
|
|
31
|
+
"24h": "24h";
|
|
32
|
+
}>;
|
|
10
33
|
startDate: z.ZodOptional<z.ZodCoercedDate<Date>>;
|
|
11
34
|
endDate: z.ZodDefault<z.ZodCoercedDate<Date>>;
|
|
12
35
|
}, z.core.$strip>;
|
|
13
|
-
export type
|
|
14
|
-
export type
|
|
36
|
+
export type OiStatisticsQueryParamsInput = z.input<typeof OiStatisticsQueryParams>;
|
|
37
|
+
export type OiStatisticsQueryParams = z.output<typeof OiStatisticsQueryParams>;
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Connector } from '../connector';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const VolumeStatisticsQueryParams = z.object({
|
|
5
5
|
connector: Connector,
|
|
6
|
+
resolution: z.enum(["1h", "4h", "24h"]),
|
|
7
|
+
startDate: z.coerce.date().optional(),
|
|
8
|
+
endDate: z.coerce.date().default(() => /* @__PURE__ */ new Date())
|
|
9
|
+
}).refine((data) => !data.startDate || data.startDate < data.endDate, {
|
|
10
|
+
message: "startDate must be before endDate"
|
|
11
|
+
});
|
|
12
|
+
const OiStatisticsQueryParams = z.object({
|
|
13
|
+
connector: Connector,
|
|
14
|
+
resolution: z.enum(["1h", "4h", "24h"]),
|
|
6
15
|
startDate: z.coerce.date().optional(),
|
|
7
16
|
endDate: z.coerce.date().default(() => /* @__PURE__ */ new Date())
|
|
8
17
|
}).refine((data) => !data.startDate || data.startDate < data.endDate, {
|
|
9
18
|
message: "startDate must be before endDate"
|
|
10
19
|
});
|
|
11
20
|
|
|
12
|
-
export {
|
|
21
|
+
export { OiStatisticsQueryParams, VolumeStatisticsQueryParams };
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const VolumeStatisticsResponse: z.ZodObject<{
|
|
3
3
|
data: z.ZodArray<z.ZodObject<{
|
|
4
|
-
|
|
4
|
+
timestamp: z.ZodNumber;
|
|
5
5
|
volume: z.ZodNumber;
|
|
6
6
|
fees: z.ZodNumber;
|
|
7
|
+
trades: z.ZodNumber;
|
|
7
8
|
users: z.ZodNumber;
|
|
8
9
|
newUsers: z.ZodNumber;
|
|
9
10
|
}, z.core.$strip>>;
|
|
10
11
|
}, z.core.$strip>;
|
|
11
|
-
export type
|
|
12
|
+
export type VolumeStatisticsResponse = z.output<typeof VolumeStatisticsResponse>;
|
|
13
|
+
export declare const OiStatisticsResponse: z.ZodObject<{
|
|
14
|
+
data: z.ZodArray<z.ZodObject<{
|
|
15
|
+
timestamp: z.ZodNumber;
|
|
16
|
+
openInterest: z.ZodNumber;
|
|
17
|
+
openPositions: z.ZodNumber;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export type OiStatisticsResponse = z.output<typeof OiStatisticsResponse>;
|