@pear-protocol/types 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/entities.d.ts +9 -0
- package/dist/auth/entities.js +8 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/payloads.d.ts +50 -0
- package/dist/auth/payloads.js +39 -0
- package/dist/auth/response.d.ts +55 -0
- package/dist/auth/response.js +21 -0
- package/dist/bundle.d.ts +17 -0
- package/dist/bundle.js +17 -0
- package/dist/common/array.d.ts +10 -0
- package/dist/common/array.js +10 -0
- package/dist/common/index.d.ts +3 -0
- package/dist/common/index.js +3 -0
- package/dist/common/refinement.d.ts +20 -0
- package/dist/common/refinement.js +60 -0
- package/dist/common/request.d.ts +11 -0
- package/dist/common/request.js +24 -0
- package/dist/common/response.d.ts +12 -0
- package/dist/common/response.js +28 -0
- package/dist/common/schema.d.ts +8 -0
- package/dist/common/schema.js +10 -0
- package/dist/common/trade-legs.d.ts +34 -0
- package/dist/common/trade-legs.js +30 -0
- package/dist/connector/index.d.ts +8 -0
- package/dist/connector/index.js +5 -0
- package/dist/execution/entities.d.ts +741 -0
- package/dist/execution/entities.js +125 -0
- package/dist/execution/index.d.ts +3 -0
- package/dist/execution/index.js +3 -0
- package/dist/execution/queries.d.ts +20 -0
- package/dist/execution/queries.js +14 -0
- package/dist/execution/responses.d.ts +218 -0
- package/dist/execution/responses.js +9 -0
- package/dist/fill/entities.d.ts +25 -0
- package/dist/fill/entities.js +61 -0
- package/dist/fill/index.d.ts +3 -0
- package/dist/fill/index.js +3 -0
- package/dist/fill/queries.d.ts +13 -0
- package/dist/fill/queries.js +11 -0
- package/dist/fill/responses.d.ts +55 -0
- package/dist/fill/responses.js +12 -0
- package/dist/funding/entities.d.ts +11 -0
- package/dist/funding/entities.js +16 -0
- package/dist/funding/index.d.ts +3 -0
- package/dist/funding/index.js +3 -0
- package/dist/funding/queries.d.ts +10 -0
- package/dist/funding/queries.js +8 -0
- package/dist/funding/responses.d.ts +8 -0
- package/dist/funding/responses.js +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/instrument/entities.d.ts +43 -0
- package/dist/instrument/entities.js +48 -0
- package/dist/instrument/index.d.ts +3 -0
- package/dist/instrument/index.js +3 -0
- package/dist/instrument/queries.d.ts +10 -0
- package/dist/instrument/queries.js +8 -0
- package/dist/instrument/responses.d.ts +37 -0
- package/dist/instrument/responses.js +11 -0
- package/dist/instrument-precision/index.d.ts +18 -0
- package/dist/instrument-precision/index.js +51 -0
- package/dist/misc/index.d.ts +3 -0
- package/dist/misc/index.js +1 -0
- package/dist/order/entities.d.ts +73 -0
- package/dist/order/entities.js +73 -0
- package/dist/order/index.d.ts +1 -0
- package/dist/order/index.js +1 -0
- package/dist/position/entities.d.ts +53 -0
- package/dist/position/entities.js +55 -0
- package/dist/position/index.d.ts +3 -0
- package/dist/position/index.js +3 -0
- package/dist/position/queries.d.ts +16 -0
- package/dist/position/queries.js +28 -0
- package/dist/position/responses.d.ts +28 -0
- package/dist/position/responses.js +8 -0
- package/dist/price/entities.d.ts +8 -0
- package/dist/price/entities.js +7 -0
- package/dist/price/index.d.ts +3 -0
- package/dist/price/index.js +3 -0
- package/dist/price/queries.d.ts +10 -0
- package/dist/price/queries.js +8 -0
- package/dist/price/responses.d.ts +6 -0
- package/dist/price/responses.js +15 -0
- package/dist/schedule/entities.d.ts +380 -0
- package/dist/schedule/entities.js +159 -0
- package/dist/schedule/index.d.ts +4 -0
- package/dist/schedule/index.js +4 -0
- package/dist/schedule/payloads.d.ts +72 -0
- package/dist/schedule/payloads.js +102 -0
- package/dist/schedule/queries.d.ts +18 -0
- package/dist/schedule/queries.js +12 -0
- package/dist/schedule/responses.d.ts +279 -0
- package/dist/schedule/responses.js +10 -0
- package/dist/trade/index.d.ts +2 -0
- package/dist/trade/index.js +2 -0
- package/dist/trade/payloads.d.ts +217 -0
- package/dist/trade/payloads.js +35 -0
- package/dist/trade/responses.d.ts +861 -0
- package/dist/trade/responses.js +9 -0
- package/dist/trade-accounts/entities.d.ts +50 -0
- package/dist/trade-accounts/entities.js +18 -0
- package/dist/trade-accounts/index.d.ts +3 -0
- package/dist/trade-accounts/index.js +3 -0
- package/dist/trade-accounts/payloads.d.ts +137 -0
- package/dist/trade-accounts/payloads.js +84 -0
- package/dist/trade-accounts/response.d.ts +65 -0
- package/dist/trade-accounts/response.js +41 -0
- package/dist/trigger/entities/conditions.d.ts +407 -0
- package/dist/trigger/entities/conditions.js +239 -0
- package/dist/trigger/entities/index.d.ts +1549 -0
- package/dist/trigger/entities/index.js +123 -0
- package/dist/trigger/index.d.ts +6 -0
- package/dist/trigger/index.js +6 -0
- package/dist/trigger/payloads/conditions.d.ts +340 -0
- package/dist/trigger/payloads/conditions.js +109 -0
- package/dist/trigger/payloads/index.d.ts +470 -0
- package/dist/trigger/payloads/index.js +47 -0
- package/dist/trigger/queries.d.ts +18 -0
- package/dist/trigger/queries.js +12 -0
- package/dist/trigger/responses.d.ts +1001 -0
- package/dist/trigger/responses.js +10 -0
- package/dist/users/entities.d.ts +16 -0
- package/dist/users/entities.js +14 -0
- package/dist/users/index.d.ts +3 -0
- package/dist/users/index.js +3 -0
- package/dist/users/payloads.d.ts +5 -0
- package/dist/users/payloads.js +7 -0
- package/dist/users/response.d.ts +23 -0
- package/dist/users/response.js +12 -0
- package/package.json +35 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const TriggerConditionRatioV1: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"ratio_v1">;
|
|
4
|
+
data: z.ZodObject<{
|
|
5
|
+
priceSource: z.ZodEnum<{
|
|
6
|
+
mid: "mid";
|
|
7
|
+
mark: "mark";
|
|
8
|
+
}>;
|
|
9
|
+
symbol_a: z.ZodString;
|
|
10
|
+
symbol_b: z.ZodString;
|
|
11
|
+
direction: z.ZodEnum<{
|
|
12
|
+
ABOVE: "ABOVE";
|
|
13
|
+
BELOW: "BELOW";
|
|
14
|
+
}>;
|
|
15
|
+
threshold: z.ZodNumber;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
declare const TriggerConditionPriceV1: z.ZodObject<{
|
|
19
|
+
type: z.ZodLiteral<"price_v1">;
|
|
20
|
+
data: z.ZodObject<{
|
|
21
|
+
priceSource: z.ZodEnum<{
|
|
22
|
+
mid: "mid";
|
|
23
|
+
mark: "mark";
|
|
24
|
+
}>;
|
|
25
|
+
symbol: z.ZodString;
|
|
26
|
+
direction: z.ZodEnum<{
|
|
27
|
+
ABOVE: "ABOVE";
|
|
28
|
+
BELOW: "BELOW";
|
|
29
|
+
}>;
|
|
30
|
+
threshold: z.ZodNumber;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
declare const TriggerConditionIndexV1: z.ZodObject<{
|
|
34
|
+
type: z.ZodLiteral<"index_v1">;
|
|
35
|
+
data: z.ZodObject<{
|
|
36
|
+
priceSource: z.ZodEnum<{
|
|
37
|
+
mid: "mid";
|
|
38
|
+
mark: "mark";
|
|
39
|
+
}>;
|
|
40
|
+
basket: z.ZodArray<z.ZodObject<{
|
|
41
|
+
symbol: z.ZodString;
|
|
42
|
+
weight: z.ZodNumber;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
direction: z.ZodEnum<{
|
|
45
|
+
ABOVE: "ABOVE";
|
|
46
|
+
BELOW: "BELOW";
|
|
47
|
+
}>;
|
|
48
|
+
threshold: z.ZodNumber;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
declare const TriggerConditionWeightedRatioV1: z.ZodObject<{
|
|
52
|
+
type: z.ZodLiteral<"weighted_ratio_v1">;
|
|
53
|
+
data: z.ZodObject<{
|
|
54
|
+
priceSource: z.ZodEnum<{
|
|
55
|
+
mid: "mid";
|
|
56
|
+
mark: "mark";
|
|
57
|
+
}>;
|
|
58
|
+
basket: z.ZodArray<z.ZodObject<{
|
|
59
|
+
symbol: z.ZodString;
|
|
60
|
+
side: z.ZodEnum<{
|
|
61
|
+
BUY: "BUY";
|
|
62
|
+
SELL: "SELL";
|
|
63
|
+
}>;
|
|
64
|
+
weight: z.ZodNumber;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
direction: z.ZodEnum<{
|
|
67
|
+
ABOVE: "ABOVE";
|
|
68
|
+
BELOW: "BELOW";
|
|
69
|
+
}>;
|
|
70
|
+
threshold: z.ZodNumber;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
declare const TriggerConditionPositionValueV1: z.ZodObject<{
|
|
74
|
+
type: z.ZodLiteral<"position_value_v1">;
|
|
75
|
+
data: z.ZodObject<{
|
|
76
|
+
priceSource: z.ZodEnum<{
|
|
77
|
+
mid: "mid";
|
|
78
|
+
mark: "mark";
|
|
79
|
+
}>;
|
|
80
|
+
direction: z.ZodEnum<{
|
|
81
|
+
ABOVE: "ABOVE";
|
|
82
|
+
BELOW: "BELOW";
|
|
83
|
+
}>;
|
|
84
|
+
threshold: z.ZodNumber;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
declare const TriggerConditionPositionUPnLValueV1: z.ZodObject<{
|
|
88
|
+
type: z.ZodLiteral<"position_upnl_value_v1">;
|
|
89
|
+
data: z.ZodObject<{
|
|
90
|
+
priceSource: z.ZodEnum<{
|
|
91
|
+
mid: "mid";
|
|
92
|
+
mark: "mark";
|
|
93
|
+
}>;
|
|
94
|
+
direction: z.ZodEnum<{
|
|
95
|
+
ABOVE: "ABOVE";
|
|
96
|
+
BELOW: "BELOW";
|
|
97
|
+
}>;
|
|
98
|
+
threshold: z.ZodNumber;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
declare const TriggerConditionPositionUPnLPercentageV1: z.ZodObject<{
|
|
102
|
+
type: z.ZodLiteral<"position_upnl_percentage_v1">;
|
|
103
|
+
data: z.ZodObject<{
|
|
104
|
+
priceSource: z.ZodEnum<{
|
|
105
|
+
mid: "mid";
|
|
106
|
+
mark: "mark";
|
|
107
|
+
}>;
|
|
108
|
+
direction: z.ZodEnum<{
|
|
109
|
+
ABOVE: "ABOVE";
|
|
110
|
+
BELOW: "BELOW";
|
|
111
|
+
}>;
|
|
112
|
+
threshold_bps: z.ZodNumber;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
export declare const TriggerConditionOpen: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
116
|
+
type: z.ZodLiteral<"ratio_v1">;
|
|
117
|
+
data: z.ZodObject<{
|
|
118
|
+
priceSource: z.ZodEnum<{
|
|
119
|
+
mid: "mid";
|
|
120
|
+
mark: "mark";
|
|
121
|
+
}>;
|
|
122
|
+
symbol_a: z.ZodString;
|
|
123
|
+
symbol_b: z.ZodString;
|
|
124
|
+
direction: z.ZodEnum<{
|
|
125
|
+
ABOVE: "ABOVE";
|
|
126
|
+
BELOW: "BELOW";
|
|
127
|
+
}>;
|
|
128
|
+
threshold: z.ZodNumber;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
131
|
+
type: z.ZodLiteral<"price_v1">;
|
|
132
|
+
data: z.ZodObject<{
|
|
133
|
+
priceSource: z.ZodEnum<{
|
|
134
|
+
mid: "mid";
|
|
135
|
+
mark: "mark";
|
|
136
|
+
}>;
|
|
137
|
+
symbol: z.ZodString;
|
|
138
|
+
direction: z.ZodEnum<{
|
|
139
|
+
ABOVE: "ABOVE";
|
|
140
|
+
BELOW: "BELOW";
|
|
141
|
+
}>;
|
|
142
|
+
threshold: z.ZodNumber;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
145
|
+
type: z.ZodLiteral<"index_v1">;
|
|
146
|
+
data: z.ZodObject<{
|
|
147
|
+
priceSource: z.ZodEnum<{
|
|
148
|
+
mid: "mid";
|
|
149
|
+
mark: "mark";
|
|
150
|
+
}>;
|
|
151
|
+
basket: z.ZodArray<z.ZodObject<{
|
|
152
|
+
symbol: z.ZodString;
|
|
153
|
+
weight: z.ZodNumber;
|
|
154
|
+
}, z.core.$strip>>;
|
|
155
|
+
direction: z.ZodEnum<{
|
|
156
|
+
ABOVE: "ABOVE";
|
|
157
|
+
BELOW: "BELOW";
|
|
158
|
+
}>;
|
|
159
|
+
threshold: z.ZodNumber;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
162
|
+
type: z.ZodLiteral<"weighted_ratio_v1">;
|
|
163
|
+
data: z.ZodObject<{
|
|
164
|
+
priceSource: z.ZodEnum<{
|
|
165
|
+
mid: "mid";
|
|
166
|
+
mark: "mark";
|
|
167
|
+
}>;
|
|
168
|
+
basket: z.ZodArray<z.ZodObject<{
|
|
169
|
+
symbol: z.ZodString;
|
|
170
|
+
side: z.ZodEnum<{
|
|
171
|
+
BUY: "BUY";
|
|
172
|
+
SELL: "SELL";
|
|
173
|
+
}>;
|
|
174
|
+
weight: z.ZodNumber;
|
|
175
|
+
}, z.core.$strip>>;
|
|
176
|
+
direction: z.ZodEnum<{
|
|
177
|
+
ABOVE: "ABOVE";
|
|
178
|
+
BELOW: "BELOW";
|
|
179
|
+
}>;
|
|
180
|
+
threshold: z.ZodNumber;
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
}, z.core.$strip>], "type">;
|
|
183
|
+
export declare const TriggerConditionAdjust: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
184
|
+
type: z.ZodLiteral<"ratio_v1">;
|
|
185
|
+
data: z.ZodObject<{
|
|
186
|
+
priceSource: z.ZodEnum<{
|
|
187
|
+
mid: "mid";
|
|
188
|
+
mark: "mark";
|
|
189
|
+
}>;
|
|
190
|
+
symbol_a: z.ZodString;
|
|
191
|
+
symbol_b: z.ZodString;
|
|
192
|
+
direction: z.ZodEnum<{
|
|
193
|
+
ABOVE: "ABOVE";
|
|
194
|
+
BELOW: "BELOW";
|
|
195
|
+
}>;
|
|
196
|
+
threshold: z.ZodNumber;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
199
|
+
type: z.ZodLiteral<"price_v1">;
|
|
200
|
+
data: z.ZodObject<{
|
|
201
|
+
priceSource: z.ZodEnum<{
|
|
202
|
+
mid: "mid";
|
|
203
|
+
mark: "mark";
|
|
204
|
+
}>;
|
|
205
|
+
symbol: z.ZodString;
|
|
206
|
+
direction: z.ZodEnum<{
|
|
207
|
+
ABOVE: "ABOVE";
|
|
208
|
+
BELOW: "BELOW";
|
|
209
|
+
}>;
|
|
210
|
+
threshold: z.ZodNumber;
|
|
211
|
+
}, z.core.$strip>;
|
|
212
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
213
|
+
type: z.ZodLiteral<"index_v1">;
|
|
214
|
+
data: z.ZodObject<{
|
|
215
|
+
priceSource: z.ZodEnum<{
|
|
216
|
+
mid: "mid";
|
|
217
|
+
mark: "mark";
|
|
218
|
+
}>;
|
|
219
|
+
basket: z.ZodArray<z.ZodObject<{
|
|
220
|
+
symbol: z.ZodString;
|
|
221
|
+
weight: z.ZodNumber;
|
|
222
|
+
}, z.core.$strip>>;
|
|
223
|
+
direction: z.ZodEnum<{
|
|
224
|
+
ABOVE: "ABOVE";
|
|
225
|
+
BELOW: "BELOW";
|
|
226
|
+
}>;
|
|
227
|
+
threshold: z.ZodNumber;
|
|
228
|
+
}, z.core.$strip>;
|
|
229
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
230
|
+
type: z.ZodLiteral<"weighted_ratio_v1">;
|
|
231
|
+
data: z.ZodObject<{
|
|
232
|
+
priceSource: z.ZodEnum<{
|
|
233
|
+
mid: "mid";
|
|
234
|
+
mark: "mark";
|
|
235
|
+
}>;
|
|
236
|
+
basket: z.ZodArray<z.ZodObject<{
|
|
237
|
+
symbol: z.ZodString;
|
|
238
|
+
side: z.ZodEnum<{
|
|
239
|
+
BUY: "BUY";
|
|
240
|
+
SELL: "SELL";
|
|
241
|
+
}>;
|
|
242
|
+
weight: z.ZodNumber;
|
|
243
|
+
}, z.core.$strip>>;
|
|
244
|
+
direction: z.ZodEnum<{
|
|
245
|
+
ABOVE: "ABOVE";
|
|
246
|
+
BELOW: "BELOW";
|
|
247
|
+
}>;
|
|
248
|
+
threshold: z.ZodNumber;
|
|
249
|
+
}, z.core.$strip>;
|
|
250
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
251
|
+
type: z.ZodLiteral<"position_value_v1">;
|
|
252
|
+
data: z.ZodObject<{
|
|
253
|
+
priceSource: z.ZodEnum<{
|
|
254
|
+
mid: "mid";
|
|
255
|
+
mark: "mark";
|
|
256
|
+
}>;
|
|
257
|
+
direction: z.ZodEnum<{
|
|
258
|
+
ABOVE: "ABOVE";
|
|
259
|
+
BELOW: "BELOW";
|
|
260
|
+
}>;
|
|
261
|
+
threshold: z.ZodNumber;
|
|
262
|
+
}, z.core.$strip>;
|
|
263
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
264
|
+
type: z.ZodLiteral<"position_upnl_value_v1">;
|
|
265
|
+
data: z.ZodObject<{
|
|
266
|
+
priceSource: z.ZodEnum<{
|
|
267
|
+
mid: "mid";
|
|
268
|
+
mark: "mark";
|
|
269
|
+
}>;
|
|
270
|
+
direction: z.ZodEnum<{
|
|
271
|
+
ABOVE: "ABOVE";
|
|
272
|
+
BELOW: "BELOW";
|
|
273
|
+
}>;
|
|
274
|
+
threshold: z.ZodNumber;
|
|
275
|
+
}, z.core.$strip>;
|
|
276
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
277
|
+
type: z.ZodLiteral<"position_upnl_percentage_v1">;
|
|
278
|
+
data: z.ZodObject<{
|
|
279
|
+
priceSource: z.ZodEnum<{
|
|
280
|
+
mid: "mid";
|
|
281
|
+
mark: "mark";
|
|
282
|
+
}>;
|
|
283
|
+
direction: z.ZodEnum<{
|
|
284
|
+
ABOVE: "ABOVE";
|
|
285
|
+
BELOW: "BELOW";
|
|
286
|
+
}>;
|
|
287
|
+
threshold_bps: z.ZodNumber;
|
|
288
|
+
}, z.core.$strip>;
|
|
289
|
+
}, z.core.$strip>], "type">;
|
|
290
|
+
export declare const TriggerConditionClose: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
291
|
+
type: z.ZodLiteral<"ratio_v1">;
|
|
292
|
+
data: z.ZodObject<{
|
|
293
|
+
priceSource: z.ZodEnum<{
|
|
294
|
+
mid: "mid";
|
|
295
|
+
mark: "mark";
|
|
296
|
+
}>;
|
|
297
|
+
symbol_a: z.ZodString;
|
|
298
|
+
symbol_b: z.ZodString;
|
|
299
|
+
direction: z.ZodEnum<{
|
|
300
|
+
ABOVE: "ABOVE";
|
|
301
|
+
BELOW: "BELOW";
|
|
302
|
+
}>;
|
|
303
|
+
threshold: z.ZodNumber;
|
|
304
|
+
}, z.core.$strip>;
|
|
305
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
306
|
+
type: z.ZodLiteral<"price_v1">;
|
|
307
|
+
data: z.ZodObject<{
|
|
308
|
+
priceSource: z.ZodEnum<{
|
|
309
|
+
mid: "mid";
|
|
310
|
+
mark: "mark";
|
|
311
|
+
}>;
|
|
312
|
+
symbol: z.ZodString;
|
|
313
|
+
direction: z.ZodEnum<{
|
|
314
|
+
ABOVE: "ABOVE";
|
|
315
|
+
BELOW: "BELOW";
|
|
316
|
+
}>;
|
|
317
|
+
threshold: z.ZodNumber;
|
|
318
|
+
}, z.core.$strip>;
|
|
319
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
320
|
+
type: z.ZodLiteral<"index_v1">;
|
|
321
|
+
data: z.ZodObject<{
|
|
322
|
+
priceSource: z.ZodEnum<{
|
|
323
|
+
mid: "mid";
|
|
324
|
+
mark: "mark";
|
|
325
|
+
}>;
|
|
326
|
+
basket: z.ZodArray<z.ZodObject<{
|
|
327
|
+
symbol: z.ZodString;
|
|
328
|
+
weight: z.ZodNumber;
|
|
329
|
+
}, z.core.$strip>>;
|
|
330
|
+
direction: z.ZodEnum<{
|
|
331
|
+
ABOVE: "ABOVE";
|
|
332
|
+
BELOW: "BELOW";
|
|
333
|
+
}>;
|
|
334
|
+
threshold: z.ZodNumber;
|
|
335
|
+
}, z.core.$strip>;
|
|
336
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
337
|
+
type: z.ZodLiteral<"weighted_ratio_v1">;
|
|
338
|
+
data: z.ZodObject<{
|
|
339
|
+
priceSource: z.ZodEnum<{
|
|
340
|
+
mid: "mid";
|
|
341
|
+
mark: "mark";
|
|
342
|
+
}>;
|
|
343
|
+
basket: z.ZodArray<z.ZodObject<{
|
|
344
|
+
symbol: z.ZodString;
|
|
345
|
+
side: z.ZodEnum<{
|
|
346
|
+
BUY: "BUY";
|
|
347
|
+
SELL: "SELL";
|
|
348
|
+
}>;
|
|
349
|
+
weight: z.ZodNumber;
|
|
350
|
+
}, z.core.$strip>>;
|
|
351
|
+
direction: z.ZodEnum<{
|
|
352
|
+
ABOVE: "ABOVE";
|
|
353
|
+
BELOW: "BELOW";
|
|
354
|
+
}>;
|
|
355
|
+
threshold: z.ZodNumber;
|
|
356
|
+
}, z.core.$strip>;
|
|
357
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
358
|
+
type: z.ZodLiteral<"position_value_v1">;
|
|
359
|
+
data: z.ZodObject<{
|
|
360
|
+
priceSource: z.ZodEnum<{
|
|
361
|
+
mid: "mid";
|
|
362
|
+
mark: "mark";
|
|
363
|
+
}>;
|
|
364
|
+
direction: z.ZodEnum<{
|
|
365
|
+
ABOVE: "ABOVE";
|
|
366
|
+
BELOW: "BELOW";
|
|
367
|
+
}>;
|
|
368
|
+
threshold: z.ZodNumber;
|
|
369
|
+
}, z.core.$strip>;
|
|
370
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
371
|
+
type: z.ZodLiteral<"position_upnl_value_v1">;
|
|
372
|
+
data: z.ZodObject<{
|
|
373
|
+
priceSource: z.ZodEnum<{
|
|
374
|
+
mid: "mid";
|
|
375
|
+
mark: "mark";
|
|
376
|
+
}>;
|
|
377
|
+
direction: z.ZodEnum<{
|
|
378
|
+
ABOVE: "ABOVE";
|
|
379
|
+
BELOW: "BELOW";
|
|
380
|
+
}>;
|
|
381
|
+
threshold: z.ZodNumber;
|
|
382
|
+
}, z.core.$strip>;
|
|
383
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
384
|
+
type: z.ZodLiteral<"position_upnl_percentage_v1">;
|
|
385
|
+
data: z.ZodObject<{
|
|
386
|
+
priceSource: z.ZodEnum<{
|
|
387
|
+
mid: "mid";
|
|
388
|
+
mark: "mark";
|
|
389
|
+
}>;
|
|
390
|
+
direction: z.ZodEnum<{
|
|
391
|
+
ABOVE: "ABOVE";
|
|
392
|
+
BELOW: "BELOW";
|
|
393
|
+
}>;
|
|
394
|
+
threshold_bps: z.ZodNumber;
|
|
395
|
+
}, z.core.$strip>;
|
|
396
|
+
}, z.core.$strip>], "type">;
|
|
397
|
+
export type TriggerConditionRatioV1 = z.output<typeof TriggerConditionRatioV1>;
|
|
398
|
+
export type TriggerConditionPriceV1 = z.output<typeof TriggerConditionPriceV1>;
|
|
399
|
+
export type TriggerConditionIndexV1 = z.output<typeof TriggerConditionIndexV1>;
|
|
400
|
+
export type TriggerConditionWeightedRatioV1 = z.output<typeof TriggerConditionWeightedRatioV1>;
|
|
401
|
+
export type TriggerConditionPositionValueV1 = z.output<typeof TriggerConditionPositionValueV1>;
|
|
402
|
+
export type TriggerConditionPositionUPnLValueV1 = z.output<typeof TriggerConditionPositionUPnLValueV1>;
|
|
403
|
+
export type TriggerConditionPositionUPnLPercentageV1 = z.output<typeof TriggerConditionPositionUPnLPercentageV1>;
|
|
404
|
+
export type TriggerConditionOpen = z.output<typeof TriggerConditionOpen>;
|
|
405
|
+
export type TriggerConditionAdjust = z.output<typeof TriggerConditionAdjust>;
|
|
406
|
+
export type TriggerConditionClose = z.output<typeof TriggerConditionClose>;
|
|
407
|
+
export {};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Side } from '../../common/schema';
|
|
3
|
+
import { InstrumentId } from '../../instrument';
|
|
4
|
+
import { PriceSource } from '../../price';
|
|
5
|
+
|
|
6
|
+
const TriggerDirection = z.enum(["ABOVE", "BELOW"]);
|
|
7
|
+
const TriggerConditionRatioV1 = z.object({
|
|
8
|
+
/**
|
|
9
|
+
* Condition type
|
|
10
|
+
*/
|
|
11
|
+
type: z.literal("ratio_v1"),
|
|
12
|
+
/**
|
|
13
|
+
* Condition data
|
|
14
|
+
*/
|
|
15
|
+
data: z.object({
|
|
16
|
+
/**
|
|
17
|
+
* Price source
|
|
18
|
+
*/
|
|
19
|
+
priceSource: PriceSource,
|
|
20
|
+
/**
|
|
21
|
+
* Numerator symbol
|
|
22
|
+
*/
|
|
23
|
+
symbol_a: InstrumentId,
|
|
24
|
+
/**
|
|
25
|
+
* Denominator symbol
|
|
26
|
+
*/
|
|
27
|
+
symbol_b: InstrumentId,
|
|
28
|
+
/**
|
|
29
|
+
* Trigger direction
|
|
30
|
+
*/
|
|
31
|
+
direction: TriggerDirection,
|
|
32
|
+
/**
|
|
33
|
+
* Price ratio threshold
|
|
34
|
+
*/
|
|
35
|
+
threshold: z.number()
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
const TriggerConditionPriceV1 = z.object({
|
|
39
|
+
/**
|
|
40
|
+
* Condition type
|
|
41
|
+
*/
|
|
42
|
+
type: z.literal("price_v1"),
|
|
43
|
+
/**
|
|
44
|
+
* Condition data
|
|
45
|
+
*/
|
|
46
|
+
data: z.object({
|
|
47
|
+
/**
|
|
48
|
+
* Price source
|
|
49
|
+
*/
|
|
50
|
+
priceSource: PriceSource,
|
|
51
|
+
/**
|
|
52
|
+
* Asset symbol
|
|
53
|
+
*/
|
|
54
|
+
symbol: InstrumentId,
|
|
55
|
+
/**
|
|
56
|
+
* Trigger direction
|
|
57
|
+
*/
|
|
58
|
+
direction: TriggerDirection,
|
|
59
|
+
/**
|
|
60
|
+
* Asset price threshold
|
|
61
|
+
*/
|
|
62
|
+
threshold: z.number()
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
const TriggerConditionIndexV1 = z.object({
|
|
66
|
+
/**
|
|
67
|
+
* Condition type
|
|
68
|
+
*/
|
|
69
|
+
type: z.literal("index_v1"),
|
|
70
|
+
/**
|
|
71
|
+
* Condition data
|
|
72
|
+
*/
|
|
73
|
+
data: z.object({
|
|
74
|
+
/**
|
|
75
|
+
* Price source
|
|
76
|
+
*/
|
|
77
|
+
priceSource: PriceSource,
|
|
78
|
+
/**
|
|
79
|
+
* Basket of assets
|
|
80
|
+
*/
|
|
81
|
+
basket: z.array(
|
|
82
|
+
z.object({
|
|
83
|
+
/**
|
|
84
|
+
* Asset symbol
|
|
85
|
+
*/
|
|
86
|
+
symbol: InstrumentId,
|
|
87
|
+
/**
|
|
88
|
+
* Weight (sum of weights should be 1)
|
|
89
|
+
*/
|
|
90
|
+
weight: z.number()
|
|
91
|
+
})
|
|
92
|
+
),
|
|
93
|
+
/**
|
|
94
|
+
* Trigger direction
|
|
95
|
+
*/
|
|
96
|
+
direction: TriggerDirection,
|
|
97
|
+
/**
|
|
98
|
+
* Index value threshold
|
|
99
|
+
*/
|
|
100
|
+
threshold: z.number()
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
const TriggerConditionWeightedRatioV1 = z.object({
|
|
104
|
+
/**
|
|
105
|
+
* Condition type
|
|
106
|
+
*/
|
|
107
|
+
type: z.literal("weighted_ratio_v1"),
|
|
108
|
+
/**
|
|
109
|
+
* Condition data
|
|
110
|
+
*/
|
|
111
|
+
data: z.object({
|
|
112
|
+
/**
|
|
113
|
+
* Price source
|
|
114
|
+
*/
|
|
115
|
+
priceSource: PriceSource,
|
|
116
|
+
/**
|
|
117
|
+
* Basket of assets (needs at least one BUY and one SELL)
|
|
118
|
+
*/
|
|
119
|
+
basket: z.array(
|
|
120
|
+
z.object({
|
|
121
|
+
/**
|
|
122
|
+
* Asset symbol
|
|
123
|
+
*/
|
|
124
|
+
symbol: InstrumentId,
|
|
125
|
+
/**
|
|
126
|
+
* Side
|
|
127
|
+
*/
|
|
128
|
+
side: Side,
|
|
129
|
+
/**
|
|
130
|
+
* Weight (sum of weights should be 1)
|
|
131
|
+
*/
|
|
132
|
+
weight: z.number()
|
|
133
|
+
})
|
|
134
|
+
),
|
|
135
|
+
/**
|
|
136
|
+
* Trigger direction
|
|
137
|
+
*/
|
|
138
|
+
direction: TriggerDirection,
|
|
139
|
+
/**
|
|
140
|
+
* Weighted ratio threshold
|
|
141
|
+
*/
|
|
142
|
+
threshold: z.number()
|
|
143
|
+
})
|
|
144
|
+
});
|
|
145
|
+
const TriggerConditionPositionValueV1 = z.object({
|
|
146
|
+
/**
|
|
147
|
+
* Condition type
|
|
148
|
+
*/
|
|
149
|
+
type: z.literal("position_value_v1"),
|
|
150
|
+
/**
|
|
151
|
+
* Condition data
|
|
152
|
+
*/
|
|
153
|
+
data: z.object({
|
|
154
|
+
/**
|
|
155
|
+
* Price source
|
|
156
|
+
*/
|
|
157
|
+
priceSource: PriceSource,
|
|
158
|
+
/**
|
|
159
|
+
* Trigger direction
|
|
160
|
+
*/
|
|
161
|
+
direction: TriggerDirection,
|
|
162
|
+
/**
|
|
163
|
+
* Position USD value threshold
|
|
164
|
+
*/
|
|
165
|
+
threshold: z.number()
|
|
166
|
+
})
|
|
167
|
+
});
|
|
168
|
+
const TriggerConditionPositionUPnLValueV1 = z.object({
|
|
169
|
+
/**
|
|
170
|
+
* Condition type
|
|
171
|
+
*/
|
|
172
|
+
type: z.literal("position_upnl_value_v1"),
|
|
173
|
+
/**
|
|
174
|
+
* Condition data
|
|
175
|
+
*/
|
|
176
|
+
data: z.object({
|
|
177
|
+
/**
|
|
178
|
+
* Price source
|
|
179
|
+
*/
|
|
180
|
+
priceSource: PriceSource,
|
|
181
|
+
/**
|
|
182
|
+
* Trigger direction
|
|
183
|
+
*/
|
|
184
|
+
direction: TriggerDirection,
|
|
185
|
+
/**
|
|
186
|
+
* PnL value in USD threshold
|
|
187
|
+
*/
|
|
188
|
+
threshold: z.number()
|
|
189
|
+
})
|
|
190
|
+
});
|
|
191
|
+
const TriggerConditionPositionUPnLPercentageV1 = z.object({
|
|
192
|
+
/**
|
|
193
|
+
* Condition type
|
|
194
|
+
*/
|
|
195
|
+
type: z.literal("position_upnl_percentage_v1"),
|
|
196
|
+
/**
|
|
197
|
+
* Condition data
|
|
198
|
+
*/
|
|
199
|
+
data: z.object({
|
|
200
|
+
/**
|
|
201
|
+
* Price source
|
|
202
|
+
*/
|
|
203
|
+
priceSource: PriceSource,
|
|
204
|
+
/**
|
|
205
|
+
* Trigger direction
|
|
206
|
+
*/
|
|
207
|
+
direction: TriggerDirection,
|
|
208
|
+
/**
|
|
209
|
+
* PnL value in basis points threshold
|
|
210
|
+
*/
|
|
211
|
+
threshold_bps: z.number()
|
|
212
|
+
})
|
|
213
|
+
});
|
|
214
|
+
const TriggerConditionOpen = z.discriminatedUnion("type", [
|
|
215
|
+
TriggerConditionRatioV1,
|
|
216
|
+
TriggerConditionPriceV1,
|
|
217
|
+
TriggerConditionIndexV1,
|
|
218
|
+
TriggerConditionWeightedRatioV1
|
|
219
|
+
]);
|
|
220
|
+
const TriggerConditionAdjust = z.discriminatedUnion("type", [
|
|
221
|
+
TriggerConditionRatioV1,
|
|
222
|
+
TriggerConditionPriceV1,
|
|
223
|
+
TriggerConditionIndexV1,
|
|
224
|
+
TriggerConditionWeightedRatioV1,
|
|
225
|
+
TriggerConditionPositionValueV1,
|
|
226
|
+
TriggerConditionPositionUPnLValueV1,
|
|
227
|
+
TriggerConditionPositionUPnLPercentageV1
|
|
228
|
+
]);
|
|
229
|
+
const TriggerConditionClose = z.discriminatedUnion("type", [
|
|
230
|
+
TriggerConditionRatioV1,
|
|
231
|
+
TriggerConditionPriceV1,
|
|
232
|
+
TriggerConditionIndexV1,
|
|
233
|
+
TriggerConditionWeightedRatioV1,
|
|
234
|
+
TriggerConditionPositionValueV1,
|
|
235
|
+
TriggerConditionPositionUPnLValueV1,
|
|
236
|
+
TriggerConditionPositionUPnLPercentageV1
|
|
237
|
+
]);
|
|
238
|
+
|
|
239
|
+
export { TriggerConditionAdjust, TriggerConditionClose, TriggerConditionOpen };
|