@pear-protocol/types 1.16.0 → 1.17.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.
- package/dist/instrument/entities.d.ts +19 -0
- package/dist/instrument/entities.js +12 -1
- package/dist/instrument/responses.d.ts +10 -0
- package/dist/instrument/responses.js +1 -1
- package/dist/leverage/payloads.d.ts +2 -2
- package/dist/market/entities.d.ts +23 -2
- package/dist/market/entities.js +13 -3
- package/dist/market/index.d.ts +1 -0
- package/dist/market/index.js +1 -0
- package/dist/market/payloads.d.ts +22 -0
- package/dist/market/payloads.js +11 -0
- package/dist/market/responses.d.ts +16 -2
- package/dist/market/responses.js +5 -2
- package/dist/notification/entities.d.ts +292 -34
- package/dist/notification/entities.js +72 -15
- package/dist/notification/responses.d.ts +144 -16
- package/dist/position/entities.d.ts +227 -0
- package/dist/position/entities.js +141 -1
- package/dist/position/queries.d.ts +16 -0
- package/dist/position/queries.js +25 -1
- package/dist/position/responses.d.ts +106 -0
- package/dist/position/responses.js +5 -2
- package/dist/rebalance/entities.d.ts +48 -9
- package/dist/rebalance/entities.js +33 -4
- package/dist/rebalance/responses.d.ts +70 -18
- package/dist/statistics/queries.d.ts +4 -2
- package/dist/statistics/queries.js +8 -2
- package/dist/users/payloads.d.ts +8 -0
- package/dist/users/payloads.js +9 -1
- package/dist/users/response.d.ts +5 -0
- package/dist/users/response.js +5 -1
- package/package.json +1 -1
|
@@ -3,8 +3,10 @@ import { z } from 'zod';
|
|
|
3
3
|
* What happened. The `*_HIT` categories mean the trigger fired and its order
|
|
4
4
|
* filled; the `*_FAILED` categories mean it fired but the order failed to
|
|
5
5
|
* execute; `ATTACHED_TRIGGER_DISCARDED` means requested close protection could
|
|
6
|
-
* not be placed after a position opened
|
|
7
|
-
*
|
|
6
|
+
* not be placed after a position opened; the `AUTO_REBALANCE_*` categories cover
|
|
7
|
+
* an auto-rebalance config acting on, or stopping itself over, the position it
|
|
8
|
+
* watches. Outcome lives here in the category; display details live in the
|
|
9
|
+
* `parameters` payload below.
|
|
8
10
|
*/
|
|
9
11
|
export declare const NotificationCategory: z.ZodEnum<{
|
|
10
12
|
TAKE_PROFIT_HIT: "TAKE_PROFIT_HIT";
|
|
@@ -14,6 +16,9 @@ export declare const NotificationCategory: z.ZodEnum<{
|
|
|
14
16
|
STOP_LOSS_FAILED: "STOP_LOSS_FAILED";
|
|
15
17
|
TRIGGER_ORDER_FAILED: "TRIGGER_ORDER_FAILED";
|
|
16
18
|
ATTACHED_TRIGGER_DISCARDED: "ATTACHED_TRIGGER_DISCARDED";
|
|
19
|
+
AUTO_REBALANCE_EXECUTED: "AUTO_REBALANCE_EXECUTED";
|
|
20
|
+
AUTO_REBALANCE_FAILED: "AUTO_REBALANCE_FAILED";
|
|
21
|
+
AUTO_REBALANCE_PAUSED: "AUTO_REBALANCE_PAUSED";
|
|
17
22
|
}>;
|
|
18
23
|
export type NotificationCategory = z.infer<typeof NotificationCategory>;
|
|
19
24
|
export declare const NotificationMetric: z.ZodEnum<{
|
|
@@ -35,16 +40,14 @@ export declare const NotificationMetric: z.ZodEnum<{
|
|
|
35
40
|
}>;
|
|
36
41
|
export type NotificationMetric = z.infer<typeof NotificationMetric>;
|
|
37
42
|
export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
lighter: "lighter";
|
|
47
|
-
}>;
|
|
43
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
symbol: z.ZodString;
|
|
46
|
+
side: z.ZodEnum<{
|
|
47
|
+
BUY: "BUY";
|
|
48
|
+
SELL: "SELL";
|
|
49
|
+
}>;
|
|
50
|
+
}, z.core.$strip>>;
|
|
48
51
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
49
52
|
price: "price";
|
|
50
53
|
notional: "notional";
|
|
@@ -64,8 +67,7 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
64
67
|
}>>;
|
|
65
68
|
level: z.ZodOptional<z.ZodNumber>;
|
|
66
69
|
reason: z.ZodOptional<z.ZodString>;
|
|
67
|
-
|
|
68
|
-
type: z.ZodLiteral<"stop_loss">;
|
|
70
|
+
type: z.ZodLiteral<"take_profit">;
|
|
69
71
|
triggerId: z.ZodUUID;
|
|
70
72
|
positionId: z.ZodUUID;
|
|
71
73
|
connector: z.ZodEnum<{
|
|
@@ -75,6 +77,15 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
75
77
|
okx: "okx";
|
|
76
78
|
lighter: "lighter";
|
|
77
79
|
}>;
|
|
80
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
81
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
82
|
+
id: z.ZodString;
|
|
83
|
+
symbol: z.ZodString;
|
|
84
|
+
side: z.ZodEnum<{
|
|
85
|
+
BUY: "BUY";
|
|
86
|
+
SELL: "SELL";
|
|
87
|
+
}>;
|
|
88
|
+
}, z.core.$strip>>;
|
|
78
89
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
79
90
|
price: "price";
|
|
80
91
|
notional: "notional";
|
|
@@ -94,8 +105,7 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
94
105
|
}>>;
|
|
95
106
|
level: z.ZodOptional<z.ZodNumber>;
|
|
96
107
|
reason: z.ZodOptional<z.ZodString>;
|
|
97
|
-
|
|
98
|
-
type: z.ZodLiteral<"trigger_order">;
|
|
108
|
+
type: z.ZodLiteral<"stop_loss">;
|
|
99
109
|
triggerId: z.ZodUUID;
|
|
100
110
|
positionId: z.ZodUUID;
|
|
101
111
|
connector: z.ZodEnum<{
|
|
@@ -105,6 +115,15 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
105
115
|
okx: "okx";
|
|
106
116
|
lighter: "lighter";
|
|
107
117
|
}>;
|
|
118
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
119
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
120
|
+
id: z.ZodString;
|
|
121
|
+
symbol: z.ZodString;
|
|
122
|
+
side: z.ZodEnum<{
|
|
123
|
+
BUY: "BUY";
|
|
124
|
+
SELL: "SELL";
|
|
125
|
+
}>;
|
|
126
|
+
}, z.core.$strip>>;
|
|
108
127
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
109
128
|
price: "price";
|
|
110
129
|
notional: "notional";
|
|
@@ -124,9 +143,9 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
124
143
|
}>>;
|
|
125
144
|
level: z.ZodOptional<z.ZodNumber>;
|
|
126
145
|
reason: z.ZodOptional<z.ZodString>;
|
|
127
|
-
|
|
128
|
-
type: z.ZodLiteral<"default_trigger">;
|
|
146
|
+
type: z.ZodLiteral<"trigger_order">;
|
|
129
147
|
triggerId: z.ZodUUID;
|
|
148
|
+
positionId: z.ZodUUID;
|
|
130
149
|
connector: z.ZodEnum<{
|
|
131
150
|
hyperliquid: "hyperliquid";
|
|
132
151
|
binance: "binance";
|
|
@@ -134,6 +153,15 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
134
153
|
okx: "okx";
|
|
135
154
|
lighter: "lighter";
|
|
136
155
|
}>;
|
|
156
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
157
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
158
|
+
id: z.ZodString;
|
|
159
|
+
symbol: z.ZodString;
|
|
160
|
+
side: z.ZodEnum<{
|
|
161
|
+
BUY: "BUY";
|
|
162
|
+
SELL: "SELL";
|
|
163
|
+
}>;
|
|
164
|
+
}, z.core.$strip>>;
|
|
137
165
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
138
166
|
price: "price";
|
|
139
167
|
notional: "notional";
|
|
@@ -153,7 +181,24 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
153
181
|
}>>;
|
|
154
182
|
level: z.ZodOptional<z.ZodNumber>;
|
|
155
183
|
reason: z.ZodOptional<z.ZodString>;
|
|
184
|
+
type: z.ZodLiteral<"default_trigger">;
|
|
185
|
+
triggerId: z.ZodUUID;
|
|
186
|
+
connector: z.ZodEnum<{
|
|
187
|
+
hyperliquid: "hyperliquid";
|
|
188
|
+
binance: "binance";
|
|
189
|
+
bybit: "bybit";
|
|
190
|
+
okx: "okx";
|
|
191
|
+
lighter: "lighter";
|
|
192
|
+
}>;
|
|
156
193
|
}, z.core.$strip>, z.ZodObject<{
|
|
194
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
195
|
+
id: z.ZodString;
|
|
196
|
+
symbol: z.ZodString;
|
|
197
|
+
side: z.ZodEnum<{
|
|
198
|
+
BUY: "BUY";
|
|
199
|
+
SELL: "SELL";
|
|
200
|
+
}>;
|
|
201
|
+
}, z.core.$strip>>;
|
|
157
202
|
type: z.ZodLiteral<"attached_trigger_discarded">;
|
|
158
203
|
positionId: z.ZodUUID;
|
|
159
204
|
positionKey: z.ZodString;
|
|
@@ -193,6 +238,91 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
193
238
|
}>;
|
|
194
239
|
}, z.core.$strip>>;
|
|
195
240
|
activeTriggerLimit: z.ZodNumber;
|
|
241
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
242
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
243
|
+
id: z.ZodString;
|
|
244
|
+
symbol: z.ZodString;
|
|
245
|
+
side: z.ZodEnum<{
|
|
246
|
+
BUY: "BUY";
|
|
247
|
+
SELL: "SELL";
|
|
248
|
+
}>;
|
|
249
|
+
currentWeight: z.ZodNumber;
|
|
250
|
+
targetWeight: z.ZodNumber;
|
|
251
|
+
}, z.core.$strip>>;
|
|
252
|
+
driftPct: z.ZodNumber;
|
|
253
|
+
notionalUsd: z.ZodNumber;
|
|
254
|
+
configId: z.ZodUUID;
|
|
255
|
+
positionId: z.ZodUUID;
|
|
256
|
+
positionKey: z.ZodString;
|
|
257
|
+
connector: z.ZodEnum<{
|
|
258
|
+
hyperliquid: "hyperliquid";
|
|
259
|
+
binance: "binance";
|
|
260
|
+
bybit: "bybit";
|
|
261
|
+
okx: "okx";
|
|
262
|
+
lighter: "lighter";
|
|
263
|
+
}>;
|
|
264
|
+
weightSource: z.ZodEnum<{
|
|
265
|
+
INITIAL_WEIGHT: "INITIAL_WEIGHT";
|
|
266
|
+
LIVE_BETA: "LIVE_BETA";
|
|
267
|
+
}>;
|
|
268
|
+
type: z.ZodLiteral<"auto_rebalance_executed">;
|
|
269
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
270
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
271
|
+
id: z.ZodString;
|
|
272
|
+
symbol: z.ZodString;
|
|
273
|
+
side: z.ZodEnum<{
|
|
274
|
+
BUY: "BUY";
|
|
275
|
+
SELL: "SELL";
|
|
276
|
+
}>;
|
|
277
|
+
currentWeight: z.ZodNumber;
|
|
278
|
+
targetWeight: z.ZodNumber;
|
|
279
|
+
}, z.core.$strip>>;
|
|
280
|
+
driftPct: z.ZodNumber;
|
|
281
|
+
reason: z.ZodString;
|
|
282
|
+
configId: z.ZodUUID;
|
|
283
|
+
positionId: z.ZodUUID;
|
|
284
|
+
positionKey: z.ZodString;
|
|
285
|
+
connector: z.ZodEnum<{
|
|
286
|
+
hyperliquid: "hyperliquid";
|
|
287
|
+
binance: "binance";
|
|
288
|
+
bybit: "bybit";
|
|
289
|
+
okx: "okx";
|
|
290
|
+
lighter: "lighter";
|
|
291
|
+
}>;
|
|
292
|
+
weightSource: z.ZodEnum<{
|
|
293
|
+
INITIAL_WEIGHT: "INITIAL_WEIGHT";
|
|
294
|
+
LIVE_BETA: "LIVE_BETA";
|
|
295
|
+
}>;
|
|
296
|
+
type: z.ZodLiteral<"auto_rebalance_failed">;
|
|
297
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
298
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
299
|
+
id: z.ZodString;
|
|
300
|
+
symbol: z.ZodString;
|
|
301
|
+
side: z.ZodEnum<{
|
|
302
|
+
BUY: "BUY";
|
|
303
|
+
SELL: "SELL";
|
|
304
|
+
}>;
|
|
305
|
+
}, z.core.$strip>>;
|
|
306
|
+
pausedReason: z.ZodEnum<{
|
|
307
|
+
POSITION_CHANGED: "POSITION_CHANGED";
|
|
308
|
+
REPEATED_FAILURES: "REPEATED_FAILURES";
|
|
309
|
+
INVALID_LIVE_BETA_EXPOSURE: "INVALID_LIVE_BETA_EXPOSURE";
|
|
310
|
+
}>;
|
|
311
|
+
configId: z.ZodUUID;
|
|
312
|
+
positionId: z.ZodUUID;
|
|
313
|
+
positionKey: z.ZodString;
|
|
314
|
+
connector: z.ZodEnum<{
|
|
315
|
+
hyperliquid: "hyperliquid";
|
|
316
|
+
binance: "binance";
|
|
317
|
+
bybit: "bybit";
|
|
318
|
+
okx: "okx";
|
|
319
|
+
lighter: "lighter";
|
|
320
|
+
}>;
|
|
321
|
+
weightSource: z.ZodEnum<{
|
|
322
|
+
INITIAL_WEIGHT: "INITIAL_WEIGHT";
|
|
323
|
+
LIVE_BETA: "LIVE_BETA";
|
|
324
|
+
}>;
|
|
325
|
+
type: z.ZodLiteral<"auto_rebalance_paused">;
|
|
196
326
|
}, z.core.$strip>], "type">;
|
|
197
327
|
export type NotificationParameters = z.output<typeof NotificationParameters>;
|
|
198
328
|
export declare const Notification: z.ZodObject<{
|
|
@@ -205,18 +335,19 @@ export declare const Notification: z.ZodObject<{
|
|
|
205
335
|
STOP_LOSS_FAILED: "STOP_LOSS_FAILED";
|
|
206
336
|
TRIGGER_ORDER_FAILED: "TRIGGER_ORDER_FAILED";
|
|
207
337
|
ATTACHED_TRIGGER_DISCARDED: "ATTACHED_TRIGGER_DISCARDED";
|
|
338
|
+
AUTO_REBALANCE_EXECUTED: "AUTO_REBALANCE_EXECUTED";
|
|
339
|
+
AUTO_REBALANCE_FAILED: "AUTO_REBALANCE_FAILED";
|
|
340
|
+
AUTO_REBALANCE_PAUSED: "AUTO_REBALANCE_PAUSED";
|
|
208
341
|
}>;
|
|
209
342
|
parameters: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
lighter: "lighter";
|
|
219
|
-
}>;
|
|
343
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
344
|
+
id: z.ZodString;
|
|
345
|
+
symbol: z.ZodString;
|
|
346
|
+
side: z.ZodEnum<{
|
|
347
|
+
BUY: "BUY";
|
|
348
|
+
SELL: "SELL";
|
|
349
|
+
}>;
|
|
350
|
+
}, z.core.$strip>>;
|
|
220
351
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
221
352
|
price: "price";
|
|
222
353
|
notional: "notional";
|
|
@@ -236,8 +367,7 @@ export declare const Notification: z.ZodObject<{
|
|
|
236
367
|
}>>;
|
|
237
368
|
level: z.ZodOptional<z.ZodNumber>;
|
|
238
369
|
reason: z.ZodOptional<z.ZodString>;
|
|
239
|
-
|
|
240
|
-
type: z.ZodLiteral<"stop_loss">;
|
|
370
|
+
type: z.ZodLiteral<"take_profit">;
|
|
241
371
|
triggerId: z.ZodUUID;
|
|
242
372
|
positionId: z.ZodUUID;
|
|
243
373
|
connector: z.ZodEnum<{
|
|
@@ -247,6 +377,15 @@ export declare const Notification: z.ZodObject<{
|
|
|
247
377
|
okx: "okx";
|
|
248
378
|
lighter: "lighter";
|
|
249
379
|
}>;
|
|
380
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
381
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
382
|
+
id: z.ZodString;
|
|
383
|
+
symbol: z.ZodString;
|
|
384
|
+
side: z.ZodEnum<{
|
|
385
|
+
BUY: "BUY";
|
|
386
|
+
SELL: "SELL";
|
|
387
|
+
}>;
|
|
388
|
+
}, z.core.$strip>>;
|
|
250
389
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
251
390
|
price: "price";
|
|
252
391
|
notional: "notional";
|
|
@@ -266,8 +405,7 @@ export declare const Notification: z.ZodObject<{
|
|
|
266
405
|
}>>;
|
|
267
406
|
level: z.ZodOptional<z.ZodNumber>;
|
|
268
407
|
reason: z.ZodOptional<z.ZodString>;
|
|
269
|
-
|
|
270
|
-
type: z.ZodLiteral<"trigger_order">;
|
|
408
|
+
type: z.ZodLiteral<"stop_loss">;
|
|
271
409
|
triggerId: z.ZodUUID;
|
|
272
410
|
positionId: z.ZodUUID;
|
|
273
411
|
connector: z.ZodEnum<{
|
|
@@ -277,6 +415,15 @@ export declare const Notification: z.ZodObject<{
|
|
|
277
415
|
okx: "okx";
|
|
278
416
|
lighter: "lighter";
|
|
279
417
|
}>;
|
|
418
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
419
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
420
|
+
id: z.ZodString;
|
|
421
|
+
symbol: z.ZodString;
|
|
422
|
+
side: z.ZodEnum<{
|
|
423
|
+
BUY: "BUY";
|
|
424
|
+
SELL: "SELL";
|
|
425
|
+
}>;
|
|
426
|
+
}, z.core.$strip>>;
|
|
280
427
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
281
428
|
price: "price";
|
|
282
429
|
notional: "notional";
|
|
@@ -296,9 +443,9 @@ export declare const Notification: z.ZodObject<{
|
|
|
296
443
|
}>>;
|
|
297
444
|
level: z.ZodOptional<z.ZodNumber>;
|
|
298
445
|
reason: z.ZodOptional<z.ZodString>;
|
|
299
|
-
|
|
300
|
-
type: z.ZodLiteral<"default_trigger">;
|
|
446
|
+
type: z.ZodLiteral<"trigger_order">;
|
|
301
447
|
triggerId: z.ZodUUID;
|
|
448
|
+
positionId: z.ZodUUID;
|
|
302
449
|
connector: z.ZodEnum<{
|
|
303
450
|
hyperliquid: "hyperliquid";
|
|
304
451
|
binance: "binance";
|
|
@@ -306,6 +453,15 @@ export declare const Notification: z.ZodObject<{
|
|
|
306
453
|
okx: "okx";
|
|
307
454
|
lighter: "lighter";
|
|
308
455
|
}>;
|
|
456
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
457
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
458
|
+
id: z.ZodString;
|
|
459
|
+
symbol: z.ZodString;
|
|
460
|
+
side: z.ZodEnum<{
|
|
461
|
+
BUY: "BUY";
|
|
462
|
+
SELL: "SELL";
|
|
463
|
+
}>;
|
|
464
|
+
}, z.core.$strip>>;
|
|
309
465
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
310
466
|
price: "price";
|
|
311
467
|
notional: "notional";
|
|
@@ -325,7 +481,24 @@ export declare const Notification: z.ZodObject<{
|
|
|
325
481
|
}>>;
|
|
326
482
|
level: z.ZodOptional<z.ZodNumber>;
|
|
327
483
|
reason: z.ZodOptional<z.ZodString>;
|
|
484
|
+
type: z.ZodLiteral<"default_trigger">;
|
|
485
|
+
triggerId: z.ZodUUID;
|
|
486
|
+
connector: z.ZodEnum<{
|
|
487
|
+
hyperliquid: "hyperliquid";
|
|
488
|
+
binance: "binance";
|
|
489
|
+
bybit: "bybit";
|
|
490
|
+
okx: "okx";
|
|
491
|
+
lighter: "lighter";
|
|
492
|
+
}>;
|
|
328
493
|
}, z.core.$strip>, z.ZodObject<{
|
|
494
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
495
|
+
id: z.ZodString;
|
|
496
|
+
symbol: z.ZodString;
|
|
497
|
+
side: z.ZodEnum<{
|
|
498
|
+
BUY: "BUY";
|
|
499
|
+
SELL: "SELL";
|
|
500
|
+
}>;
|
|
501
|
+
}, z.core.$strip>>;
|
|
329
502
|
type: z.ZodLiteral<"attached_trigger_discarded">;
|
|
330
503
|
positionId: z.ZodUUID;
|
|
331
504
|
positionKey: z.ZodString;
|
|
@@ -365,6 +538,91 @@ export declare const Notification: z.ZodObject<{
|
|
|
365
538
|
}>;
|
|
366
539
|
}, z.core.$strip>>;
|
|
367
540
|
activeTriggerLimit: z.ZodNumber;
|
|
541
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
542
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
543
|
+
id: z.ZodString;
|
|
544
|
+
symbol: z.ZodString;
|
|
545
|
+
side: z.ZodEnum<{
|
|
546
|
+
BUY: "BUY";
|
|
547
|
+
SELL: "SELL";
|
|
548
|
+
}>;
|
|
549
|
+
currentWeight: z.ZodNumber;
|
|
550
|
+
targetWeight: z.ZodNumber;
|
|
551
|
+
}, z.core.$strip>>;
|
|
552
|
+
driftPct: z.ZodNumber;
|
|
553
|
+
notionalUsd: z.ZodNumber;
|
|
554
|
+
configId: z.ZodUUID;
|
|
555
|
+
positionId: z.ZodUUID;
|
|
556
|
+
positionKey: z.ZodString;
|
|
557
|
+
connector: z.ZodEnum<{
|
|
558
|
+
hyperliquid: "hyperliquid";
|
|
559
|
+
binance: "binance";
|
|
560
|
+
bybit: "bybit";
|
|
561
|
+
okx: "okx";
|
|
562
|
+
lighter: "lighter";
|
|
563
|
+
}>;
|
|
564
|
+
weightSource: z.ZodEnum<{
|
|
565
|
+
INITIAL_WEIGHT: "INITIAL_WEIGHT";
|
|
566
|
+
LIVE_BETA: "LIVE_BETA";
|
|
567
|
+
}>;
|
|
568
|
+
type: z.ZodLiteral<"auto_rebalance_executed">;
|
|
569
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
570
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
571
|
+
id: z.ZodString;
|
|
572
|
+
symbol: z.ZodString;
|
|
573
|
+
side: z.ZodEnum<{
|
|
574
|
+
BUY: "BUY";
|
|
575
|
+
SELL: "SELL";
|
|
576
|
+
}>;
|
|
577
|
+
currentWeight: z.ZodNumber;
|
|
578
|
+
targetWeight: z.ZodNumber;
|
|
579
|
+
}, z.core.$strip>>;
|
|
580
|
+
driftPct: z.ZodNumber;
|
|
581
|
+
reason: z.ZodString;
|
|
582
|
+
configId: z.ZodUUID;
|
|
583
|
+
positionId: z.ZodUUID;
|
|
584
|
+
positionKey: z.ZodString;
|
|
585
|
+
connector: z.ZodEnum<{
|
|
586
|
+
hyperliquid: "hyperliquid";
|
|
587
|
+
binance: "binance";
|
|
588
|
+
bybit: "bybit";
|
|
589
|
+
okx: "okx";
|
|
590
|
+
lighter: "lighter";
|
|
591
|
+
}>;
|
|
592
|
+
weightSource: z.ZodEnum<{
|
|
593
|
+
INITIAL_WEIGHT: "INITIAL_WEIGHT";
|
|
594
|
+
LIVE_BETA: "LIVE_BETA";
|
|
595
|
+
}>;
|
|
596
|
+
type: z.ZodLiteral<"auto_rebalance_failed">;
|
|
597
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
598
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
599
|
+
id: z.ZodString;
|
|
600
|
+
symbol: z.ZodString;
|
|
601
|
+
side: z.ZodEnum<{
|
|
602
|
+
BUY: "BUY";
|
|
603
|
+
SELL: "SELL";
|
|
604
|
+
}>;
|
|
605
|
+
}, z.core.$strip>>;
|
|
606
|
+
pausedReason: z.ZodEnum<{
|
|
607
|
+
POSITION_CHANGED: "POSITION_CHANGED";
|
|
608
|
+
REPEATED_FAILURES: "REPEATED_FAILURES";
|
|
609
|
+
INVALID_LIVE_BETA_EXPOSURE: "INVALID_LIVE_BETA_EXPOSURE";
|
|
610
|
+
}>;
|
|
611
|
+
configId: z.ZodUUID;
|
|
612
|
+
positionId: z.ZodUUID;
|
|
613
|
+
positionKey: z.ZodString;
|
|
614
|
+
connector: z.ZodEnum<{
|
|
615
|
+
hyperliquid: "hyperliquid";
|
|
616
|
+
binance: "binance";
|
|
617
|
+
bybit: "bybit";
|
|
618
|
+
okx: "okx";
|
|
619
|
+
lighter: "lighter";
|
|
620
|
+
}>;
|
|
621
|
+
weightSource: z.ZodEnum<{
|
|
622
|
+
INITIAL_WEIGHT: "INITIAL_WEIGHT";
|
|
623
|
+
LIVE_BETA: "LIVE_BETA";
|
|
624
|
+
}>;
|
|
625
|
+
type: z.ZodLiteral<"auto_rebalance_paused">;
|
|
368
626
|
}, z.core.$strip>], "type">;
|
|
369
627
|
isRead: z.ZodBoolean;
|
|
370
628
|
createdAt: z.ZodString;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { Side } from '../common/schema';
|
|
2
3
|
import { Connector } from '../connector';
|
|
3
4
|
|
|
4
5
|
const NotificationCategory = z.enum([
|
|
@@ -8,7 +9,10 @@ const NotificationCategory = z.enum([
|
|
|
8
9
|
"TAKE_PROFIT_FAILED",
|
|
9
10
|
"STOP_LOSS_FAILED",
|
|
10
11
|
"TRIGGER_ORDER_FAILED",
|
|
11
|
-
"ATTACHED_TRIGGER_DISCARDED"
|
|
12
|
+
"ATTACHED_TRIGGER_DISCARDED",
|
|
13
|
+
"AUTO_REBALANCE_EXECUTED",
|
|
14
|
+
"AUTO_REBALANCE_FAILED",
|
|
15
|
+
"AUTO_REBALANCE_PAUSED"
|
|
12
16
|
]);
|
|
13
17
|
const NotificationMetric = z.enum([
|
|
14
18
|
"ratio",
|
|
@@ -32,30 +36,42 @@ const TriggerNotificationEnrichment = {
|
|
|
32
36
|
level: z.number().optional(),
|
|
33
37
|
reason: z.string().max(255).optional()
|
|
34
38
|
};
|
|
35
|
-
const
|
|
39
|
+
const TriggerNotificationLeg = z.object({
|
|
40
|
+
id: z.string().min(1),
|
|
41
|
+
symbol: z.string().min(1),
|
|
42
|
+
side: Side
|
|
43
|
+
});
|
|
44
|
+
const PositionLegParameters = z.object({
|
|
45
|
+
legs: z.array(TriggerNotificationLeg)
|
|
46
|
+
});
|
|
47
|
+
const TakeProfitNotificationParameters = PositionLegParameters.safeExtend({
|
|
36
48
|
type: z.literal("take_profit"),
|
|
37
49
|
triggerId: z.uuid(),
|
|
38
50
|
positionId: z.uuid(),
|
|
39
|
-
connector: Connector
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
connector: Connector,
|
|
52
|
+
...TriggerNotificationEnrichment
|
|
53
|
+
});
|
|
54
|
+
const StopLossNotificationParameters = PositionLegParameters.safeExtend({
|
|
42
55
|
type: z.literal("stop_loss"),
|
|
43
56
|
triggerId: z.uuid(),
|
|
44
57
|
positionId: z.uuid(),
|
|
45
|
-
connector: Connector
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
connector: Connector,
|
|
59
|
+
...TriggerNotificationEnrichment
|
|
60
|
+
});
|
|
61
|
+
const TriggerOrderNotificationParameters = PositionLegParameters.safeExtend({
|
|
48
62
|
type: z.literal("trigger_order"),
|
|
49
63
|
triggerId: z.uuid(),
|
|
50
64
|
positionId: z.uuid(),
|
|
51
|
-
connector: Connector
|
|
52
|
-
|
|
53
|
-
|
|
65
|
+
connector: Connector,
|
|
66
|
+
...TriggerNotificationEnrichment
|
|
67
|
+
});
|
|
68
|
+
const DefaultTriggerNotificationParameters = PositionLegParameters.safeExtend({
|
|
54
69
|
type: z.literal("default_trigger"),
|
|
55
70
|
triggerId: z.uuid(),
|
|
56
|
-
connector: Connector
|
|
57
|
-
|
|
58
|
-
|
|
71
|
+
connector: Connector,
|
|
72
|
+
...TriggerNotificationEnrichment
|
|
73
|
+
});
|
|
74
|
+
const AttachedTriggerDiscardedNotificationParameters = PositionLegParameters.safeExtend({
|
|
59
75
|
type: z.literal("attached_trigger_discarded"),
|
|
60
76
|
positionId: z.uuid(),
|
|
61
77
|
positionKey: z.string().min(1),
|
|
@@ -70,12 +86,53 @@ const AttachedTriggerDiscardedNotificationParameters = z.object({
|
|
|
70
86
|
).min(1),
|
|
71
87
|
activeTriggerLimit: z.number().int().positive()
|
|
72
88
|
});
|
|
89
|
+
const AutoRebalanceLeg = z.object({
|
|
90
|
+
id: z.string().min(1),
|
|
91
|
+
symbol: z.string().min(1),
|
|
92
|
+
side: Side
|
|
93
|
+
});
|
|
94
|
+
const AutoRebalanceAnchor = {
|
|
95
|
+
configId: z.uuid(),
|
|
96
|
+
positionId: z.uuid(),
|
|
97
|
+
positionKey: z.string().min(1),
|
|
98
|
+
connector: Connector,
|
|
99
|
+
weightSource: z.enum(["INITIAL_WEIGHT", "LIVE_BETA"])
|
|
100
|
+
};
|
|
101
|
+
const AutoRebalanceRunLegs = z.array(
|
|
102
|
+
AutoRebalanceLeg.safeExtend({
|
|
103
|
+
currentWeight: z.number(),
|
|
104
|
+
targetWeight: z.number()
|
|
105
|
+
})
|
|
106
|
+
);
|
|
107
|
+
const AutoRebalanceExecutedNotificationParameters = z.object({
|
|
108
|
+
type: z.literal("auto_rebalance_executed"),
|
|
109
|
+
...AutoRebalanceAnchor,
|
|
110
|
+
legs: AutoRebalanceRunLegs,
|
|
111
|
+
driftPct: z.number(),
|
|
112
|
+
notionalUsd: z.number()
|
|
113
|
+
});
|
|
114
|
+
const AutoRebalanceFailedNotificationParameters = z.object({
|
|
115
|
+
type: z.literal("auto_rebalance_failed"),
|
|
116
|
+
...AutoRebalanceAnchor,
|
|
117
|
+
legs: AutoRebalanceRunLegs,
|
|
118
|
+
driftPct: z.number(),
|
|
119
|
+
reason: z.string().max(255)
|
|
120
|
+
});
|
|
121
|
+
const AutoRebalancePausedNotificationParameters = z.object({
|
|
122
|
+
type: z.literal("auto_rebalance_paused"),
|
|
123
|
+
...AutoRebalanceAnchor,
|
|
124
|
+
legs: z.array(AutoRebalanceLeg),
|
|
125
|
+
pausedReason: z.enum(["POSITION_CHANGED", "REPEATED_FAILURES", "INVALID_LIVE_BETA_EXPOSURE"])
|
|
126
|
+
});
|
|
73
127
|
const NotificationParameters = z.discriminatedUnion("type", [
|
|
74
128
|
TakeProfitNotificationParameters,
|
|
75
129
|
StopLossNotificationParameters,
|
|
76
130
|
TriggerOrderNotificationParameters,
|
|
77
131
|
DefaultTriggerNotificationParameters,
|
|
78
|
-
AttachedTriggerDiscardedNotificationParameters
|
|
132
|
+
AttachedTriggerDiscardedNotificationParameters,
|
|
133
|
+
AutoRebalanceExecutedNotificationParameters,
|
|
134
|
+
AutoRebalanceFailedNotificationParameters,
|
|
135
|
+
AutoRebalancePausedNotificationParameters
|
|
79
136
|
]);
|
|
80
137
|
const Notification = z.object({
|
|
81
138
|
/**
|