@pear-protocol/types 1.6.0 → 1.7.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.
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* What happened. The `*_HIT` categories mean the trigger fired and its order
|
|
4
|
+
* filled; the `*_FAILED` categories mean it fired but the order failed to
|
|
5
|
+
* execute; `ATTACHED_TRIGGER_DISCARDED` means requested close protection could
|
|
6
|
+
* not be placed after a position opened. Outcome lives here in the category;
|
|
7
|
+
* display details live in the `parameters` payload below.
|
|
8
|
+
*/
|
|
2
9
|
export declare const NotificationCategory: z.ZodEnum<{
|
|
3
10
|
TAKE_PROFIT_HIT: "TAKE_PROFIT_HIT";
|
|
4
11
|
STOP_LOSS_HIT: "STOP_LOSS_HIT";
|
|
5
12
|
TRIGGER_ORDER_HIT: "TRIGGER_ORDER_HIT";
|
|
13
|
+
TAKE_PROFIT_FAILED: "TAKE_PROFIT_FAILED";
|
|
14
|
+
STOP_LOSS_FAILED: "STOP_LOSS_FAILED";
|
|
15
|
+
TRIGGER_ORDER_FAILED: "TRIGGER_ORDER_FAILED";
|
|
16
|
+
ATTACHED_TRIGGER_DISCARDED: "ATTACHED_TRIGGER_DISCARDED";
|
|
6
17
|
}>;
|
|
7
18
|
export type NotificationCategory = z.infer<typeof NotificationCategory>;
|
|
19
|
+
export declare const NotificationMetric: z.ZodEnum<{
|
|
20
|
+
price: "price";
|
|
21
|
+
notional: "notional";
|
|
22
|
+
ratio: "ratio";
|
|
23
|
+
weighted_ratio: "weighted_ratio";
|
|
24
|
+
upnl: "upnl";
|
|
25
|
+
upnl_bps: "upnl_bps";
|
|
26
|
+
funding_rate: "funding_rate";
|
|
27
|
+
prediction_market: "prediction_market";
|
|
28
|
+
btc_dominance: "btc_dominance";
|
|
29
|
+
ratio_trailing: "ratio_trailing";
|
|
30
|
+
price_trailing: "price_trailing";
|
|
31
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
32
|
+
notional_trailing: "notional_trailing";
|
|
33
|
+
upnl_trailing: "upnl_trailing";
|
|
34
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
35
|
+
}>;
|
|
36
|
+
export type NotificationMetric = z.infer<typeof NotificationMetric>;
|
|
8
37
|
export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
9
38
|
type: z.ZodLiteral<"take_profit">;
|
|
10
39
|
triggerId: z.ZodUUID;
|
|
@@ -16,6 +45,25 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
16
45
|
okx: "okx";
|
|
17
46
|
lighter: "lighter";
|
|
18
47
|
}>;
|
|
48
|
+
metric: z.ZodOptional<z.ZodEnum<{
|
|
49
|
+
price: "price";
|
|
50
|
+
notional: "notional";
|
|
51
|
+
ratio: "ratio";
|
|
52
|
+
weighted_ratio: "weighted_ratio";
|
|
53
|
+
upnl: "upnl";
|
|
54
|
+
upnl_bps: "upnl_bps";
|
|
55
|
+
funding_rate: "funding_rate";
|
|
56
|
+
prediction_market: "prediction_market";
|
|
57
|
+
btc_dominance: "btc_dominance";
|
|
58
|
+
ratio_trailing: "ratio_trailing";
|
|
59
|
+
price_trailing: "price_trailing";
|
|
60
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
61
|
+
notional_trailing: "notional_trailing";
|
|
62
|
+
upnl_trailing: "upnl_trailing";
|
|
63
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
64
|
+
}>>;
|
|
65
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
19
67
|
}, z.core.$strip>, z.ZodObject<{
|
|
20
68
|
type: z.ZodLiteral<"stop_loss">;
|
|
21
69
|
triggerId: z.ZodUUID;
|
|
@@ -27,6 +75,25 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
27
75
|
okx: "okx";
|
|
28
76
|
lighter: "lighter";
|
|
29
77
|
}>;
|
|
78
|
+
metric: z.ZodOptional<z.ZodEnum<{
|
|
79
|
+
price: "price";
|
|
80
|
+
notional: "notional";
|
|
81
|
+
ratio: "ratio";
|
|
82
|
+
weighted_ratio: "weighted_ratio";
|
|
83
|
+
upnl: "upnl";
|
|
84
|
+
upnl_bps: "upnl_bps";
|
|
85
|
+
funding_rate: "funding_rate";
|
|
86
|
+
prediction_market: "prediction_market";
|
|
87
|
+
btc_dominance: "btc_dominance";
|
|
88
|
+
ratio_trailing: "ratio_trailing";
|
|
89
|
+
price_trailing: "price_trailing";
|
|
90
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
91
|
+
notional_trailing: "notional_trailing";
|
|
92
|
+
upnl_trailing: "upnl_trailing";
|
|
93
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
94
|
+
}>>;
|
|
95
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
30
97
|
}, z.core.$strip>, z.ZodObject<{
|
|
31
98
|
type: z.ZodLiteral<"trigger_order">;
|
|
32
99
|
triggerId: z.ZodUUID;
|
|
@@ -38,6 +105,25 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
38
105
|
okx: "okx";
|
|
39
106
|
lighter: "lighter";
|
|
40
107
|
}>;
|
|
108
|
+
metric: z.ZodOptional<z.ZodEnum<{
|
|
109
|
+
price: "price";
|
|
110
|
+
notional: "notional";
|
|
111
|
+
ratio: "ratio";
|
|
112
|
+
weighted_ratio: "weighted_ratio";
|
|
113
|
+
upnl: "upnl";
|
|
114
|
+
upnl_bps: "upnl_bps";
|
|
115
|
+
funding_rate: "funding_rate";
|
|
116
|
+
prediction_market: "prediction_market";
|
|
117
|
+
btc_dominance: "btc_dominance";
|
|
118
|
+
ratio_trailing: "ratio_trailing";
|
|
119
|
+
price_trailing: "price_trailing";
|
|
120
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
121
|
+
notional_trailing: "notional_trailing";
|
|
122
|
+
upnl_trailing: "upnl_trailing";
|
|
123
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
124
|
+
}>>;
|
|
125
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
41
127
|
}, z.core.$strip>, z.ZodObject<{
|
|
42
128
|
type: z.ZodLiteral<"default_trigger">;
|
|
43
129
|
triggerId: z.ZodUUID;
|
|
@@ -48,6 +134,65 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
48
134
|
okx: "okx";
|
|
49
135
|
lighter: "lighter";
|
|
50
136
|
}>;
|
|
137
|
+
metric: z.ZodOptional<z.ZodEnum<{
|
|
138
|
+
price: "price";
|
|
139
|
+
notional: "notional";
|
|
140
|
+
ratio: "ratio";
|
|
141
|
+
weighted_ratio: "weighted_ratio";
|
|
142
|
+
upnl: "upnl";
|
|
143
|
+
upnl_bps: "upnl_bps";
|
|
144
|
+
funding_rate: "funding_rate";
|
|
145
|
+
prediction_market: "prediction_market";
|
|
146
|
+
btc_dominance: "btc_dominance";
|
|
147
|
+
ratio_trailing: "ratio_trailing";
|
|
148
|
+
price_trailing: "price_trailing";
|
|
149
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
150
|
+
notional_trailing: "notional_trailing";
|
|
151
|
+
upnl_trailing: "upnl_trailing";
|
|
152
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
153
|
+
}>>;
|
|
154
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
156
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
157
|
+
type: z.ZodLiteral<"attached_trigger_discarded">;
|
|
158
|
+
positionId: z.ZodUUID;
|
|
159
|
+
positionKey: z.ZodString;
|
|
160
|
+
connector: z.ZodEnum<{
|
|
161
|
+
hyperliquid: "hyperliquid";
|
|
162
|
+
binance: "binance";
|
|
163
|
+
bybit: "bybit";
|
|
164
|
+
okx: "okx";
|
|
165
|
+
lighter: "lighter";
|
|
166
|
+
}>;
|
|
167
|
+
discarded: z.ZodArray<z.ZodObject<{
|
|
168
|
+
bracketType: z.ZodEnum<{
|
|
169
|
+
STOP_LOSS: "STOP_LOSS";
|
|
170
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
171
|
+
}>;
|
|
172
|
+
metric: z.ZodEnum<{
|
|
173
|
+
price: "price";
|
|
174
|
+
notional: "notional";
|
|
175
|
+
ratio: "ratio";
|
|
176
|
+
weighted_ratio: "weighted_ratio";
|
|
177
|
+
upnl: "upnl";
|
|
178
|
+
upnl_bps: "upnl_bps";
|
|
179
|
+
funding_rate: "funding_rate";
|
|
180
|
+
prediction_market: "prediction_market";
|
|
181
|
+
btc_dominance: "btc_dominance";
|
|
182
|
+
ratio_trailing: "ratio_trailing";
|
|
183
|
+
price_trailing: "price_trailing";
|
|
184
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
185
|
+
notional_trailing: "notional_trailing";
|
|
186
|
+
upnl_trailing: "upnl_trailing";
|
|
187
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
188
|
+
}>;
|
|
189
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
190
|
+
reason: z.ZodEnum<{
|
|
191
|
+
TRIGGER_LIMIT: "TRIGGER_LIMIT";
|
|
192
|
+
TRAILING_ALREADY_EXISTS: "TRAILING_ALREADY_EXISTS";
|
|
193
|
+
}>;
|
|
194
|
+
}, z.core.$strip>>;
|
|
195
|
+
activeTriggerLimit: z.ZodNumber;
|
|
51
196
|
}, z.core.$strip>], "type">;
|
|
52
197
|
export type NotificationParameters = z.output<typeof NotificationParameters>;
|
|
53
198
|
export declare const Notification: z.ZodObject<{
|
|
@@ -56,6 +201,10 @@ export declare const Notification: z.ZodObject<{
|
|
|
56
201
|
TAKE_PROFIT_HIT: "TAKE_PROFIT_HIT";
|
|
57
202
|
STOP_LOSS_HIT: "STOP_LOSS_HIT";
|
|
58
203
|
TRIGGER_ORDER_HIT: "TRIGGER_ORDER_HIT";
|
|
204
|
+
TAKE_PROFIT_FAILED: "TAKE_PROFIT_FAILED";
|
|
205
|
+
STOP_LOSS_FAILED: "STOP_LOSS_FAILED";
|
|
206
|
+
TRIGGER_ORDER_FAILED: "TRIGGER_ORDER_FAILED";
|
|
207
|
+
ATTACHED_TRIGGER_DISCARDED: "ATTACHED_TRIGGER_DISCARDED";
|
|
59
208
|
}>;
|
|
60
209
|
parameters: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
61
210
|
type: z.ZodLiteral<"take_profit">;
|
|
@@ -68,6 +217,25 @@ export declare const Notification: z.ZodObject<{
|
|
|
68
217
|
okx: "okx";
|
|
69
218
|
lighter: "lighter";
|
|
70
219
|
}>;
|
|
220
|
+
metric: z.ZodOptional<z.ZodEnum<{
|
|
221
|
+
price: "price";
|
|
222
|
+
notional: "notional";
|
|
223
|
+
ratio: "ratio";
|
|
224
|
+
weighted_ratio: "weighted_ratio";
|
|
225
|
+
upnl: "upnl";
|
|
226
|
+
upnl_bps: "upnl_bps";
|
|
227
|
+
funding_rate: "funding_rate";
|
|
228
|
+
prediction_market: "prediction_market";
|
|
229
|
+
btc_dominance: "btc_dominance";
|
|
230
|
+
ratio_trailing: "ratio_trailing";
|
|
231
|
+
price_trailing: "price_trailing";
|
|
232
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
233
|
+
notional_trailing: "notional_trailing";
|
|
234
|
+
upnl_trailing: "upnl_trailing";
|
|
235
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
236
|
+
}>>;
|
|
237
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
238
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
71
239
|
}, z.core.$strip>, z.ZodObject<{
|
|
72
240
|
type: z.ZodLiteral<"stop_loss">;
|
|
73
241
|
triggerId: z.ZodUUID;
|
|
@@ -79,6 +247,25 @@ export declare const Notification: z.ZodObject<{
|
|
|
79
247
|
okx: "okx";
|
|
80
248
|
lighter: "lighter";
|
|
81
249
|
}>;
|
|
250
|
+
metric: z.ZodOptional<z.ZodEnum<{
|
|
251
|
+
price: "price";
|
|
252
|
+
notional: "notional";
|
|
253
|
+
ratio: "ratio";
|
|
254
|
+
weighted_ratio: "weighted_ratio";
|
|
255
|
+
upnl: "upnl";
|
|
256
|
+
upnl_bps: "upnl_bps";
|
|
257
|
+
funding_rate: "funding_rate";
|
|
258
|
+
prediction_market: "prediction_market";
|
|
259
|
+
btc_dominance: "btc_dominance";
|
|
260
|
+
ratio_trailing: "ratio_trailing";
|
|
261
|
+
price_trailing: "price_trailing";
|
|
262
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
263
|
+
notional_trailing: "notional_trailing";
|
|
264
|
+
upnl_trailing: "upnl_trailing";
|
|
265
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
266
|
+
}>>;
|
|
267
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
268
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
82
269
|
}, z.core.$strip>, z.ZodObject<{
|
|
83
270
|
type: z.ZodLiteral<"trigger_order">;
|
|
84
271
|
triggerId: z.ZodUUID;
|
|
@@ -90,6 +277,25 @@ export declare const Notification: z.ZodObject<{
|
|
|
90
277
|
okx: "okx";
|
|
91
278
|
lighter: "lighter";
|
|
92
279
|
}>;
|
|
280
|
+
metric: z.ZodOptional<z.ZodEnum<{
|
|
281
|
+
price: "price";
|
|
282
|
+
notional: "notional";
|
|
283
|
+
ratio: "ratio";
|
|
284
|
+
weighted_ratio: "weighted_ratio";
|
|
285
|
+
upnl: "upnl";
|
|
286
|
+
upnl_bps: "upnl_bps";
|
|
287
|
+
funding_rate: "funding_rate";
|
|
288
|
+
prediction_market: "prediction_market";
|
|
289
|
+
btc_dominance: "btc_dominance";
|
|
290
|
+
ratio_trailing: "ratio_trailing";
|
|
291
|
+
price_trailing: "price_trailing";
|
|
292
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
293
|
+
notional_trailing: "notional_trailing";
|
|
294
|
+
upnl_trailing: "upnl_trailing";
|
|
295
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
296
|
+
}>>;
|
|
297
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
298
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
93
299
|
}, z.core.$strip>, z.ZodObject<{
|
|
94
300
|
type: z.ZodLiteral<"default_trigger">;
|
|
95
301
|
triggerId: z.ZodUUID;
|
|
@@ -100,6 +306,65 @@ export declare const Notification: z.ZodObject<{
|
|
|
100
306
|
okx: "okx";
|
|
101
307
|
lighter: "lighter";
|
|
102
308
|
}>;
|
|
309
|
+
metric: z.ZodOptional<z.ZodEnum<{
|
|
310
|
+
price: "price";
|
|
311
|
+
notional: "notional";
|
|
312
|
+
ratio: "ratio";
|
|
313
|
+
weighted_ratio: "weighted_ratio";
|
|
314
|
+
upnl: "upnl";
|
|
315
|
+
upnl_bps: "upnl_bps";
|
|
316
|
+
funding_rate: "funding_rate";
|
|
317
|
+
prediction_market: "prediction_market";
|
|
318
|
+
btc_dominance: "btc_dominance";
|
|
319
|
+
ratio_trailing: "ratio_trailing";
|
|
320
|
+
price_trailing: "price_trailing";
|
|
321
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
322
|
+
notional_trailing: "notional_trailing";
|
|
323
|
+
upnl_trailing: "upnl_trailing";
|
|
324
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
325
|
+
}>>;
|
|
326
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
327
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
328
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
329
|
+
type: z.ZodLiteral<"attached_trigger_discarded">;
|
|
330
|
+
positionId: z.ZodUUID;
|
|
331
|
+
positionKey: z.ZodString;
|
|
332
|
+
connector: z.ZodEnum<{
|
|
333
|
+
hyperliquid: "hyperliquid";
|
|
334
|
+
binance: "binance";
|
|
335
|
+
bybit: "bybit";
|
|
336
|
+
okx: "okx";
|
|
337
|
+
lighter: "lighter";
|
|
338
|
+
}>;
|
|
339
|
+
discarded: z.ZodArray<z.ZodObject<{
|
|
340
|
+
bracketType: z.ZodEnum<{
|
|
341
|
+
STOP_LOSS: "STOP_LOSS";
|
|
342
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
343
|
+
}>;
|
|
344
|
+
metric: z.ZodEnum<{
|
|
345
|
+
price: "price";
|
|
346
|
+
notional: "notional";
|
|
347
|
+
ratio: "ratio";
|
|
348
|
+
weighted_ratio: "weighted_ratio";
|
|
349
|
+
upnl: "upnl";
|
|
350
|
+
upnl_bps: "upnl_bps";
|
|
351
|
+
funding_rate: "funding_rate";
|
|
352
|
+
prediction_market: "prediction_market";
|
|
353
|
+
btc_dominance: "btc_dominance";
|
|
354
|
+
ratio_trailing: "ratio_trailing";
|
|
355
|
+
price_trailing: "price_trailing";
|
|
356
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
357
|
+
notional_trailing: "notional_trailing";
|
|
358
|
+
upnl_trailing: "upnl_trailing";
|
|
359
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
360
|
+
}>;
|
|
361
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
362
|
+
reason: z.ZodEnum<{
|
|
363
|
+
TRIGGER_LIMIT: "TRIGGER_LIMIT";
|
|
364
|
+
TRAILING_ALREADY_EXISTS: "TRAILING_ALREADY_EXISTS";
|
|
365
|
+
}>;
|
|
366
|
+
}, z.core.$strip>>;
|
|
367
|
+
activeTriggerLimit: z.ZodNumber;
|
|
103
368
|
}, z.core.$strip>], "type">;
|
|
104
369
|
isRead: z.ZodBoolean;
|
|
105
370
|
createdAt: z.ZodString;
|
|
@@ -1,35 +1,81 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Connector } from '../connector';
|
|
3
3
|
|
|
4
|
-
const NotificationCategory = z.enum([
|
|
4
|
+
const NotificationCategory = z.enum([
|
|
5
|
+
"TAKE_PROFIT_HIT",
|
|
6
|
+
"STOP_LOSS_HIT",
|
|
7
|
+
"TRIGGER_ORDER_HIT",
|
|
8
|
+
"TAKE_PROFIT_FAILED",
|
|
9
|
+
"STOP_LOSS_FAILED",
|
|
10
|
+
"TRIGGER_ORDER_FAILED",
|
|
11
|
+
"ATTACHED_TRIGGER_DISCARDED"
|
|
12
|
+
]);
|
|
13
|
+
const NotificationMetric = z.enum([
|
|
14
|
+
"ratio",
|
|
15
|
+
"price",
|
|
16
|
+
"weighted_ratio",
|
|
17
|
+
"notional",
|
|
18
|
+
"upnl",
|
|
19
|
+
"upnl_bps",
|
|
20
|
+
"ratio_trailing",
|
|
21
|
+
"price_trailing",
|
|
22
|
+
"weighted_ratio_trailing",
|
|
23
|
+
"notional_trailing",
|
|
24
|
+
"upnl_trailing",
|
|
25
|
+
"upnl_bps_trailing",
|
|
26
|
+
"funding_rate",
|
|
27
|
+
"prediction_market",
|
|
28
|
+
"btc_dominance"
|
|
29
|
+
]);
|
|
30
|
+
const TriggerNotificationEnrichment = {
|
|
31
|
+
metric: NotificationMetric.optional(),
|
|
32
|
+
level: z.number().optional(),
|
|
33
|
+
reason: z.string().max(255).optional()
|
|
34
|
+
};
|
|
5
35
|
const TakeProfitNotificationParameters = z.object({
|
|
6
36
|
type: z.literal("take_profit"),
|
|
7
37
|
triggerId: z.uuid(),
|
|
8
38
|
positionId: z.uuid(),
|
|
9
39
|
connector: Connector
|
|
10
|
-
});
|
|
40
|
+
}).extend(TriggerNotificationEnrichment);
|
|
11
41
|
const StopLossNotificationParameters = z.object({
|
|
12
42
|
type: z.literal("stop_loss"),
|
|
13
43
|
triggerId: z.uuid(),
|
|
14
44
|
positionId: z.uuid(),
|
|
15
45
|
connector: Connector
|
|
16
|
-
});
|
|
46
|
+
}).extend(TriggerNotificationEnrichment);
|
|
17
47
|
const TriggerOrderNotificationParameters = z.object({
|
|
18
48
|
type: z.literal("trigger_order"),
|
|
19
49
|
triggerId: z.uuid(),
|
|
20
50
|
positionId: z.uuid(),
|
|
21
51
|
connector: Connector
|
|
22
|
-
});
|
|
52
|
+
}).extend(TriggerNotificationEnrichment);
|
|
23
53
|
const DefaultTriggerNotificationParameters = z.object({
|
|
24
54
|
type: z.literal("default_trigger"),
|
|
25
55
|
triggerId: z.uuid(),
|
|
26
56
|
connector: Connector
|
|
57
|
+
}).extend(TriggerNotificationEnrichment);
|
|
58
|
+
const AttachedTriggerDiscardedNotificationParameters = z.object({
|
|
59
|
+
type: z.literal("attached_trigger_discarded"),
|
|
60
|
+
positionId: z.uuid(),
|
|
61
|
+
positionKey: z.string().min(1),
|
|
62
|
+
connector: Connector,
|
|
63
|
+
discarded: z.array(
|
|
64
|
+
z.object({
|
|
65
|
+
bracketType: z.enum(["STOP_LOSS", "TAKE_PROFIT"]),
|
|
66
|
+
metric: NotificationMetric,
|
|
67
|
+
level: z.number().optional(),
|
|
68
|
+
reason: z.enum(["TRIGGER_LIMIT", "TRAILING_ALREADY_EXISTS"])
|
|
69
|
+
})
|
|
70
|
+
).min(1),
|
|
71
|
+
activeTriggerLimit: z.number().int().positive()
|
|
27
72
|
});
|
|
28
73
|
const NotificationParameters = z.discriminatedUnion("type", [
|
|
29
74
|
TakeProfitNotificationParameters,
|
|
30
75
|
StopLossNotificationParameters,
|
|
31
76
|
TriggerOrderNotificationParameters,
|
|
32
|
-
DefaultTriggerNotificationParameters
|
|
77
|
+
DefaultTriggerNotificationParameters,
|
|
78
|
+
AttachedTriggerDiscardedNotificationParameters
|
|
33
79
|
]);
|
|
34
80
|
const Notification = z.object({
|
|
35
81
|
/**
|
|
@@ -58,4 +104,4 @@ const Notification = z.object({
|
|
|
58
104
|
updatedAt: z.string()
|
|
59
105
|
});
|
|
60
106
|
|
|
61
|
-
export { Notification, NotificationCategory, NotificationParameters };
|
|
107
|
+
export { Notification, NotificationCategory, NotificationMetric, NotificationParameters };
|
|
@@ -6,6 +6,10 @@ export declare const NotificationListResponse: z.ZodObject<{
|
|
|
6
6
|
TAKE_PROFIT_HIT: "TAKE_PROFIT_HIT";
|
|
7
7
|
STOP_LOSS_HIT: "STOP_LOSS_HIT";
|
|
8
8
|
TRIGGER_ORDER_HIT: "TRIGGER_ORDER_HIT";
|
|
9
|
+
TAKE_PROFIT_FAILED: "TAKE_PROFIT_FAILED";
|
|
10
|
+
STOP_LOSS_FAILED: "STOP_LOSS_FAILED";
|
|
11
|
+
TRIGGER_ORDER_FAILED: "TRIGGER_ORDER_FAILED";
|
|
12
|
+
ATTACHED_TRIGGER_DISCARDED: "ATTACHED_TRIGGER_DISCARDED";
|
|
9
13
|
}>;
|
|
10
14
|
parameters: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
11
15
|
type: z.ZodLiteral<"take_profit">;
|
|
@@ -18,6 +22,25 @@ export declare const NotificationListResponse: z.ZodObject<{
|
|
|
18
22
|
okx: "okx";
|
|
19
23
|
lighter: "lighter";
|
|
20
24
|
}>;
|
|
25
|
+
metric: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
price: "price";
|
|
27
|
+
notional: "notional";
|
|
28
|
+
ratio: "ratio";
|
|
29
|
+
weighted_ratio: "weighted_ratio";
|
|
30
|
+
upnl: "upnl";
|
|
31
|
+
upnl_bps: "upnl_bps";
|
|
32
|
+
funding_rate: "funding_rate";
|
|
33
|
+
prediction_market: "prediction_market";
|
|
34
|
+
btc_dominance: "btc_dominance";
|
|
35
|
+
ratio_trailing: "ratio_trailing";
|
|
36
|
+
price_trailing: "price_trailing";
|
|
37
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
38
|
+
notional_trailing: "notional_trailing";
|
|
39
|
+
upnl_trailing: "upnl_trailing";
|
|
40
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
41
|
+
}>>;
|
|
42
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
21
44
|
}, z.core.$strip>, z.ZodObject<{
|
|
22
45
|
type: z.ZodLiteral<"stop_loss">;
|
|
23
46
|
triggerId: z.ZodUUID;
|
|
@@ -29,6 +52,25 @@ export declare const NotificationListResponse: z.ZodObject<{
|
|
|
29
52
|
okx: "okx";
|
|
30
53
|
lighter: "lighter";
|
|
31
54
|
}>;
|
|
55
|
+
metric: z.ZodOptional<z.ZodEnum<{
|
|
56
|
+
price: "price";
|
|
57
|
+
notional: "notional";
|
|
58
|
+
ratio: "ratio";
|
|
59
|
+
weighted_ratio: "weighted_ratio";
|
|
60
|
+
upnl: "upnl";
|
|
61
|
+
upnl_bps: "upnl_bps";
|
|
62
|
+
funding_rate: "funding_rate";
|
|
63
|
+
prediction_market: "prediction_market";
|
|
64
|
+
btc_dominance: "btc_dominance";
|
|
65
|
+
ratio_trailing: "ratio_trailing";
|
|
66
|
+
price_trailing: "price_trailing";
|
|
67
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
68
|
+
notional_trailing: "notional_trailing";
|
|
69
|
+
upnl_trailing: "upnl_trailing";
|
|
70
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
71
|
+
}>>;
|
|
72
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
32
74
|
}, z.core.$strip>, z.ZodObject<{
|
|
33
75
|
type: z.ZodLiteral<"trigger_order">;
|
|
34
76
|
triggerId: z.ZodUUID;
|
|
@@ -40,6 +82,25 @@ export declare const NotificationListResponse: z.ZodObject<{
|
|
|
40
82
|
okx: "okx";
|
|
41
83
|
lighter: "lighter";
|
|
42
84
|
}>;
|
|
85
|
+
metric: z.ZodOptional<z.ZodEnum<{
|
|
86
|
+
price: "price";
|
|
87
|
+
notional: "notional";
|
|
88
|
+
ratio: "ratio";
|
|
89
|
+
weighted_ratio: "weighted_ratio";
|
|
90
|
+
upnl: "upnl";
|
|
91
|
+
upnl_bps: "upnl_bps";
|
|
92
|
+
funding_rate: "funding_rate";
|
|
93
|
+
prediction_market: "prediction_market";
|
|
94
|
+
btc_dominance: "btc_dominance";
|
|
95
|
+
ratio_trailing: "ratio_trailing";
|
|
96
|
+
price_trailing: "price_trailing";
|
|
97
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
98
|
+
notional_trailing: "notional_trailing";
|
|
99
|
+
upnl_trailing: "upnl_trailing";
|
|
100
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
101
|
+
}>>;
|
|
102
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
43
104
|
}, z.core.$strip>, z.ZodObject<{
|
|
44
105
|
type: z.ZodLiteral<"default_trigger">;
|
|
45
106
|
triggerId: z.ZodUUID;
|
|
@@ -50,6 +111,65 @@ export declare const NotificationListResponse: z.ZodObject<{
|
|
|
50
111
|
okx: "okx";
|
|
51
112
|
lighter: "lighter";
|
|
52
113
|
}>;
|
|
114
|
+
metric: z.ZodOptional<z.ZodEnum<{
|
|
115
|
+
price: "price";
|
|
116
|
+
notional: "notional";
|
|
117
|
+
ratio: "ratio";
|
|
118
|
+
weighted_ratio: "weighted_ratio";
|
|
119
|
+
upnl: "upnl";
|
|
120
|
+
upnl_bps: "upnl_bps";
|
|
121
|
+
funding_rate: "funding_rate";
|
|
122
|
+
prediction_market: "prediction_market";
|
|
123
|
+
btc_dominance: "btc_dominance";
|
|
124
|
+
ratio_trailing: "ratio_trailing";
|
|
125
|
+
price_trailing: "price_trailing";
|
|
126
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
127
|
+
notional_trailing: "notional_trailing";
|
|
128
|
+
upnl_trailing: "upnl_trailing";
|
|
129
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
130
|
+
}>>;
|
|
131
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
132
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
133
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
134
|
+
type: z.ZodLiteral<"attached_trigger_discarded">;
|
|
135
|
+
positionId: z.ZodUUID;
|
|
136
|
+
positionKey: z.ZodString;
|
|
137
|
+
connector: z.ZodEnum<{
|
|
138
|
+
hyperliquid: "hyperliquid";
|
|
139
|
+
binance: "binance";
|
|
140
|
+
bybit: "bybit";
|
|
141
|
+
okx: "okx";
|
|
142
|
+
lighter: "lighter";
|
|
143
|
+
}>;
|
|
144
|
+
discarded: z.ZodArray<z.ZodObject<{
|
|
145
|
+
bracketType: z.ZodEnum<{
|
|
146
|
+
STOP_LOSS: "STOP_LOSS";
|
|
147
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
148
|
+
}>;
|
|
149
|
+
metric: z.ZodEnum<{
|
|
150
|
+
price: "price";
|
|
151
|
+
notional: "notional";
|
|
152
|
+
ratio: "ratio";
|
|
153
|
+
weighted_ratio: "weighted_ratio";
|
|
154
|
+
upnl: "upnl";
|
|
155
|
+
upnl_bps: "upnl_bps";
|
|
156
|
+
funding_rate: "funding_rate";
|
|
157
|
+
prediction_market: "prediction_market";
|
|
158
|
+
btc_dominance: "btc_dominance";
|
|
159
|
+
ratio_trailing: "ratio_trailing";
|
|
160
|
+
price_trailing: "price_trailing";
|
|
161
|
+
weighted_ratio_trailing: "weighted_ratio_trailing";
|
|
162
|
+
notional_trailing: "notional_trailing";
|
|
163
|
+
upnl_trailing: "upnl_trailing";
|
|
164
|
+
upnl_bps_trailing: "upnl_bps_trailing";
|
|
165
|
+
}>;
|
|
166
|
+
level: z.ZodOptional<z.ZodNumber>;
|
|
167
|
+
reason: z.ZodEnum<{
|
|
168
|
+
TRIGGER_LIMIT: "TRIGGER_LIMIT";
|
|
169
|
+
TRAILING_ALREADY_EXISTS: "TRAILING_ALREADY_EXISTS";
|
|
170
|
+
}>;
|
|
171
|
+
}, z.core.$strip>>;
|
|
172
|
+
activeTriggerLimit: z.ZodNumber;
|
|
53
173
|
}, z.core.$strip>], "type">;
|
|
54
174
|
isRead: z.ZodBoolean;
|
|
55
175
|
createdAt: z.ZodString;
|