@pear-protocol/types 1.5.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.
@@ -30,6 +30,7 @@ export declare const Fill: z.ZodObject<{
30
30
  }>;
31
31
  reduceOnly: z.ZodBoolean;
32
32
  isExternal: z.ZodBoolean;
33
+ synthetic: z.ZodBoolean;
33
34
  quantity: z.ZodString;
34
35
  price: z.ZodString;
35
36
  usd: z.ZodString;
@@ -9,13 +9,9 @@ const Fill = z.object({
9
9
  * Fill UUID
10
10
  */
11
11
  id: z.uuid(),
12
- /**
13
- * Client order ID
14
- */
12
+ /** Client order ID (abbreviated as cloid) */
15
13
  cloid: z.string().optional(),
16
- /**
17
- * Exchange-native fill ID (tradeId / tid / etc)
18
- */
14
+ /** Exchange-native fill ID (tradeId / tid / etc) */
19
15
  exchangeFillId: z.string().optional(),
20
16
  /**
21
17
  * Fill lifecycle status
@@ -45,21 +41,17 @@ const Fill = z.object({
45
41
  * Reduce only flag
46
42
  */
47
43
  reduceOnly: z.boolean(),
48
- /**
49
- * True when the fill was created from external sync.
50
- */
44
+ /** True when the fill was created from external sync. */
51
45
  isExternal: z.boolean(),
52
46
  /**
53
- * Filled quantity
47
+ * True when the fill is a synthetic bridge fill (gap/gone reconstruction).
48
+ * Unpriceable gone-close synthetics carry "0" price/usd and should be displayed distinctly.
54
49
  */
50
+ synthetic: z.boolean(),
55
51
  quantity: z.string(),
56
- /**
57
- * Filled price
58
- */
52
+ /** Filled price — "0" on an unpriceable gone-close synthetic (no price guessing). */
59
53
  price: z.string(),
60
- /**
61
- * USD value
62
- */
54
+ /** USD value — "0" on an unpriceable gone-close synthetic (cannot compute without price). */
63
55
  usd: z.string(),
64
56
  /**
65
57
  * Trade fee paid
@@ -27,6 +27,7 @@ export declare const FillListResponse: z.ZodObject<{
27
27
  }>;
28
28
  reduceOnly: z.ZodBoolean;
29
29
  isExternal: z.ZodBoolean;
30
+ synthetic: z.ZodBoolean;
30
31
  quantity: z.ZodString;
31
32
  price: z.ZodString;
32
33
  usd: z.ZodString;
@@ -66,6 +67,7 @@ export declare const PositionFillListResponse: z.ZodObject<{
66
67
  }>;
67
68
  reduceOnly: z.ZodBoolean;
68
69
  isExternal: z.ZodBoolean;
70
+ synthetic: z.ZodBoolean;
69
71
  quantity: z.ZodString;
70
72
  price: z.ZodString;
71
73
  usd: z.ZodString;
@@ -77,6 +77,7 @@ export declare const Ladder: z.ZodObject<{
77
77
  }>;
78
78
  reduceOnly: z.ZodBoolean;
79
79
  isExternal: z.ZodBoolean;
80
+ synthetic: z.ZodBoolean;
80
81
  quantity: z.ZodString;
81
82
  price: z.ZodString;
82
83
  usd: z.ZodString;
@@ -276,6 +277,7 @@ export declare const Ladder: z.ZodObject<{
276
277
  }>;
277
278
  reduceOnly: z.ZodBoolean;
278
279
  isExternal: z.ZodBoolean;
280
+ synthetic: z.ZodBoolean;
279
281
  quantity: z.ZodString;
280
282
  price: z.ZodString;
281
283
  usd: z.ZodString;
@@ -521,6 +523,7 @@ export declare const Ladder: z.ZodObject<{
521
523
  }>;
522
524
  reduceOnly: z.ZodBoolean;
523
525
  isExternal: z.ZodBoolean;
526
+ synthetic: z.ZodBoolean;
524
527
  quantity: z.ZodString;
525
528
  price: z.ZodString;
526
529
  usd: z.ZodString;
@@ -72,6 +72,7 @@ export declare const CreateLadderResponse: z.ZodObject<{
72
72
  }>;
73
73
  reduceOnly: z.ZodBoolean;
74
74
  isExternal: z.ZodBoolean;
75
+ synthetic: z.ZodBoolean;
75
76
  quantity: z.ZodString;
76
77
  price: z.ZodString;
77
78
  usd: z.ZodString;
@@ -271,6 +272,7 @@ export declare const CreateLadderResponse: z.ZodObject<{
271
272
  }>;
272
273
  reduceOnly: z.ZodBoolean;
273
274
  isExternal: z.ZodBoolean;
275
+ synthetic: z.ZodBoolean;
274
276
  quantity: z.ZodString;
275
277
  price: z.ZodString;
276
278
  usd: z.ZodString;
@@ -516,6 +518,7 @@ export declare const CreateLadderResponse: z.ZodObject<{
516
518
  }>;
517
519
  reduceOnly: z.ZodBoolean;
518
520
  isExternal: z.ZodBoolean;
521
+ synthetic: z.ZodBoolean;
519
522
  quantity: z.ZodString;
520
523
  price: z.ZodString;
521
524
  usd: z.ZodString;
@@ -823,6 +826,7 @@ export declare const LadderResponse: z.ZodObject<{
823
826
  }>;
824
827
  reduceOnly: z.ZodBoolean;
825
828
  isExternal: z.ZodBoolean;
829
+ synthetic: z.ZodBoolean;
826
830
  quantity: z.ZodString;
827
831
  price: z.ZodString;
828
832
  usd: z.ZodString;
@@ -1022,6 +1026,7 @@ export declare const LadderResponse: z.ZodObject<{
1022
1026
  }>;
1023
1027
  reduceOnly: z.ZodBoolean;
1024
1028
  isExternal: z.ZodBoolean;
1029
+ synthetic: z.ZodBoolean;
1025
1030
  quantity: z.ZodString;
1026
1031
  price: z.ZodString;
1027
1032
  usd: z.ZodString;
@@ -1267,6 +1272,7 @@ export declare const LadderResponse: z.ZodObject<{
1267
1272
  }>;
1268
1273
  reduceOnly: z.ZodBoolean;
1269
1274
  isExternal: z.ZodBoolean;
1275
+ synthetic: z.ZodBoolean;
1270
1276
  quantity: z.ZodString;
1271
1277
  price: z.ZodString;
1272
1278
  usd: z.ZodString;
@@ -1576,6 +1582,7 @@ export declare const LadderListResponse: z.ZodObject<{
1576
1582
  }>;
1577
1583
  reduceOnly: z.ZodBoolean;
1578
1584
  isExternal: z.ZodBoolean;
1585
+ synthetic: z.ZodBoolean;
1579
1586
  quantity: z.ZodString;
1580
1587
  price: z.ZodString;
1581
1588
  usd: z.ZodString;
@@ -1775,6 +1782,7 @@ export declare const LadderListResponse: z.ZodObject<{
1775
1782
  }>;
1776
1783
  reduceOnly: z.ZodBoolean;
1777
1784
  isExternal: z.ZodBoolean;
1785
+ synthetic: z.ZodBoolean;
1778
1786
  quantity: z.ZodString;
1779
1787
  price: z.ZodString;
1780
1788
  usd: z.ZodString;
@@ -2020,6 +2028,7 @@ export declare const LadderListResponse: z.ZodObject<{
2020
2028
  }>;
2021
2029
  reduceOnly: z.ZodBoolean;
2022
2030
  isExternal: z.ZodBoolean;
2031
+ synthetic: z.ZodBoolean;
2023
2032
  quantity: z.ZodString;
2024
2033
  price: z.ZodString;
2025
2034
  usd: z.ZodString;
@@ -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(["TAKE_PROFIT_HIT", "STOP_LOSS_HIT", "TRIGGER_ORDER_HIT"]);
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 };