@pear-protocol/types 1.20.0 → 1.21.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/ladder/entities.d.ts +87 -0
- package/dist/ladder/entities.js +2 -0
- package/dist/ladder/payloads.d.ts +146 -2
- package/dist/ladder/payloads.js +14 -1
- package/dist/ladder/responses.d.ts +261 -0
- package/dist/notification/entities.d.ts +33 -2
- package/dist/notification/entities.js +18 -4
- package/dist/notification/responses.d.ts +15 -0
- package/dist/trigger/entities/index.d.ts +50 -0
- package/dist/trigger/entities/index.js +7 -0
- package/dist/trigger/payloads/index.d.ts +85 -0
- package/dist/trigger/payloads/index.js +14 -10
- package/dist/trigger/refinement/static.refinement.d.ts +11 -3
- package/dist/trigger/refinement/static.refinement.js +9 -2
- package/dist/trigger/responses.d.ts +30 -0
- package/package.json +1 -1
|
@@ -26,6 +26,78 @@ export declare const Ladder: z.ZodObject<{
|
|
|
26
26
|
ACTIVE: "ACTIVE";
|
|
27
27
|
COMPLETED: "COMPLETED";
|
|
28
28
|
}>;
|
|
29
|
+
attachTriggers: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
30
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
31
|
+
type: z.ZodLiteral<"MARKET">;
|
|
32
|
+
bracketType: z.ZodEnum<{
|
|
33
|
+
STOP_LOSS: "STOP_LOSS";
|
|
34
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
35
|
+
}>;
|
|
36
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
37
|
+
type: z.ZodLiteral<"notional">;
|
|
38
|
+
data: z.ZodObject<{
|
|
39
|
+
priceSource: z.ZodEnum<{
|
|
40
|
+
mid: "mid";
|
|
41
|
+
mark: "mark";
|
|
42
|
+
}>;
|
|
43
|
+
threshold: z.ZodNumber;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
type: z.ZodLiteral<"upnl">;
|
|
47
|
+
data: z.ZodObject<{
|
|
48
|
+
priceSource: z.ZodEnum<{
|
|
49
|
+
mid: "mid";
|
|
50
|
+
mark: "mark";
|
|
51
|
+
}>;
|
|
52
|
+
threshold: z.ZodNumber;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
55
|
+
type: z.ZodLiteral<"upnl_bps">;
|
|
56
|
+
data: z.ZodObject<{
|
|
57
|
+
priceSource: z.ZodEnum<{
|
|
58
|
+
mid: "mid";
|
|
59
|
+
mark: "mark";
|
|
60
|
+
}>;
|
|
61
|
+
threshold: z.ZodNumber;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
}, z.core.$strip>], "type">;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
66
|
+
type: z.ZodLiteral<"MARKET">;
|
|
67
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
68
|
+
type: z.ZodLiteral<"notional_trailing">;
|
|
69
|
+
data: z.ZodObject<{
|
|
70
|
+
priceSource: z.ZodEnum<{
|
|
71
|
+
mid: "mid";
|
|
72
|
+
mark: "mark";
|
|
73
|
+
}>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
76
|
+
type: z.ZodLiteral<"upnl_trailing">;
|
|
77
|
+
data: z.ZodObject<{
|
|
78
|
+
priceSource: z.ZodEnum<{
|
|
79
|
+
mid: "mid";
|
|
80
|
+
mark: "mark";
|
|
81
|
+
}>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
84
|
+
type: z.ZodLiteral<"upnl_bps_trailing">;
|
|
85
|
+
data: z.ZodObject<{
|
|
86
|
+
priceSource: z.ZodEnum<{
|
|
87
|
+
mid: "mid";
|
|
88
|
+
mark: "mark";
|
|
89
|
+
}>;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
}, z.core.$strip>], "type">;
|
|
92
|
+
trailing: z.ZodObject<{
|
|
93
|
+
mode: z.ZodEnum<{
|
|
94
|
+
RELATIVE_BPS: "RELATIVE_BPS";
|
|
95
|
+
ABSOLUTE_POINTS: "ABSOLUTE_POINTS";
|
|
96
|
+
}>;
|
|
97
|
+
deltaValue: z.ZodNumber;
|
|
98
|
+
activationValue: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
}, z.core.$strip>]>>>;
|
|
29
101
|
triggers: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
30
102
|
id: z.ZodUUID;
|
|
31
103
|
tradeAccountId: z.ZodUUID;
|
|
@@ -95,6 +167,11 @@ export declare const Ladder: z.ZodObject<{
|
|
|
95
167
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
96
168
|
NONE: "NONE";
|
|
97
169
|
}>;
|
|
170
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
171
|
+
STOP_LOSS: "STOP_LOSS";
|
|
172
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
173
|
+
NONE: "NONE";
|
|
174
|
+
}>>;
|
|
98
175
|
createdAt: z.ZodString;
|
|
99
176
|
updatedAt: z.ZodString;
|
|
100
177
|
intent: z.ZodLiteral<"OPEN">;
|
|
@@ -296,6 +373,11 @@ export declare const Ladder: z.ZodObject<{
|
|
|
296
373
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
297
374
|
NONE: "NONE";
|
|
298
375
|
}>;
|
|
376
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
377
|
+
STOP_LOSS: "STOP_LOSS";
|
|
378
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
379
|
+
NONE: "NONE";
|
|
380
|
+
}>>;
|
|
299
381
|
createdAt: z.ZodString;
|
|
300
382
|
updatedAt: z.ZodString;
|
|
301
383
|
intent: z.ZodLiteral<"ADJUST">;
|
|
@@ -543,6 +625,11 @@ export declare const Ladder: z.ZodObject<{
|
|
|
543
625
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
544
626
|
NONE: "NONE";
|
|
545
627
|
}>;
|
|
628
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
629
|
+
STOP_LOSS: "STOP_LOSS";
|
|
630
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
631
|
+
NONE: "NONE";
|
|
632
|
+
}>>;
|
|
546
633
|
createdAt: z.ZodString;
|
|
547
634
|
updatedAt: z.ZodString;
|
|
548
635
|
intent: z.ZodLiteral<"CLOSE">;
|
package/dist/ladder/entities.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Connector } from '../connector';
|
|
3
3
|
import { Trigger } from '../trigger';
|
|
4
|
+
import { AttachTriggerMarketCloseList } from '../trigger/payloads';
|
|
4
5
|
import { LadderConfig } from './payloads';
|
|
5
6
|
|
|
6
7
|
const LadderStatus = z.enum(["ACTIVE", "COMPLETED", "CANCELLED"]);
|
|
@@ -10,6 +11,7 @@ const Ladder = z.object({
|
|
|
10
11
|
positionKey: z.string(),
|
|
11
12
|
config: LadderConfig,
|
|
12
13
|
status: LadderStatus,
|
|
14
|
+
attachTriggers: AttachTriggerMarketCloseList.optional(),
|
|
13
15
|
triggers: z.array(Trigger),
|
|
14
16
|
createdAt: z.string(),
|
|
15
17
|
updatedAt: z.string()
|
|
@@ -111,6 +111,78 @@ export declare const CreateLadderMarketOpen: z.ZodObject<{
|
|
|
111
111
|
levels: z.ZodInt;
|
|
112
112
|
weighting: z.ZodDefault<z.ZodLiteral<"EQUAL">>;
|
|
113
113
|
}, z.core.$strip>;
|
|
114
|
+
attachTriggers: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
115
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
116
|
+
type: z.ZodLiteral<"MARKET">;
|
|
117
|
+
bracketType: z.ZodEnum<{
|
|
118
|
+
STOP_LOSS: "STOP_LOSS";
|
|
119
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
120
|
+
}>;
|
|
121
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
122
|
+
type: z.ZodLiteral<"notional">;
|
|
123
|
+
data: z.ZodObject<{
|
|
124
|
+
priceSource: z.ZodEnum<{
|
|
125
|
+
mid: "mid";
|
|
126
|
+
mark: "mark";
|
|
127
|
+
}>;
|
|
128
|
+
threshold: z.ZodNumber;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
131
|
+
type: z.ZodLiteral<"upnl">;
|
|
132
|
+
data: z.ZodObject<{
|
|
133
|
+
priceSource: z.ZodEnum<{
|
|
134
|
+
mid: "mid";
|
|
135
|
+
mark: "mark";
|
|
136
|
+
}>;
|
|
137
|
+
threshold: z.ZodNumber;
|
|
138
|
+
}, z.core.$strip>;
|
|
139
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
140
|
+
type: z.ZodLiteral<"upnl_bps">;
|
|
141
|
+
data: z.ZodObject<{
|
|
142
|
+
priceSource: z.ZodEnum<{
|
|
143
|
+
mid: "mid";
|
|
144
|
+
mark: "mark";
|
|
145
|
+
}>;
|
|
146
|
+
threshold: z.ZodNumber;
|
|
147
|
+
}, z.core.$strip>;
|
|
148
|
+
}, z.core.$strip>], "type">;
|
|
149
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
150
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
151
|
+
type: z.ZodLiteral<"MARKET">;
|
|
152
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
153
|
+
type: z.ZodLiteral<"notional_trailing">;
|
|
154
|
+
data: z.ZodObject<{
|
|
155
|
+
priceSource: z.ZodEnum<{
|
|
156
|
+
mid: "mid";
|
|
157
|
+
mark: "mark";
|
|
158
|
+
}>;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
161
|
+
type: z.ZodLiteral<"upnl_trailing">;
|
|
162
|
+
data: z.ZodObject<{
|
|
163
|
+
priceSource: z.ZodEnum<{
|
|
164
|
+
mid: "mid";
|
|
165
|
+
mark: "mark";
|
|
166
|
+
}>;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
169
|
+
type: z.ZodLiteral<"upnl_bps_trailing">;
|
|
170
|
+
data: z.ZodObject<{
|
|
171
|
+
priceSource: z.ZodEnum<{
|
|
172
|
+
mid: "mid";
|
|
173
|
+
mark: "mark";
|
|
174
|
+
}>;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
}, z.core.$strip>], "type">;
|
|
177
|
+
trailing: z.ZodObject<{
|
|
178
|
+
mode: z.ZodEnum<{
|
|
179
|
+
RELATIVE_BPS: "RELATIVE_BPS";
|
|
180
|
+
ABSOLUTE_POINTS: "ABSOLUTE_POINTS";
|
|
181
|
+
}>;
|
|
182
|
+
deltaValue: z.ZodNumber;
|
|
183
|
+
activationValue: z.ZodOptional<z.ZodNumber>;
|
|
184
|
+
}, z.core.$strip>;
|
|
185
|
+
}, z.core.$strip>]>>>;
|
|
114
186
|
payload: z.ZodObject<{
|
|
115
187
|
type: z.ZodLiteral<"MARKET">;
|
|
116
188
|
legs: z.ZodTuple<[z.ZodObject<{
|
|
@@ -137,7 +209,7 @@ export declare const CreateLadderMarketOpen: z.ZodObject<{
|
|
|
137
209
|
amount: z.ZodString;
|
|
138
210
|
}, z.core.$strip>>;
|
|
139
211
|
}, z.core.$strip>;
|
|
140
|
-
}, z.core.$
|
|
212
|
+
}, z.core.$strict>;
|
|
141
213
|
export declare const CreateLadder: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
142
214
|
type: z.ZodLiteral<"MARKET">;
|
|
143
215
|
intent: z.ZodLiteral<"OPEN">;
|
|
@@ -196,6 +268,78 @@ export declare const CreateLadder: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
196
268
|
levels: z.ZodInt;
|
|
197
269
|
weighting: z.ZodDefault<z.ZodLiteral<"EQUAL">>;
|
|
198
270
|
}, z.core.$strip>;
|
|
271
|
+
attachTriggers: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
272
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
273
|
+
type: z.ZodLiteral<"MARKET">;
|
|
274
|
+
bracketType: z.ZodEnum<{
|
|
275
|
+
STOP_LOSS: "STOP_LOSS";
|
|
276
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
277
|
+
}>;
|
|
278
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
279
|
+
type: z.ZodLiteral<"notional">;
|
|
280
|
+
data: z.ZodObject<{
|
|
281
|
+
priceSource: z.ZodEnum<{
|
|
282
|
+
mid: "mid";
|
|
283
|
+
mark: "mark";
|
|
284
|
+
}>;
|
|
285
|
+
threshold: z.ZodNumber;
|
|
286
|
+
}, z.core.$strip>;
|
|
287
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
288
|
+
type: z.ZodLiteral<"upnl">;
|
|
289
|
+
data: z.ZodObject<{
|
|
290
|
+
priceSource: z.ZodEnum<{
|
|
291
|
+
mid: "mid";
|
|
292
|
+
mark: "mark";
|
|
293
|
+
}>;
|
|
294
|
+
threshold: z.ZodNumber;
|
|
295
|
+
}, z.core.$strip>;
|
|
296
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
297
|
+
type: z.ZodLiteral<"upnl_bps">;
|
|
298
|
+
data: z.ZodObject<{
|
|
299
|
+
priceSource: z.ZodEnum<{
|
|
300
|
+
mid: "mid";
|
|
301
|
+
mark: "mark";
|
|
302
|
+
}>;
|
|
303
|
+
threshold: z.ZodNumber;
|
|
304
|
+
}, z.core.$strip>;
|
|
305
|
+
}, z.core.$strip>], "type">;
|
|
306
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
307
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
308
|
+
type: z.ZodLiteral<"MARKET">;
|
|
309
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
310
|
+
type: z.ZodLiteral<"notional_trailing">;
|
|
311
|
+
data: z.ZodObject<{
|
|
312
|
+
priceSource: z.ZodEnum<{
|
|
313
|
+
mid: "mid";
|
|
314
|
+
mark: "mark";
|
|
315
|
+
}>;
|
|
316
|
+
}, z.core.$strip>;
|
|
317
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
318
|
+
type: z.ZodLiteral<"upnl_trailing">;
|
|
319
|
+
data: z.ZodObject<{
|
|
320
|
+
priceSource: z.ZodEnum<{
|
|
321
|
+
mid: "mid";
|
|
322
|
+
mark: "mark";
|
|
323
|
+
}>;
|
|
324
|
+
}, z.core.$strip>;
|
|
325
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
326
|
+
type: z.ZodLiteral<"upnl_bps_trailing">;
|
|
327
|
+
data: z.ZodObject<{
|
|
328
|
+
priceSource: z.ZodEnum<{
|
|
329
|
+
mid: "mid";
|
|
330
|
+
mark: "mark";
|
|
331
|
+
}>;
|
|
332
|
+
}, z.core.$strip>;
|
|
333
|
+
}, z.core.$strip>], "type">;
|
|
334
|
+
trailing: z.ZodObject<{
|
|
335
|
+
mode: z.ZodEnum<{
|
|
336
|
+
RELATIVE_BPS: "RELATIVE_BPS";
|
|
337
|
+
ABSOLUTE_POINTS: "ABSOLUTE_POINTS";
|
|
338
|
+
}>;
|
|
339
|
+
deltaValue: z.ZodNumber;
|
|
340
|
+
activationValue: z.ZodOptional<z.ZodNumber>;
|
|
341
|
+
}, z.core.$strip>;
|
|
342
|
+
}, z.core.$strip>]>>>;
|
|
199
343
|
payload: z.ZodObject<{
|
|
200
344
|
type: z.ZodLiteral<"MARKET">;
|
|
201
345
|
legs: z.ZodTuple<[z.ZodObject<{
|
|
@@ -222,7 +366,7 @@ export declare const CreateLadder: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
222
366
|
amount: z.ZodString;
|
|
223
367
|
}, z.core.$strip>>;
|
|
224
368
|
}, z.core.$strip>;
|
|
225
|
-
}, z.core.$
|
|
369
|
+
}, z.core.$strict>], "type">;
|
|
226
370
|
export type LadderConfig = z.output<typeof LadderConfig>;
|
|
227
371
|
export type LadderConditionOpen = z.output<typeof LadderConditionOpen>;
|
|
228
372
|
export type CreateLadderMarketOpen = z.output<typeof CreateLadderMarketOpen>;
|
package/dist/ladder/payloads.js
CHANGED
|
@@ -5,6 +5,7 @@ import { AssetWeight, Side } from '../common/schema';
|
|
|
5
5
|
import { TradeLegPostOnly } from '../common/trade-legs';
|
|
6
6
|
import { InstrumentId } from '../instrument';
|
|
7
7
|
import { MetricTrack } from '../trigger/common';
|
|
8
|
+
import { AttachTriggerMarketCloseList } from '../trigger/payloads';
|
|
8
9
|
|
|
9
10
|
const LadderThreshold = z.number().positive({
|
|
10
11
|
message: "Threshold must be greater than 0"
|
|
@@ -56,17 +57,29 @@ const LadderConditionOpen = z.discriminatedUnion("type", [
|
|
|
56
57
|
LadderPriceOpen,
|
|
57
58
|
LadderWeightedRatioOpen
|
|
58
59
|
]);
|
|
60
|
+
const LadderAttachTriggers = AttachTriggerMarketCloseList.superRefine((attachTriggers, ctx) => {
|
|
61
|
+
attachTriggers.forEach((attachTrigger, index) => {
|
|
62
|
+
if (attachTrigger.condition.type === "notional" || attachTrigger.condition.type === "notional_trailing") {
|
|
63
|
+
ctx.addIssue({
|
|
64
|
+
code: "custom",
|
|
65
|
+
path: [index, "condition", "type"],
|
|
66
|
+
message: "Ladder brackets cannot use notional conditions; use upnl or upnl_bps."
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
59
71
|
const CreateLadderMarketOpen = z.object({
|
|
60
72
|
type: z.literal("MARKET"),
|
|
61
73
|
intent: z.literal("OPEN"),
|
|
62
74
|
clientId: ClientIdCode,
|
|
63
75
|
condition: LadderConditionOpen,
|
|
64
76
|
config: LadderConfig,
|
|
77
|
+
attachTriggers: LadderAttachTriggers.optional(),
|
|
65
78
|
payload: z.object({
|
|
66
79
|
type: z.literal("MARKET"),
|
|
67
80
|
legs: z.tuple([TradeLegPostOnly]).rest(TradeLegPostOnly).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols)
|
|
68
81
|
})
|
|
69
|
-
});
|
|
82
|
+
}).strict();
|
|
70
83
|
const CreateLadder = z.discriminatedUnion("type", [CreateLadderMarketOpen]);
|
|
71
84
|
|
|
72
85
|
export { CreateLadder, CreateLadderMarketOpen, LadderConditionOpen, LadderConfig };
|
|
@@ -21,6 +21,78 @@ export declare const CreateLadderResponse: z.ZodObject<{
|
|
|
21
21
|
ACTIVE: "ACTIVE";
|
|
22
22
|
COMPLETED: "COMPLETED";
|
|
23
23
|
}>;
|
|
24
|
+
attachTriggers: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
25
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
26
|
+
type: z.ZodLiteral<"MARKET">;
|
|
27
|
+
bracketType: z.ZodEnum<{
|
|
28
|
+
STOP_LOSS: "STOP_LOSS";
|
|
29
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
30
|
+
}>;
|
|
31
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
32
|
+
type: z.ZodLiteral<"notional">;
|
|
33
|
+
data: z.ZodObject<{
|
|
34
|
+
priceSource: z.ZodEnum<{
|
|
35
|
+
mid: "mid";
|
|
36
|
+
mark: "mark";
|
|
37
|
+
}>;
|
|
38
|
+
threshold: z.ZodNumber;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
+
type: z.ZodLiteral<"upnl">;
|
|
42
|
+
data: z.ZodObject<{
|
|
43
|
+
priceSource: z.ZodEnum<{
|
|
44
|
+
mid: "mid";
|
|
45
|
+
mark: "mark";
|
|
46
|
+
}>;
|
|
47
|
+
threshold: z.ZodNumber;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
50
|
+
type: z.ZodLiteral<"upnl_bps">;
|
|
51
|
+
data: z.ZodObject<{
|
|
52
|
+
priceSource: z.ZodEnum<{
|
|
53
|
+
mid: "mid";
|
|
54
|
+
mark: "mark";
|
|
55
|
+
}>;
|
|
56
|
+
threshold: z.ZodNumber;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
}, z.core.$strip>], "type">;
|
|
59
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
60
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
61
|
+
type: z.ZodLiteral<"MARKET">;
|
|
62
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
63
|
+
type: z.ZodLiteral<"notional_trailing">;
|
|
64
|
+
data: z.ZodObject<{
|
|
65
|
+
priceSource: z.ZodEnum<{
|
|
66
|
+
mid: "mid";
|
|
67
|
+
mark: "mark";
|
|
68
|
+
}>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
type: z.ZodLiteral<"upnl_trailing">;
|
|
72
|
+
data: z.ZodObject<{
|
|
73
|
+
priceSource: z.ZodEnum<{
|
|
74
|
+
mid: "mid";
|
|
75
|
+
mark: "mark";
|
|
76
|
+
}>;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"upnl_bps_trailing">;
|
|
80
|
+
data: z.ZodObject<{
|
|
81
|
+
priceSource: z.ZodEnum<{
|
|
82
|
+
mid: "mid";
|
|
83
|
+
mark: "mark";
|
|
84
|
+
}>;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
}, z.core.$strip>], "type">;
|
|
87
|
+
trailing: z.ZodObject<{
|
|
88
|
+
mode: z.ZodEnum<{
|
|
89
|
+
RELATIVE_BPS: "RELATIVE_BPS";
|
|
90
|
+
ABSOLUTE_POINTS: "ABSOLUTE_POINTS";
|
|
91
|
+
}>;
|
|
92
|
+
deltaValue: z.ZodNumber;
|
|
93
|
+
activationValue: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
}, z.core.$strip>]>>>;
|
|
24
96
|
triggers: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
25
97
|
id: z.ZodUUID;
|
|
26
98
|
tradeAccountId: z.ZodUUID;
|
|
@@ -90,6 +162,11 @@ export declare const CreateLadderResponse: z.ZodObject<{
|
|
|
90
162
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
91
163
|
NONE: "NONE";
|
|
92
164
|
}>;
|
|
165
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
166
|
+
STOP_LOSS: "STOP_LOSS";
|
|
167
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
168
|
+
NONE: "NONE";
|
|
169
|
+
}>>;
|
|
93
170
|
createdAt: z.ZodString;
|
|
94
171
|
updatedAt: z.ZodString;
|
|
95
172
|
intent: z.ZodLiteral<"OPEN">;
|
|
@@ -291,6 +368,11 @@ export declare const CreateLadderResponse: z.ZodObject<{
|
|
|
291
368
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
292
369
|
NONE: "NONE";
|
|
293
370
|
}>;
|
|
371
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
372
|
+
STOP_LOSS: "STOP_LOSS";
|
|
373
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
374
|
+
NONE: "NONE";
|
|
375
|
+
}>>;
|
|
294
376
|
createdAt: z.ZodString;
|
|
295
377
|
updatedAt: z.ZodString;
|
|
296
378
|
intent: z.ZodLiteral<"ADJUST">;
|
|
@@ -538,6 +620,11 @@ export declare const CreateLadderResponse: z.ZodObject<{
|
|
|
538
620
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
539
621
|
NONE: "NONE";
|
|
540
622
|
}>;
|
|
623
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
624
|
+
STOP_LOSS: "STOP_LOSS";
|
|
625
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
626
|
+
NONE: "NONE";
|
|
627
|
+
}>>;
|
|
541
628
|
createdAt: z.ZodString;
|
|
542
629
|
updatedAt: z.ZodString;
|
|
543
630
|
intent: z.ZodLiteral<"CLOSE">;
|
|
@@ -778,6 +865,78 @@ export declare const LadderResponse: z.ZodObject<{
|
|
|
778
865
|
ACTIVE: "ACTIVE";
|
|
779
866
|
COMPLETED: "COMPLETED";
|
|
780
867
|
}>;
|
|
868
|
+
attachTriggers: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
869
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
870
|
+
type: z.ZodLiteral<"MARKET">;
|
|
871
|
+
bracketType: z.ZodEnum<{
|
|
872
|
+
STOP_LOSS: "STOP_LOSS";
|
|
873
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
874
|
+
}>;
|
|
875
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
876
|
+
type: z.ZodLiteral<"notional">;
|
|
877
|
+
data: z.ZodObject<{
|
|
878
|
+
priceSource: z.ZodEnum<{
|
|
879
|
+
mid: "mid";
|
|
880
|
+
mark: "mark";
|
|
881
|
+
}>;
|
|
882
|
+
threshold: z.ZodNumber;
|
|
883
|
+
}, z.core.$strip>;
|
|
884
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
885
|
+
type: z.ZodLiteral<"upnl">;
|
|
886
|
+
data: z.ZodObject<{
|
|
887
|
+
priceSource: z.ZodEnum<{
|
|
888
|
+
mid: "mid";
|
|
889
|
+
mark: "mark";
|
|
890
|
+
}>;
|
|
891
|
+
threshold: z.ZodNumber;
|
|
892
|
+
}, z.core.$strip>;
|
|
893
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
894
|
+
type: z.ZodLiteral<"upnl_bps">;
|
|
895
|
+
data: z.ZodObject<{
|
|
896
|
+
priceSource: z.ZodEnum<{
|
|
897
|
+
mid: "mid";
|
|
898
|
+
mark: "mark";
|
|
899
|
+
}>;
|
|
900
|
+
threshold: z.ZodNumber;
|
|
901
|
+
}, z.core.$strip>;
|
|
902
|
+
}, z.core.$strip>], "type">;
|
|
903
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
904
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
905
|
+
type: z.ZodLiteral<"MARKET">;
|
|
906
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
907
|
+
type: z.ZodLiteral<"notional_trailing">;
|
|
908
|
+
data: z.ZodObject<{
|
|
909
|
+
priceSource: z.ZodEnum<{
|
|
910
|
+
mid: "mid";
|
|
911
|
+
mark: "mark";
|
|
912
|
+
}>;
|
|
913
|
+
}, z.core.$strip>;
|
|
914
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
915
|
+
type: z.ZodLiteral<"upnl_trailing">;
|
|
916
|
+
data: z.ZodObject<{
|
|
917
|
+
priceSource: z.ZodEnum<{
|
|
918
|
+
mid: "mid";
|
|
919
|
+
mark: "mark";
|
|
920
|
+
}>;
|
|
921
|
+
}, z.core.$strip>;
|
|
922
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
923
|
+
type: z.ZodLiteral<"upnl_bps_trailing">;
|
|
924
|
+
data: z.ZodObject<{
|
|
925
|
+
priceSource: z.ZodEnum<{
|
|
926
|
+
mid: "mid";
|
|
927
|
+
mark: "mark";
|
|
928
|
+
}>;
|
|
929
|
+
}, z.core.$strip>;
|
|
930
|
+
}, z.core.$strip>], "type">;
|
|
931
|
+
trailing: z.ZodObject<{
|
|
932
|
+
mode: z.ZodEnum<{
|
|
933
|
+
RELATIVE_BPS: "RELATIVE_BPS";
|
|
934
|
+
ABSOLUTE_POINTS: "ABSOLUTE_POINTS";
|
|
935
|
+
}>;
|
|
936
|
+
deltaValue: z.ZodNumber;
|
|
937
|
+
activationValue: z.ZodOptional<z.ZodNumber>;
|
|
938
|
+
}, z.core.$strip>;
|
|
939
|
+
}, z.core.$strip>]>>>;
|
|
781
940
|
triggers: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
782
941
|
id: z.ZodUUID;
|
|
783
942
|
tradeAccountId: z.ZodUUID;
|
|
@@ -847,6 +1006,11 @@ export declare const LadderResponse: z.ZodObject<{
|
|
|
847
1006
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
848
1007
|
NONE: "NONE";
|
|
849
1008
|
}>;
|
|
1009
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1010
|
+
STOP_LOSS: "STOP_LOSS";
|
|
1011
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1012
|
+
NONE: "NONE";
|
|
1013
|
+
}>>;
|
|
850
1014
|
createdAt: z.ZodString;
|
|
851
1015
|
updatedAt: z.ZodString;
|
|
852
1016
|
intent: z.ZodLiteral<"OPEN">;
|
|
@@ -1048,6 +1212,11 @@ export declare const LadderResponse: z.ZodObject<{
|
|
|
1048
1212
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1049
1213
|
NONE: "NONE";
|
|
1050
1214
|
}>;
|
|
1215
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1216
|
+
STOP_LOSS: "STOP_LOSS";
|
|
1217
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1218
|
+
NONE: "NONE";
|
|
1219
|
+
}>>;
|
|
1051
1220
|
createdAt: z.ZodString;
|
|
1052
1221
|
updatedAt: z.ZodString;
|
|
1053
1222
|
intent: z.ZodLiteral<"ADJUST">;
|
|
@@ -1295,6 +1464,11 @@ export declare const LadderResponse: z.ZodObject<{
|
|
|
1295
1464
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1296
1465
|
NONE: "NONE";
|
|
1297
1466
|
}>;
|
|
1467
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1468
|
+
STOP_LOSS: "STOP_LOSS";
|
|
1469
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1470
|
+
NONE: "NONE";
|
|
1471
|
+
}>>;
|
|
1298
1472
|
createdAt: z.ZodString;
|
|
1299
1473
|
updatedAt: z.ZodString;
|
|
1300
1474
|
intent: z.ZodLiteral<"CLOSE">;
|
|
@@ -1537,6 +1711,78 @@ export declare const LadderListResponse: z.ZodObject<{
|
|
|
1537
1711
|
ACTIVE: "ACTIVE";
|
|
1538
1712
|
COMPLETED: "COMPLETED";
|
|
1539
1713
|
}>;
|
|
1714
|
+
attachTriggers: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1715
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
1716
|
+
type: z.ZodLiteral<"MARKET">;
|
|
1717
|
+
bracketType: z.ZodEnum<{
|
|
1718
|
+
STOP_LOSS: "STOP_LOSS";
|
|
1719
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1720
|
+
}>;
|
|
1721
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1722
|
+
type: z.ZodLiteral<"notional">;
|
|
1723
|
+
data: z.ZodObject<{
|
|
1724
|
+
priceSource: z.ZodEnum<{
|
|
1725
|
+
mid: "mid";
|
|
1726
|
+
mark: "mark";
|
|
1727
|
+
}>;
|
|
1728
|
+
threshold: z.ZodNumber;
|
|
1729
|
+
}, z.core.$strip>;
|
|
1730
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1731
|
+
type: z.ZodLiteral<"upnl">;
|
|
1732
|
+
data: z.ZodObject<{
|
|
1733
|
+
priceSource: z.ZodEnum<{
|
|
1734
|
+
mid: "mid";
|
|
1735
|
+
mark: "mark";
|
|
1736
|
+
}>;
|
|
1737
|
+
threshold: z.ZodNumber;
|
|
1738
|
+
}, z.core.$strip>;
|
|
1739
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1740
|
+
type: z.ZodLiteral<"upnl_bps">;
|
|
1741
|
+
data: z.ZodObject<{
|
|
1742
|
+
priceSource: z.ZodEnum<{
|
|
1743
|
+
mid: "mid";
|
|
1744
|
+
mark: "mark";
|
|
1745
|
+
}>;
|
|
1746
|
+
threshold: z.ZodNumber;
|
|
1747
|
+
}, z.core.$strip>;
|
|
1748
|
+
}, z.core.$strip>], "type">;
|
|
1749
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1750
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
1751
|
+
type: z.ZodLiteral<"MARKET">;
|
|
1752
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1753
|
+
type: z.ZodLiteral<"notional_trailing">;
|
|
1754
|
+
data: z.ZodObject<{
|
|
1755
|
+
priceSource: z.ZodEnum<{
|
|
1756
|
+
mid: "mid";
|
|
1757
|
+
mark: "mark";
|
|
1758
|
+
}>;
|
|
1759
|
+
}, z.core.$strip>;
|
|
1760
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1761
|
+
type: z.ZodLiteral<"upnl_trailing">;
|
|
1762
|
+
data: z.ZodObject<{
|
|
1763
|
+
priceSource: z.ZodEnum<{
|
|
1764
|
+
mid: "mid";
|
|
1765
|
+
mark: "mark";
|
|
1766
|
+
}>;
|
|
1767
|
+
}, z.core.$strip>;
|
|
1768
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1769
|
+
type: z.ZodLiteral<"upnl_bps_trailing">;
|
|
1770
|
+
data: z.ZodObject<{
|
|
1771
|
+
priceSource: z.ZodEnum<{
|
|
1772
|
+
mid: "mid";
|
|
1773
|
+
mark: "mark";
|
|
1774
|
+
}>;
|
|
1775
|
+
}, z.core.$strip>;
|
|
1776
|
+
}, z.core.$strip>], "type">;
|
|
1777
|
+
trailing: z.ZodObject<{
|
|
1778
|
+
mode: z.ZodEnum<{
|
|
1779
|
+
RELATIVE_BPS: "RELATIVE_BPS";
|
|
1780
|
+
ABSOLUTE_POINTS: "ABSOLUTE_POINTS";
|
|
1781
|
+
}>;
|
|
1782
|
+
deltaValue: z.ZodNumber;
|
|
1783
|
+
activationValue: z.ZodOptional<z.ZodNumber>;
|
|
1784
|
+
}, z.core.$strip>;
|
|
1785
|
+
}, z.core.$strip>]>>>;
|
|
1540
1786
|
triggers: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1541
1787
|
id: z.ZodUUID;
|
|
1542
1788
|
tradeAccountId: z.ZodUUID;
|
|
@@ -1606,6 +1852,11 @@ export declare const LadderListResponse: z.ZodObject<{
|
|
|
1606
1852
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1607
1853
|
NONE: "NONE";
|
|
1608
1854
|
}>;
|
|
1855
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1856
|
+
STOP_LOSS: "STOP_LOSS";
|
|
1857
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1858
|
+
NONE: "NONE";
|
|
1859
|
+
}>>;
|
|
1609
1860
|
createdAt: z.ZodString;
|
|
1610
1861
|
updatedAt: z.ZodString;
|
|
1611
1862
|
intent: z.ZodLiteral<"OPEN">;
|
|
@@ -1807,6 +2058,11 @@ export declare const LadderListResponse: z.ZodObject<{
|
|
|
1807
2058
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1808
2059
|
NONE: "NONE";
|
|
1809
2060
|
}>;
|
|
2061
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
2062
|
+
STOP_LOSS: "STOP_LOSS";
|
|
2063
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
2064
|
+
NONE: "NONE";
|
|
2065
|
+
}>>;
|
|
1810
2066
|
createdAt: z.ZodString;
|
|
1811
2067
|
updatedAt: z.ZodString;
|
|
1812
2068
|
intent: z.ZodLiteral<"ADJUST">;
|
|
@@ -2054,6 +2310,11 @@ export declare const LadderListResponse: z.ZodObject<{
|
|
|
2054
2310
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
2055
2311
|
NONE: "NONE";
|
|
2056
2312
|
}>;
|
|
2313
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
2314
|
+
STOP_LOSS: "STOP_LOSS";
|
|
2315
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
2316
|
+
NONE: "NONE";
|
|
2317
|
+
}>>;
|
|
2057
2318
|
createdAt: z.ZodString;
|
|
2058
2319
|
updatedAt: z.ZodString;
|
|
2059
2320
|
intent: z.ZodLiteral<"CLOSE">;
|
|
@@ -5,8 +5,9 @@ import { z } from 'zod';
|
|
|
5
5
|
* execute; `ATTACHED_TRIGGER_DISCARDED` means requested close protection could
|
|
6
6
|
* not be placed after a position opened; the `AUTO_REBALANCE_*` categories cover
|
|
7
7
|
* an auto-rebalance config acting on, or stopping itself over, the position it
|
|
8
|
-
* watches
|
|
9
|
-
*
|
|
8
|
+
* watches; `TRIGGER_CANCELLED_MIS_SCALED` means the remediation sweep cancelled
|
|
9
|
+
* an unreachable stop loss. Outcome lives here in the category; display details
|
|
10
|
+
* live in the `parameters` payload below.
|
|
10
11
|
*/
|
|
11
12
|
export declare const NotificationCategory: z.ZodEnum<{
|
|
12
13
|
TAKE_PROFIT_HIT: "TAKE_PROFIT_HIT";
|
|
@@ -19,6 +20,7 @@ export declare const NotificationCategory: z.ZodEnum<{
|
|
|
19
20
|
AUTO_REBALANCE_EXECUTED: "AUTO_REBALANCE_EXECUTED";
|
|
20
21
|
AUTO_REBALANCE_FAILED: "AUTO_REBALANCE_FAILED";
|
|
21
22
|
AUTO_REBALANCE_PAUSED: "AUTO_REBALANCE_PAUSED";
|
|
23
|
+
TRIGGER_CANCELLED_MIS_SCALED: "TRIGGER_CANCELLED_MIS_SCALED";
|
|
22
24
|
}>;
|
|
23
25
|
export type NotificationCategory = z.infer<typeof NotificationCategory>;
|
|
24
26
|
export declare const NotificationMetric: z.ZodEnum<{
|
|
@@ -48,6 +50,10 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
48
50
|
SELL: "SELL";
|
|
49
51
|
}>;
|
|
50
52
|
}, z.core.$strip>>;
|
|
53
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
54
|
+
STOP_LOSS: "STOP_LOSS";
|
|
55
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
56
|
+
}>>;
|
|
51
57
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
52
58
|
price: "price";
|
|
53
59
|
notional: "notional";
|
|
@@ -86,6 +92,10 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
86
92
|
SELL: "SELL";
|
|
87
93
|
}>;
|
|
88
94
|
}, z.core.$strip>>;
|
|
95
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
96
|
+
STOP_LOSS: "STOP_LOSS";
|
|
97
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
98
|
+
}>>;
|
|
89
99
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
90
100
|
price: "price";
|
|
91
101
|
notional: "notional";
|
|
@@ -323,6 +333,12 @@ export declare const NotificationParameters: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
323
333
|
LIVE_BETA: "LIVE_BETA";
|
|
324
334
|
}>;
|
|
325
335
|
type: z.ZodLiteral<"auto_rebalance_paused">;
|
|
336
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
337
|
+
type: z.ZodLiteral<"trigger_cancelled_mis_scaled">;
|
|
338
|
+
triggerId: z.ZodUUID;
|
|
339
|
+
positionKey: z.ZodString;
|
|
340
|
+
storedBps: z.ZodNumber;
|
|
341
|
+
readingMarginPct: z.ZodNumber;
|
|
326
342
|
}, z.core.$strip>], "type">;
|
|
327
343
|
export type NotificationParameters = z.output<typeof NotificationParameters>;
|
|
328
344
|
export declare const Notification: z.ZodObject<{
|
|
@@ -338,6 +354,7 @@ export declare const Notification: z.ZodObject<{
|
|
|
338
354
|
AUTO_REBALANCE_EXECUTED: "AUTO_REBALANCE_EXECUTED";
|
|
339
355
|
AUTO_REBALANCE_FAILED: "AUTO_REBALANCE_FAILED";
|
|
340
356
|
AUTO_REBALANCE_PAUSED: "AUTO_REBALANCE_PAUSED";
|
|
357
|
+
TRIGGER_CANCELLED_MIS_SCALED: "TRIGGER_CANCELLED_MIS_SCALED";
|
|
341
358
|
}>;
|
|
342
359
|
parameters: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
343
360
|
legs: z.ZodArray<z.ZodObject<{
|
|
@@ -348,6 +365,10 @@ export declare const Notification: z.ZodObject<{
|
|
|
348
365
|
SELL: "SELL";
|
|
349
366
|
}>;
|
|
350
367
|
}, z.core.$strip>>;
|
|
368
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
369
|
+
STOP_LOSS: "STOP_LOSS";
|
|
370
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
371
|
+
}>>;
|
|
351
372
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
352
373
|
price: "price";
|
|
353
374
|
notional: "notional";
|
|
@@ -386,6 +407,10 @@ export declare const Notification: z.ZodObject<{
|
|
|
386
407
|
SELL: "SELL";
|
|
387
408
|
}>;
|
|
388
409
|
}, z.core.$strip>>;
|
|
410
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
411
|
+
STOP_LOSS: "STOP_LOSS";
|
|
412
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
413
|
+
}>>;
|
|
389
414
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
390
415
|
price: "price";
|
|
391
416
|
notional: "notional";
|
|
@@ -623,6 +648,12 @@ export declare const Notification: z.ZodObject<{
|
|
|
623
648
|
LIVE_BETA: "LIVE_BETA";
|
|
624
649
|
}>;
|
|
625
650
|
type: z.ZodLiteral<"auto_rebalance_paused">;
|
|
651
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
652
|
+
type: z.ZodLiteral<"trigger_cancelled_mis_scaled">;
|
|
653
|
+
triggerId: z.ZodUUID;
|
|
654
|
+
positionKey: z.ZodString;
|
|
655
|
+
storedBps: z.ZodNumber;
|
|
656
|
+
readingMarginPct: z.ZodNumber;
|
|
626
657
|
}, z.core.$strip>], "type">;
|
|
627
658
|
isRead: z.ZodBoolean;
|
|
628
659
|
createdAt: z.ZodString;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Side } from '../common/schema';
|
|
3
3
|
import { Connector } from '../connector';
|
|
4
|
+
import { TpSlBracketType } from '../trigger/common';
|
|
4
5
|
|
|
5
6
|
const NotificationCategory = z.enum([
|
|
6
7
|
"TAKE_PROFIT_HIT",
|
|
@@ -12,7 +13,8 @@ const NotificationCategory = z.enum([
|
|
|
12
13
|
"ATTACHED_TRIGGER_DISCARDED",
|
|
13
14
|
"AUTO_REBALANCE_EXECUTED",
|
|
14
15
|
"AUTO_REBALANCE_FAILED",
|
|
15
|
-
"AUTO_REBALANCE_PAUSED"
|
|
16
|
+
"AUTO_REBALANCE_PAUSED",
|
|
17
|
+
"TRIGGER_CANCELLED_MIS_SCALED"
|
|
16
18
|
]);
|
|
17
19
|
const NotificationMetric = z.enum([
|
|
18
20
|
"ratio",
|
|
@@ -49,14 +51,18 @@ const TakeProfitNotificationParameters = PositionLegParameters.safeExtend({
|
|
|
49
51
|
triggerId: z.uuid(),
|
|
50
52
|
positionId: z.uuid(),
|
|
51
53
|
connector: Connector,
|
|
52
|
-
...TriggerNotificationEnrichment
|
|
54
|
+
...TriggerNotificationEnrichment,
|
|
55
|
+
// User-facing bracket semantics; absent when a legacy trigger's intent is unknown.
|
|
56
|
+
semanticBracketType: TpSlBracketType.optional()
|
|
53
57
|
});
|
|
54
58
|
const StopLossNotificationParameters = PositionLegParameters.safeExtend({
|
|
55
59
|
type: z.literal("stop_loss"),
|
|
56
60
|
triggerId: z.uuid(),
|
|
57
61
|
positionId: z.uuid(),
|
|
58
62
|
connector: Connector,
|
|
59
|
-
...TriggerNotificationEnrichment
|
|
63
|
+
...TriggerNotificationEnrichment,
|
|
64
|
+
// User-facing bracket semantics; absent when a legacy trigger's intent is unknown.
|
|
65
|
+
semanticBracketType: TpSlBracketType.optional()
|
|
60
66
|
});
|
|
61
67
|
const TriggerOrderNotificationParameters = PositionLegParameters.safeExtend({
|
|
62
68
|
type: z.literal("trigger_order"),
|
|
@@ -124,6 +130,13 @@ const AutoRebalancePausedNotificationParameters = z.object({
|
|
|
124
130
|
legs: z.array(AutoRebalanceLeg),
|
|
125
131
|
pausedReason: z.enum(["POSITION_CHANGED", "REPEATED_FAILURES", "INVALID_LIVE_BETA_EXPOSURE"])
|
|
126
132
|
});
|
|
133
|
+
const TriggerCancelledMisScaledNotificationParameters = z.object({
|
|
134
|
+
type: z.literal("trigger_cancelled_mis_scaled"),
|
|
135
|
+
triggerId: z.uuid(),
|
|
136
|
+
positionKey: z.string().min(1),
|
|
137
|
+
storedBps: z.number(),
|
|
138
|
+
readingMarginPct: z.number()
|
|
139
|
+
});
|
|
127
140
|
const NotificationParameters = z.discriminatedUnion("type", [
|
|
128
141
|
TakeProfitNotificationParameters,
|
|
129
142
|
StopLossNotificationParameters,
|
|
@@ -132,7 +145,8 @@ const NotificationParameters = z.discriminatedUnion("type", [
|
|
|
132
145
|
AttachedTriggerDiscardedNotificationParameters,
|
|
133
146
|
AutoRebalanceExecutedNotificationParameters,
|
|
134
147
|
AutoRebalanceFailedNotificationParameters,
|
|
135
|
-
AutoRebalancePausedNotificationParameters
|
|
148
|
+
AutoRebalancePausedNotificationParameters,
|
|
149
|
+
TriggerCancelledMisScaledNotificationParameters
|
|
136
150
|
]);
|
|
137
151
|
const Notification = z.object({
|
|
138
152
|
/**
|
|
@@ -13,6 +13,7 @@ export declare const NotificationListResponse: z.ZodObject<{
|
|
|
13
13
|
AUTO_REBALANCE_EXECUTED: "AUTO_REBALANCE_EXECUTED";
|
|
14
14
|
AUTO_REBALANCE_FAILED: "AUTO_REBALANCE_FAILED";
|
|
15
15
|
AUTO_REBALANCE_PAUSED: "AUTO_REBALANCE_PAUSED";
|
|
16
|
+
TRIGGER_CANCELLED_MIS_SCALED: "TRIGGER_CANCELLED_MIS_SCALED";
|
|
16
17
|
}>;
|
|
17
18
|
parameters: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
18
19
|
legs: z.ZodArray<z.ZodObject<{
|
|
@@ -23,6 +24,10 @@ export declare const NotificationListResponse: z.ZodObject<{
|
|
|
23
24
|
SELL: "SELL";
|
|
24
25
|
}>;
|
|
25
26
|
}, z.core.$strip>>;
|
|
27
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
28
|
+
STOP_LOSS: "STOP_LOSS";
|
|
29
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
30
|
+
}>>;
|
|
26
31
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
27
32
|
price: "price";
|
|
28
33
|
notional: "notional";
|
|
@@ -61,6 +66,10 @@ export declare const NotificationListResponse: z.ZodObject<{
|
|
|
61
66
|
SELL: "SELL";
|
|
62
67
|
}>;
|
|
63
68
|
}, z.core.$strip>>;
|
|
69
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
70
|
+
STOP_LOSS: "STOP_LOSS";
|
|
71
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
72
|
+
}>>;
|
|
64
73
|
metric: z.ZodOptional<z.ZodEnum<{
|
|
65
74
|
price: "price";
|
|
66
75
|
notional: "notional";
|
|
@@ -298,6 +307,12 @@ export declare const NotificationListResponse: z.ZodObject<{
|
|
|
298
307
|
LIVE_BETA: "LIVE_BETA";
|
|
299
308
|
}>;
|
|
300
309
|
type: z.ZodLiteral<"auto_rebalance_paused">;
|
|
310
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
311
|
+
type: z.ZodLiteral<"trigger_cancelled_mis_scaled">;
|
|
312
|
+
triggerId: z.ZodUUID;
|
|
313
|
+
positionKey: z.ZodString;
|
|
314
|
+
storedBps: z.ZodNumber;
|
|
315
|
+
readingMarginPct: z.ZodNumber;
|
|
301
316
|
}, z.core.$strip>], "type">;
|
|
302
317
|
isRead: z.ZodBoolean;
|
|
303
318
|
createdAt: z.ZodString;
|
|
@@ -79,6 +79,11 @@ declare const BaseTrigger: z.ZodObject<{
|
|
|
79
79
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
80
80
|
NONE: "NONE";
|
|
81
81
|
}>;
|
|
82
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
83
|
+
STOP_LOSS: "STOP_LOSS";
|
|
84
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
85
|
+
NONE: "NONE";
|
|
86
|
+
}>>;
|
|
82
87
|
createdAt: z.ZodString;
|
|
83
88
|
updatedAt: z.ZodString;
|
|
84
89
|
}, z.core.$strip>;
|
|
@@ -161,6 +166,11 @@ export declare const TriggerMarketOpen: z.ZodObject<{
|
|
|
161
166
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
162
167
|
NONE: "NONE";
|
|
163
168
|
}>;
|
|
169
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
170
|
+
STOP_LOSS: "STOP_LOSS";
|
|
171
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
172
|
+
NONE: "NONE";
|
|
173
|
+
}>>;
|
|
164
174
|
createdAt: z.ZodString;
|
|
165
175
|
updatedAt: z.ZodString;
|
|
166
176
|
intent: z.ZodLiteral<"OPEN">;
|
|
@@ -363,6 +373,11 @@ export declare const TriggerMarketAdjust: z.ZodObject<{
|
|
|
363
373
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
364
374
|
NONE: "NONE";
|
|
365
375
|
}>;
|
|
376
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
377
|
+
STOP_LOSS: "STOP_LOSS";
|
|
378
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
379
|
+
NONE: "NONE";
|
|
380
|
+
}>>;
|
|
366
381
|
createdAt: z.ZodString;
|
|
367
382
|
updatedAt: z.ZodString;
|
|
368
383
|
intent: z.ZodLiteral<"ADJUST">;
|
|
@@ -611,6 +626,11 @@ export declare const TriggerMarketClose: z.ZodObject<{
|
|
|
611
626
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
612
627
|
NONE: "NONE";
|
|
613
628
|
}>;
|
|
629
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
630
|
+
STOP_LOSS: "STOP_LOSS";
|
|
631
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
632
|
+
NONE: "NONE";
|
|
633
|
+
}>>;
|
|
614
634
|
createdAt: z.ZodString;
|
|
615
635
|
updatedAt: z.ZodString;
|
|
616
636
|
intent: z.ZodLiteral<"CLOSE">;
|
|
@@ -893,6 +913,11 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
893
913
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
894
914
|
NONE: "NONE";
|
|
895
915
|
}>;
|
|
916
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
917
|
+
STOP_LOSS: "STOP_LOSS";
|
|
918
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
919
|
+
NONE: "NONE";
|
|
920
|
+
}>>;
|
|
896
921
|
createdAt: z.ZodString;
|
|
897
922
|
updatedAt: z.ZodString;
|
|
898
923
|
intent: z.ZodLiteral<"OPEN">;
|
|
@@ -1094,6 +1119,11 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1094
1119
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1095
1120
|
NONE: "NONE";
|
|
1096
1121
|
}>;
|
|
1122
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1123
|
+
STOP_LOSS: "STOP_LOSS";
|
|
1124
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1125
|
+
NONE: "NONE";
|
|
1126
|
+
}>>;
|
|
1097
1127
|
createdAt: z.ZodString;
|
|
1098
1128
|
updatedAt: z.ZodString;
|
|
1099
1129
|
intent: z.ZodLiteral<"ADJUST">;
|
|
@@ -1341,6 +1371,11 @@ export declare const TriggerMarket: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1341
1371
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1342
1372
|
NONE: "NONE";
|
|
1343
1373
|
}>;
|
|
1374
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1375
|
+
STOP_LOSS: "STOP_LOSS";
|
|
1376
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1377
|
+
NONE: "NONE";
|
|
1378
|
+
}>>;
|
|
1344
1379
|
createdAt: z.ZodString;
|
|
1345
1380
|
updatedAt: z.ZodString;
|
|
1346
1381
|
intent: z.ZodLiteral<"CLOSE">;
|
|
@@ -1623,6 +1658,11 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
|
|
|
1623
1658
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1624
1659
|
NONE: "NONE";
|
|
1625
1660
|
}>;
|
|
1661
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1662
|
+
STOP_LOSS: "STOP_LOSS";
|
|
1663
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1664
|
+
NONE: "NONE";
|
|
1665
|
+
}>>;
|
|
1626
1666
|
createdAt: z.ZodString;
|
|
1627
1667
|
updatedAt: z.ZodString;
|
|
1628
1668
|
intent: z.ZodLiteral<"OPEN">;
|
|
@@ -1824,6 +1864,11 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
|
|
|
1824
1864
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1825
1865
|
NONE: "NONE";
|
|
1826
1866
|
}>;
|
|
1867
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1868
|
+
STOP_LOSS: "STOP_LOSS";
|
|
1869
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1870
|
+
NONE: "NONE";
|
|
1871
|
+
}>>;
|
|
1827
1872
|
createdAt: z.ZodString;
|
|
1828
1873
|
updatedAt: z.ZodString;
|
|
1829
1874
|
intent: z.ZodLiteral<"ADJUST">;
|
|
@@ -2071,6 +2116,11 @@ export declare const Trigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[
|
|
|
2071
2116
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
2072
2117
|
NONE: "NONE";
|
|
2073
2118
|
}>;
|
|
2119
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
2120
|
+
STOP_LOSS: "STOP_LOSS";
|
|
2121
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
2122
|
+
NONE: "NONE";
|
|
2123
|
+
}>>;
|
|
2074
2124
|
createdAt: z.ZodString;
|
|
2075
2125
|
updatedAt: z.ZodString;
|
|
2076
2126
|
intent: z.ZodLiteral<"CLOSE">;
|
|
@@ -83,6 +83,13 @@ const BaseTrigger = z.object({
|
|
|
83
83
|
* Bracket type for trigger behavior
|
|
84
84
|
*/
|
|
85
85
|
bracketType: BracketType,
|
|
86
|
+
/**
|
|
87
|
+
* User-facing bracket semantics. `bracketType` is the crossing encoding the gateway
|
|
88
|
+
* fires on (wire-flipped for a price bracket on a short watched leg); this field is
|
|
89
|
+
* what the user asked for. Absent whenever a legacy client's encoding is
|
|
90
|
+
* unknowable; do not present `bracketType` as user intent in that case.
|
|
91
|
+
*/
|
|
92
|
+
semanticBracketType: BracketType.optional(),
|
|
86
93
|
/**
|
|
87
94
|
* Created at timestamp
|
|
88
95
|
*/
|
|
@@ -152,6 +152,78 @@ export declare const AttachTriggerMarketClose: z.ZodUnion<readonly [z.ZodObject<
|
|
|
152
152
|
activationValue: z.ZodOptional<z.ZodNumber>;
|
|
153
153
|
}, z.core.$strip>;
|
|
154
154
|
}, z.core.$strip>]>;
|
|
155
|
+
export declare const AttachTriggerMarketCloseList: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
156
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
157
|
+
type: z.ZodLiteral<"MARKET">;
|
|
158
|
+
bracketType: z.ZodEnum<{
|
|
159
|
+
STOP_LOSS: "STOP_LOSS";
|
|
160
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
161
|
+
}>;
|
|
162
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"notional">;
|
|
164
|
+
data: z.ZodObject<{
|
|
165
|
+
priceSource: z.ZodEnum<{
|
|
166
|
+
mid: "mid";
|
|
167
|
+
mark: "mark";
|
|
168
|
+
}>;
|
|
169
|
+
threshold: z.ZodNumber;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
172
|
+
type: z.ZodLiteral<"upnl">;
|
|
173
|
+
data: z.ZodObject<{
|
|
174
|
+
priceSource: z.ZodEnum<{
|
|
175
|
+
mid: "mid";
|
|
176
|
+
mark: "mark";
|
|
177
|
+
}>;
|
|
178
|
+
threshold: z.ZodNumber;
|
|
179
|
+
}, z.core.$strip>;
|
|
180
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
181
|
+
type: z.ZodLiteral<"upnl_bps">;
|
|
182
|
+
data: z.ZodObject<{
|
|
183
|
+
priceSource: z.ZodEnum<{
|
|
184
|
+
mid: "mid";
|
|
185
|
+
mark: "mark";
|
|
186
|
+
}>;
|
|
187
|
+
threshold: z.ZodNumber;
|
|
188
|
+
}, z.core.$strip>;
|
|
189
|
+
}, z.core.$strip>], "type">;
|
|
190
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
191
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
192
|
+
type: z.ZodLiteral<"MARKET">;
|
|
193
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
194
|
+
type: z.ZodLiteral<"notional_trailing">;
|
|
195
|
+
data: z.ZodObject<{
|
|
196
|
+
priceSource: z.ZodEnum<{
|
|
197
|
+
mid: "mid";
|
|
198
|
+
mark: "mark";
|
|
199
|
+
}>;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
202
|
+
type: z.ZodLiteral<"upnl_trailing">;
|
|
203
|
+
data: z.ZodObject<{
|
|
204
|
+
priceSource: z.ZodEnum<{
|
|
205
|
+
mid: "mid";
|
|
206
|
+
mark: "mark";
|
|
207
|
+
}>;
|
|
208
|
+
}, z.core.$strip>;
|
|
209
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
210
|
+
type: z.ZodLiteral<"upnl_bps_trailing">;
|
|
211
|
+
data: z.ZodObject<{
|
|
212
|
+
priceSource: z.ZodEnum<{
|
|
213
|
+
mid: "mid";
|
|
214
|
+
mark: "mark";
|
|
215
|
+
}>;
|
|
216
|
+
}, z.core.$strip>;
|
|
217
|
+
}, z.core.$strip>], "type">;
|
|
218
|
+
trailing: z.ZodObject<{
|
|
219
|
+
mode: z.ZodEnum<{
|
|
220
|
+
RELATIVE_BPS: "RELATIVE_BPS";
|
|
221
|
+
ABSOLUTE_POINTS: "ABSOLUTE_POINTS";
|
|
222
|
+
}>;
|
|
223
|
+
deltaValue: z.ZodNumber;
|
|
224
|
+
activationValue: z.ZodOptional<z.ZodNumber>;
|
|
225
|
+
}, z.core.$strip>;
|
|
226
|
+
}, z.core.$strip>]>>;
|
|
155
227
|
export declare const CreateTriggerMarketOpen: z.ZodObject<{
|
|
156
228
|
intent: z.ZodLiteral<"OPEN">;
|
|
157
229
|
type: z.ZodLiteral<"MARKET">;
|
|
@@ -480,6 +552,10 @@ export declare const CreateTriggerMarketCloseStatic: z.ZodObject<{
|
|
|
480
552
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
481
553
|
NONE: "NONE";
|
|
482
554
|
}>;
|
|
555
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
556
|
+
STOP_LOSS: "STOP_LOSS";
|
|
557
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
558
|
+
}>>;
|
|
483
559
|
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
484
560
|
type: z.ZodLiteral<"ratio">;
|
|
485
561
|
data: z.ZodObject<{
|
|
@@ -631,6 +707,10 @@ export declare const CreateTriggerMarketClose: z.ZodUnion<readonly [z.ZodObject<
|
|
|
631
707
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
632
708
|
NONE: "NONE";
|
|
633
709
|
}>;
|
|
710
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
711
|
+
STOP_LOSS: "STOP_LOSS";
|
|
712
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
713
|
+
}>>;
|
|
634
714
|
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
635
715
|
type: z.ZodLiteral<"ratio">;
|
|
636
716
|
data: z.ZodObject<{
|
|
@@ -1099,6 +1179,10 @@ export declare const CreateTriggerClose: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
1099
1179
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1100
1180
|
NONE: "NONE";
|
|
1101
1181
|
}>;
|
|
1182
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1183
|
+
STOP_LOSS: "STOP_LOSS";
|
|
1184
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1185
|
+
}>>;
|
|
1102
1186
|
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1103
1187
|
type: z.ZodLiteral<"ratio">;
|
|
1104
1188
|
data: z.ZodObject<{
|
|
@@ -1248,6 +1332,7 @@ export type CreateTriggerMarketClose = z.output<typeof CreateTriggerMarketClose>
|
|
|
1248
1332
|
export type AttachTriggerMarketCloseStatic = z.output<typeof AttachTriggerMarketCloseStatic>;
|
|
1249
1333
|
export type AttachTriggerMarketCloseTrailing = z.output<typeof AttachTriggerMarketCloseTrailing>;
|
|
1250
1334
|
export type AttachTriggerMarketClose = z.output<typeof AttachTriggerMarketClose>;
|
|
1335
|
+
export type AttachTriggerMarketCloseList = z.output<typeof AttachTriggerMarketCloseList>;
|
|
1251
1336
|
export type CreateTriggerOpen = z.output<typeof CreateTriggerOpen>;
|
|
1252
1337
|
export type CreateTriggerClose = z.output<typeof CreateTriggerClose>;
|
|
1253
1338
|
export type TrailingConfig = z.output<typeof TrailingConfig>;
|
|
@@ -30,19 +30,20 @@ const AttachTriggerMarketCloseTrailing = z.object({
|
|
|
30
30
|
trailing: TrailingConfig
|
|
31
31
|
}).superRefine(RefineTrailingLogicalRules);
|
|
32
32
|
const AttachTriggerMarketClose = z.union([AttachTriggerMarketCloseStatic, AttachTriggerMarketCloseTrailing]);
|
|
33
|
+
const AttachTriggerMarketCloseList = z.array(AttachTriggerMarketClose).max(MAX_ATTACH_TRIGGERS, `At most ${MAX_ATTACH_TRIGGERS} close triggers can be attached.`).superRefine((attachTriggers, ctx) => {
|
|
34
|
+
const trailingCount = attachTriggers.filter(isAttachTriggerMarketCloseTrailing).length;
|
|
35
|
+
if (trailingCount > 1) {
|
|
36
|
+
ctx.addIssue({
|
|
37
|
+
code: "custom",
|
|
38
|
+
message: "At most one trailing close trigger can be attached."
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
33
42
|
const CreateTriggerMarketOpen = z.object({
|
|
34
43
|
intent: z.literal("OPEN"),
|
|
35
44
|
type: z.literal("MARKET"),
|
|
36
45
|
condition: CreateTriggerConditionOpen,
|
|
37
|
-
attachTriggers:
|
|
38
|
-
const trailingCount = attachTriggers.filter(isAttachTriggerMarketCloseTrailing).length;
|
|
39
|
-
if (trailingCount > 1) {
|
|
40
|
-
ctx.addIssue({
|
|
41
|
-
code: "custom",
|
|
42
|
-
message: "A market-open trigger can attach at most one trailing close trigger."
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}).optional(),
|
|
46
|
+
attachTriggers: AttachTriggerMarketCloseList.optional(),
|
|
46
47
|
payload: CreateTriggerMarketPayload,
|
|
47
48
|
/**
|
|
48
49
|
* Attribution route code (client_ids.code)
|
|
@@ -65,6 +66,9 @@ const CreateTriggerMarketCloseStatic = z.object({
|
|
|
65
66
|
type: z.literal("MARKET"),
|
|
66
67
|
positionId: z.uuid(),
|
|
67
68
|
bracketType: BracketType,
|
|
69
|
+
// User intent when bracketType is a side-dependent price-crossing encoding.
|
|
70
|
+
// Optional so older clients remain wire-compatible during rollout.
|
|
71
|
+
semanticBracketType: TpSlBracketType.optional(),
|
|
68
72
|
condition: CreateTriggerConditionCloseStatic,
|
|
69
73
|
/**
|
|
70
74
|
* Attribution route code (client_ids.code)
|
|
@@ -89,4 +93,4 @@ function isAttachTriggerMarketCloseTrailing(attachedTrigger) {
|
|
|
89
93
|
return "trailing" in attachedTrigger && attachedTrigger.trailing !== void 0;
|
|
90
94
|
}
|
|
91
95
|
|
|
92
|
-
export { AttachTriggerMarketClose, AttachTriggerMarketCloseStatic, AttachTriggerMarketCloseTrailing, CreateTriggerClose, CreateTriggerMarketAdjust, CreateTriggerMarketClose, CreateTriggerMarketCloseStatic, CreateTriggerMarketCloseTrailing, CreateTriggerMarketOpen, CreateTriggerOpen, TrailingConfig, isAttachTriggerMarketCloseTrailing };
|
|
96
|
+
export { AttachTriggerMarketClose, AttachTriggerMarketCloseList, AttachTriggerMarketCloseStatic, AttachTriggerMarketCloseTrailing, CreateTriggerClose, CreateTriggerMarketAdjust, CreateTriggerMarketClose, CreateTriggerMarketCloseStatic, CreateTriggerMarketCloseTrailing, CreateTriggerMarketOpen, CreateTriggerOpen, TrailingConfig, isAttachTriggerMarketCloseTrailing };
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
|
-
import type { BracketType } from '../common';
|
|
3
2
|
import type { CreateTriggerConditionCloseStatic } from '../payloads/conditions';
|
|
4
3
|
type ValidationFieldIssue = {
|
|
5
4
|
field: 'threshold';
|
|
6
5
|
message: string;
|
|
7
6
|
};
|
|
8
7
|
type ConditionType = CreateTriggerConditionCloseStatic['type'];
|
|
8
|
+
/** Surface every logical threshold issue on a static close trigger as a zod issue. */
|
|
9
9
|
export declare const RefineStaticLogicalRules: (value: {
|
|
10
|
-
bracketType: BracketType;
|
|
11
10
|
condition: CreateTriggerConditionCloseStatic;
|
|
12
11
|
}, context: z.RefinementCtx) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Validate a static close trigger's threshold against the rules its condition type implies.
|
|
14
|
+
*
|
|
15
|
+
* Deliberately blind to `bracketType`: it selects only the comparison direction (TAKE_PROFIT ->
|
|
16
|
+
* PEAK, STOP_LOSS -> TROUGH, NONE -> PEAK), and every sign pairs coherently with either direction. A positive
|
|
17
|
+
* STOP_LOSS is a profit floor ("close if my gain falls back to +10%") and a negative TAKE_PROFIT
|
|
18
|
+
* is a recovery exit ("close when my -30% loss recovers to -24%"); both are supported orders. A
|
|
19
|
+
* threshold that is already satisfied fires on the next evaluation pass, but catching that needs
|
|
20
|
+
* the position's current uPnL, which no pure function can see — it belongs in the usecase.
|
|
21
|
+
*/
|
|
13
22
|
export declare function getStaticLogicalIssues(input: {
|
|
14
|
-
bracketType: BracketType;
|
|
15
23
|
conditionType: ConditionType;
|
|
16
24
|
threshold: number;
|
|
17
25
|
}): ValidationFieldIssue[];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const RefineStaticLogicalRules = (value, context) => {
|
|
2
2
|
for (const issue of getStaticLogicalIssues({
|
|
3
|
-
bracketType: value.bracketType,
|
|
4
3
|
conditionType: value.condition.type,
|
|
5
4
|
threshold: value.condition.data.threshold
|
|
6
5
|
})) {
|
|
@@ -23,7 +22,15 @@ function getStaticLogicalIssues(input) {
|
|
|
23
22
|
}
|
|
24
23
|
break;
|
|
25
24
|
}
|
|
26
|
-
case "upnl":
|
|
25
|
+
case "upnl": {
|
|
26
|
+
if (threshold === 0) {
|
|
27
|
+
issues.push({
|
|
28
|
+
field: "threshold",
|
|
29
|
+
message: "threshold must not be 0 for uPnL static triggers"
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
27
34
|
case "upnl_bps": {
|
|
28
35
|
if (threshold === 0) {
|
|
29
36
|
issues.push({
|
|
@@ -71,6 +71,11 @@ export declare const TriggerListResponse: z.ZodObject<{
|
|
|
71
71
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
72
72
|
NONE: "NONE";
|
|
73
73
|
}>;
|
|
74
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
STOP_LOSS: "STOP_LOSS";
|
|
76
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
77
|
+
NONE: "NONE";
|
|
78
|
+
}>>;
|
|
74
79
|
createdAt: z.ZodString;
|
|
75
80
|
updatedAt: z.ZodString;
|
|
76
81
|
intent: z.ZodLiteral<"OPEN">;
|
|
@@ -272,6 +277,11 @@ export declare const TriggerListResponse: z.ZodObject<{
|
|
|
272
277
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
273
278
|
NONE: "NONE";
|
|
274
279
|
}>;
|
|
280
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
281
|
+
STOP_LOSS: "STOP_LOSS";
|
|
282
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
283
|
+
NONE: "NONE";
|
|
284
|
+
}>>;
|
|
275
285
|
createdAt: z.ZodString;
|
|
276
286
|
updatedAt: z.ZodString;
|
|
277
287
|
intent: z.ZodLiteral<"ADJUST">;
|
|
@@ -519,6 +529,11 @@ export declare const TriggerListResponse: z.ZodObject<{
|
|
|
519
529
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
520
530
|
NONE: "NONE";
|
|
521
531
|
}>;
|
|
532
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
533
|
+
STOP_LOSS: "STOP_LOSS";
|
|
534
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
535
|
+
NONE: "NONE";
|
|
536
|
+
}>>;
|
|
522
537
|
createdAt: z.ZodString;
|
|
523
538
|
updatedAt: z.ZodString;
|
|
524
539
|
intent: z.ZodLiteral<"CLOSE">;
|
|
@@ -804,6 +819,11 @@ export declare const CreateTriggerResponse: z.ZodObject<{
|
|
|
804
819
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
805
820
|
NONE: "NONE";
|
|
806
821
|
}>;
|
|
822
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
823
|
+
STOP_LOSS: "STOP_LOSS";
|
|
824
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
825
|
+
NONE: "NONE";
|
|
826
|
+
}>>;
|
|
807
827
|
createdAt: z.ZodString;
|
|
808
828
|
updatedAt: z.ZodString;
|
|
809
829
|
intent: z.ZodLiteral<"OPEN">;
|
|
@@ -1005,6 +1025,11 @@ export declare const CreateTriggerResponse: z.ZodObject<{
|
|
|
1005
1025
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1006
1026
|
NONE: "NONE";
|
|
1007
1027
|
}>;
|
|
1028
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1029
|
+
STOP_LOSS: "STOP_LOSS";
|
|
1030
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1031
|
+
NONE: "NONE";
|
|
1032
|
+
}>>;
|
|
1008
1033
|
createdAt: z.ZodString;
|
|
1009
1034
|
updatedAt: z.ZodString;
|
|
1010
1035
|
intent: z.ZodLiteral<"ADJUST">;
|
|
@@ -1252,6 +1277,11 @@ export declare const CreateTriggerResponse: z.ZodObject<{
|
|
|
1252
1277
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1253
1278
|
NONE: "NONE";
|
|
1254
1279
|
}>;
|
|
1280
|
+
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1281
|
+
STOP_LOSS: "STOP_LOSS";
|
|
1282
|
+
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1283
|
+
NONE: "NONE";
|
|
1284
|
+
}>>;
|
|
1255
1285
|
createdAt: z.ZodString;
|
|
1256
1286
|
updatedAt: z.ZodString;
|
|
1257
1287
|
intent: z.ZodLiteral<"CLOSE">;
|