@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,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { InstrumentPriceMap } from './entities';
|
|
3
|
+
|
|
4
|
+
const PricesResponse = z.object({
|
|
5
|
+
/**
|
|
6
|
+
* Mid prices for instruments
|
|
7
|
+
*/
|
|
8
|
+
mid: InstrumentPriceMap,
|
|
9
|
+
/**
|
|
10
|
+
* Mark prices for instruments
|
|
11
|
+
*/
|
|
12
|
+
mark: InstrumentPriceMap
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { PricesResponse };
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ScheduleStrategy: z.ZodEnum<{
|
|
3
|
+
TWAP: "TWAP";
|
|
4
|
+
VWAP: "VWAP";
|
|
5
|
+
}>;
|
|
6
|
+
export type ScheduleStrategy = z.infer<typeof ScheduleStrategy>;
|
|
7
|
+
export declare const ScheduleStatus: z.ZodEnum<{
|
|
8
|
+
CANCELLED: "CANCELLED";
|
|
9
|
+
ACTIVE: "ACTIVE";
|
|
10
|
+
COMPLETED: "COMPLETED";
|
|
11
|
+
FAILED: "FAILED";
|
|
12
|
+
}>;
|
|
13
|
+
export type ScheduleStatus = z.infer<typeof ScheduleStatus>;
|
|
14
|
+
export declare const ScheduleIntent: z.ZodEnum<{
|
|
15
|
+
OPEN: "OPEN";
|
|
16
|
+
CLOSE: "CLOSE";
|
|
17
|
+
}>;
|
|
18
|
+
export type ScheduleIntent = z.infer<typeof ScheduleIntent>;
|
|
19
|
+
export declare const ScheduleExecutionType: z.ZodEnum<{
|
|
20
|
+
MARKET: "MARKET";
|
|
21
|
+
}>;
|
|
22
|
+
export type ScheduleExecutionType = z.infer<typeof ScheduleExecutionType>;
|
|
23
|
+
export declare const ScheduleSliceMode: z.ZodEnum<{
|
|
24
|
+
QUANTITY: "QUANTITY";
|
|
25
|
+
USD: "USD";
|
|
26
|
+
}>;
|
|
27
|
+
export type ScheduleSliceMode = z.infer<typeof ScheduleSliceMode>;
|
|
28
|
+
export declare const ScheduleCancelledReason: z.ZodEnum<{
|
|
29
|
+
USER: "USER";
|
|
30
|
+
POSITION_CLOSED: "POSITION_CLOSED";
|
|
31
|
+
SYSTEM: "SYSTEM";
|
|
32
|
+
}>;
|
|
33
|
+
export type ScheduleCancelledReason = z.infer<typeof ScheduleCancelledReason>;
|
|
34
|
+
declare const TWAPSliceOpenLeg: z.ZodObject<{
|
|
35
|
+
symbol: z.ZodString;
|
|
36
|
+
side: z.ZodEnum<{
|
|
37
|
+
BUY: "BUY";
|
|
38
|
+
SELL: "SELL";
|
|
39
|
+
}>;
|
|
40
|
+
mode: z.ZodEnum<{
|
|
41
|
+
QUANTITY: "QUANTITY";
|
|
42
|
+
USD: "USD";
|
|
43
|
+
}>;
|
|
44
|
+
stepAmount: z.ZodString;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
declare const TWAPSliceCloseLeg: z.ZodObject<{
|
|
47
|
+
symbol: z.ZodString;
|
|
48
|
+
stepAmount: z.ZodString;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
declare const BaseSchedule: z.ZodObject<{
|
|
51
|
+
id: z.ZodUUID;
|
|
52
|
+
connector: z.ZodEnum<{
|
|
53
|
+
hyperliquid: "hyperliquid";
|
|
54
|
+
binanceusdm: "binanceusdm";
|
|
55
|
+
bybit: "bybit";
|
|
56
|
+
okx: "okx";
|
|
57
|
+
}>;
|
|
58
|
+
strategy: z.ZodEnum<{
|
|
59
|
+
TWAP: "TWAP";
|
|
60
|
+
VWAP: "VWAP";
|
|
61
|
+
}>;
|
|
62
|
+
status: z.ZodEnum<{
|
|
63
|
+
CANCELLED: "CANCELLED";
|
|
64
|
+
ACTIVE: "ACTIVE";
|
|
65
|
+
COMPLETED: "COMPLETED";
|
|
66
|
+
FAILED: "FAILED";
|
|
67
|
+
}>;
|
|
68
|
+
intent: z.ZodEnum<{
|
|
69
|
+
OPEN: "OPEN";
|
|
70
|
+
CLOSE: "CLOSE";
|
|
71
|
+
}>;
|
|
72
|
+
positionKey: z.ZodString;
|
|
73
|
+
executionType: z.ZodEnum<{
|
|
74
|
+
MARKET: "MARKET";
|
|
75
|
+
}>;
|
|
76
|
+
lastSliceAt: z.ZodOptional<z.ZodString>;
|
|
77
|
+
startAt: z.ZodString;
|
|
78
|
+
endAt: z.ZodString;
|
|
79
|
+
cancelledAt: z.ZodOptional<z.ZodString>;
|
|
80
|
+
cancelledReason: z.ZodOptional<z.ZodEnum<{
|
|
81
|
+
USER: "USER";
|
|
82
|
+
POSITION_CLOSED: "POSITION_CLOSED";
|
|
83
|
+
SYSTEM: "SYSTEM";
|
|
84
|
+
}>>;
|
|
85
|
+
createdAt: z.ZodString;
|
|
86
|
+
updatedAt: z.ZodString;
|
|
87
|
+
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
88
|
+
id: z.ZodUUID;
|
|
89
|
+
cloid: z.ZodOptional<z.ZodUUID>;
|
|
90
|
+
tradeAccountId: z.ZodUUID;
|
|
91
|
+
symbol: z.ZodString;
|
|
92
|
+
positionId: z.ZodUUID;
|
|
93
|
+
connector: z.ZodEnum<{
|
|
94
|
+
hyperliquid: "hyperliquid";
|
|
95
|
+
binanceusdm: "binanceusdm";
|
|
96
|
+
bybit: "bybit";
|
|
97
|
+
okx: "okx";
|
|
98
|
+
}>;
|
|
99
|
+
side: z.ZodEnum<{
|
|
100
|
+
BUY: "BUY";
|
|
101
|
+
SELL: "SELL";
|
|
102
|
+
}>;
|
|
103
|
+
reduceOnly: z.ZodBoolean;
|
|
104
|
+
quantity: z.ZodString;
|
|
105
|
+
price: z.ZodString;
|
|
106
|
+
usd: z.ZodString;
|
|
107
|
+
fee: z.ZodOptional<z.ZodString>;
|
|
108
|
+
timestamp: z.ZodString;
|
|
109
|
+
}, z.core.$strip>>>;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
export declare const TWAPOpen: z.ZodObject<{
|
|
112
|
+
id: z.ZodUUID;
|
|
113
|
+
connector: z.ZodEnum<{
|
|
114
|
+
hyperliquid: "hyperliquid";
|
|
115
|
+
binanceusdm: "binanceusdm";
|
|
116
|
+
bybit: "bybit";
|
|
117
|
+
okx: "okx";
|
|
118
|
+
}>;
|
|
119
|
+
status: z.ZodEnum<{
|
|
120
|
+
CANCELLED: "CANCELLED";
|
|
121
|
+
ACTIVE: "ACTIVE";
|
|
122
|
+
COMPLETED: "COMPLETED";
|
|
123
|
+
FAILED: "FAILED";
|
|
124
|
+
}>;
|
|
125
|
+
positionKey: z.ZodString;
|
|
126
|
+
executionType: z.ZodEnum<{
|
|
127
|
+
MARKET: "MARKET";
|
|
128
|
+
}>;
|
|
129
|
+
lastSliceAt: z.ZodOptional<z.ZodString>;
|
|
130
|
+
startAt: z.ZodString;
|
|
131
|
+
endAt: z.ZodString;
|
|
132
|
+
cancelledAt: z.ZodOptional<z.ZodString>;
|
|
133
|
+
cancelledReason: z.ZodOptional<z.ZodEnum<{
|
|
134
|
+
USER: "USER";
|
|
135
|
+
POSITION_CLOSED: "POSITION_CLOSED";
|
|
136
|
+
SYSTEM: "SYSTEM";
|
|
137
|
+
}>>;
|
|
138
|
+
createdAt: z.ZodString;
|
|
139
|
+
updatedAt: z.ZodString;
|
|
140
|
+
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
141
|
+
id: z.ZodUUID;
|
|
142
|
+
cloid: z.ZodOptional<z.ZodUUID>;
|
|
143
|
+
tradeAccountId: z.ZodUUID;
|
|
144
|
+
symbol: z.ZodString;
|
|
145
|
+
positionId: z.ZodUUID;
|
|
146
|
+
connector: z.ZodEnum<{
|
|
147
|
+
hyperliquid: "hyperliquid";
|
|
148
|
+
binanceusdm: "binanceusdm";
|
|
149
|
+
bybit: "bybit";
|
|
150
|
+
okx: "okx";
|
|
151
|
+
}>;
|
|
152
|
+
side: z.ZodEnum<{
|
|
153
|
+
BUY: "BUY";
|
|
154
|
+
SELL: "SELL";
|
|
155
|
+
}>;
|
|
156
|
+
reduceOnly: z.ZodBoolean;
|
|
157
|
+
quantity: z.ZodString;
|
|
158
|
+
price: z.ZodString;
|
|
159
|
+
usd: z.ZodString;
|
|
160
|
+
fee: z.ZodOptional<z.ZodString>;
|
|
161
|
+
timestamp: z.ZodString;
|
|
162
|
+
}, z.core.$strip>>>;
|
|
163
|
+
strategy: z.ZodLiteral<"TWAP">;
|
|
164
|
+
intent: z.ZodLiteral<"OPEN">;
|
|
165
|
+
sliceIntervalMs: z.ZodNumber;
|
|
166
|
+
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
167
|
+
symbol: z.ZodString;
|
|
168
|
+
side: z.ZodEnum<{
|
|
169
|
+
BUY: "BUY";
|
|
170
|
+
SELL: "SELL";
|
|
171
|
+
}>;
|
|
172
|
+
mode: z.ZodEnum<{
|
|
173
|
+
QUANTITY: "QUANTITY";
|
|
174
|
+
USD: "USD";
|
|
175
|
+
}>;
|
|
176
|
+
stepAmount: z.ZodString;
|
|
177
|
+
}, z.core.$strip>>;
|
|
178
|
+
targetNotional: z.ZodString;
|
|
179
|
+
remainingNotional: z.ZodString;
|
|
180
|
+
}, z.core.$strip>;
|
|
181
|
+
export declare const TWAPClose: z.ZodObject<{
|
|
182
|
+
id: z.ZodUUID;
|
|
183
|
+
connector: z.ZodEnum<{
|
|
184
|
+
hyperliquid: "hyperliquid";
|
|
185
|
+
binanceusdm: "binanceusdm";
|
|
186
|
+
bybit: "bybit";
|
|
187
|
+
okx: "okx";
|
|
188
|
+
}>;
|
|
189
|
+
status: z.ZodEnum<{
|
|
190
|
+
CANCELLED: "CANCELLED";
|
|
191
|
+
ACTIVE: "ACTIVE";
|
|
192
|
+
COMPLETED: "COMPLETED";
|
|
193
|
+
FAILED: "FAILED";
|
|
194
|
+
}>;
|
|
195
|
+
positionKey: z.ZodString;
|
|
196
|
+
executionType: z.ZodEnum<{
|
|
197
|
+
MARKET: "MARKET";
|
|
198
|
+
}>;
|
|
199
|
+
lastSliceAt: z.ZodOptional<z.ZodString>;
|
|
200
|
+
startAt: z.ZodString;
|
|
201
|
+
endAt: z.ZodString;
|
|
202
|
+
cancelledAt: z.ZodOptional<z.ZodString>;
|
|
203
|
+
cancelledReason: z.ZodOptional<z.ZodEnum<{
|
|
204
|
+
USER: "USER";
|
|
205
|
+
POSITION_CLOSED: "POSITION_CLOSED";
|
|
206
|
+
SYSTEM: "SYSTEM";
|
|
207
|
+
}>>;
|
|
208
|
+
createdAt: z.ZodString;
|
|
209
|
+
updatedAt: z.ZodString;
|
|
210
|
+
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
211
|
+
id: z.ZodUUID;
|
|
212
|
+
cloid: z.ZodOptional<z.ZodUUID>;
|
|
213
|
+
tradeAccountId: z.ZodUUID;
|
|
214
|
+
symbol: z.ZodString;
|
|
215
|
+
positionId: z.ZodUUID;
|
|
216
|
+
connector: z.ZodEnum<{
|
|
217
|
+
hyperliquid: "hyperliquid";
|
|
218
|
+
binanceusdm: "binanceusdm";
|
|
219
|
+
bybit: "bybit";
|
|
220
|
+
okx: "okx";
|
|
221
|
+
}>;
|
|
222
|
+
side: z.ZodEnum<{
|
|
223
|
+
BUY: "BUY";
|
|
224
|
+
SELL: "SELL";
|
|
225
|
+
}>;
|
|
226
|
+
reduceOnly: z.ZodBoolean;
|
|
227
|
+
quantity: z.ZodString;
|
|
228
|
+
price: z.ZodString;
|
|
229
|
+
usd: z.ZodString;
|
|
230
|
+
fee: z.ZodOptional<z.ZodString>;
|
|
231
|
+
timestamp: z.ZodString;
|
|
232
|
+
}, z.core.$strip>>>;
|
|
233
|
+
strategy: z.ZodLiteral<"TWAP">;
|
|
234
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
235
|
+
sliceIntervalMs: z.ZodNumber;
|
|
236
|
+
positionId: z.ZodUUID;
|
|
237
|
+
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
238
|
+
symbol: z.ZodString;
|
|
239
|
+
stepAmount: z.ZodString;
|
|
240
|
+
}, z.core.$strip>>;
|
|
241
|
+
initialExposure: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
242
|
+
}, z.core.$strip>;
|
|
243
|
+
export declare const Schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
244
|
+
id: z.ZodUUID;
|
|
245
|
+
connector: z.ZodEnum<{
|
|
246
|
+
hyperliquid: "hyperliquid";
|
|
247
|
+
binanceusdm: "binanceusdm";
|
|
248
|
+
bybit: "bybit";
|
|
249
|
+
okx: "okx";
|
|
250
|
+
}>;
|
|
251
|
+
status: z.ZodEnum<{
|
|
252
|
+
CANCELLED: "CANCELLED";
|
|
253
|
+
ACTIVE: "ACTIVE";
|
|
254
|
+
COMPLETED: "COMPLETED";
|
|
255
|
+
FAILED: "FAILED";
|
|
256
|
+
}>;
|
|
257
|
+
positionKey: z.ZodString;
|
|
258
|
+
executionType: z.ZodEnum<{
|
|
259
|
+
MARKET: "MARKET";
|
|
260
|
+
}>;
|
|
261
|
+
lastSliceAt: z.ZodOptional<z.ZodString>;
|
|
262
|
+
startAt: z.ZodString;
|
|
263
|
+
endAt: z.ZodString;
|
|
264
|
+
cancelledAt: z.ZodOptional<z.ZodString>;
|
|
265
|
+
cancelledReason: z.ZodOptional<z.ZodEnum<{
|
|
266
|
+
USER: "USER";
|
|
267
|
+
POSITION_CLOSED: "POSITION_CLOSED";
|
|
268
|
+
SYSTEM: "SYSTEM";
|
|
269
|
+
}>>;
|
|
270
|
+
createdAt: z.ZodString;
|
|
271
|
+
updatedAt: z.ZodString;
|
|
272
|
+
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
273
|
+
id: z.ZodUUID;
|
|
274
|
+
cloid: z.ZodOptional<z.ZodUUID>;
|
|
275
|
+
tradeAccountId: z.ZodUUID;
|
|
276
|
+
symbol: z.ZodString;
|
|
277
|
+
positionId: z.ZodUUID;
|
|
278
|
+
connector: z.ZodEnum<{
|
|
279
|
+
hyperliquid: "hyperliquid";
|
|
280
|
+
binanceusdm: "binanceusdm";
|
|
281
|
+
bybit: "bybit";
|
|
282
|
+
okx: "okx";
|
|
283
|
+
}>;
|
|
284
|
+
side: z.ZodEnum<{
|
|
285
|
+
BUY: "BUY";
|
|
286
|
+
SELL: "SELL";
|
|
287
|
+
}>;
|
|
288
|
+
reduceOnly: z.ZodBoolean;
|
|
289
|
+
quantity: z.ZodString;
|
|
290
|
+
price: z.ZodString;
|
|
291
|
+
usd: z.ZodString;
|
|
292
|
+
fee: z.ZodOptional<z.ZodString>;
|
|
293
|
+
timestamp: z.ZodString;
|
|
294
|
+
}, z.core.$strip>>>;
|
|
295
|
+
strategy: z.ZodLiteral<"TWAP">;
|
|
296
|
+
intent: z.ZodLiteral<"OPEN">;
|
|
297
|
+
sliceIntervalMs: z.ZodNumber;
|
|
298
|
+
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
299
|
+
symbol: z.ZodString;
|
|
300
|
+
side: z.ZodEnum<{
|
|
301
|
+
BUY: "BUY";
|
|
302
|
+
SELL: "SELL";
|
|
303
|
+
}>;
|
|
304
|
+
mode: z.ZodEnum<{
|
|
305
|
+
QUANTITY: "QUANTITY";
|
|
306
|
+
USD: "USD";
|
|
307
|
+
}>;
|
|
308
|
+
stepAmount: z.ZodString;
|
|
309
|
+
}, z.core.$strip>>;
|
|
310
|
+
targetNotional: z.ZodString;
|
|
311
|
+
remainingNotional: z.ZodString;
|
|
312
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
313
|
+
id: z.ZodUUID;
|
|
314
|
+
connector: z.ZodEnum<{
|
|
315
|
+
hyperliquid: "hyperliquid";
|
|
316
|
+
binanceusdm: "binanceusdm";
|
|
317
|
+
bybit: "bybit";
|
|
318
|
+
okx: "okx";
|
|
319
|
+
}>;
|
|
320
|
+
status: z.ZodEnum<{
|
|
321
|
+
CANCELLED: "CANCELLED";
|
|
322
|
+
ACTIVE: "ACTIVE";
|
|
323
|
+
COMPLETED: "COMPLETED";
|
|
324
|
+
FAILED: "FAILED";
|
|
325
|
+
}>;
|
|
326
|
+
positionKey: z.ZodString;
|
|
327
|
+
executionType: z.ZodEnum<{
|
|
328
|
+
MARKET: "MARKET";
|
|
329
|
+
}>;
|
|
330
|
+
lastSliceAt: z.ZodOptional<z.ZodString>;
|
|
331
|
+
startAt: z.ZodString;
|
|
332
|
+
endAt: z.ZodString;
|
|
333
|
+
cancelledAt: z.ZodOptional<z.ZodString>;
|
|
334
|
+
cancelledReason: z.ZodOptional<z.ZodEnum<{
|
|
335
|
+
USER: "USER";
|
|
336
|
+
POSITION_CLOSED: "POSITION_CLOSED";
|
|
337
|
+
SYSTEM: "SYSTEM";
|
|
338
|
+
}>>;
|
|
339
|
+
createdAt: z.ZodString;
|
|
340
|
+
updatedAt: z.ZodString;
|
|
341
|
+
fills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
342
|
+
id: z.ZodUUID;
|
|
343
|
+
cloid: z.ZodOptional<z.ZodUUID>;
|
|
344
|
+
tradeAccountId: z.ZodUUID;
|
|
345
|
+
symbol: z.ZodString;
|
|
346
|
+
positionId: z.ZodUUID;
|
|
347
|
+
connector: z.ZodEnum<{
|
|
348
|
+
hyperliquid: "hyperliquid";
|
|
349
|
+
binanceusdm: "binanceusdm";
|
|
350
|
+
bybit: "bybit";
|
|
351
|
+
okx: "okx";
|
|
352
|
+
}>;
|
|
353
|
+
side: z.ZodEnum<{
|
|
354
|
+
BUY: "BUY";
|
|
355
|
+
SELL: "SELL";
|
|
356
|
+
}>;
|
|
357
|
+
reduceOnly: z.ZodBoolean;
|
|
358
|
+
quantity: z.ZodString;
|
|
359
|
+
price: z.ZodString;
|
|
360
|
+
usd: z.ZodString;
|
|
361
|
+
fee: z.ZodOptional<z.ZodString>;
|
|
362
|
+
timestamp: z.ZodString;
|
|
363
|
+
}, z.core.$strip>>>;
|
|
364
|
+
strategy: z.ZodLiteral<"TWAP">;
|
|
365
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
366
|
+
sliceIntervalMs: z.ZodNumber;
|
|
367
|
+
positionId: z.ZodUUID;
|
|
368
|
+
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
369
|
+
symbol: z.ZodString;
|
|
370
|
+
stepAmount: z.ZodString;
|
|
371
|
+
}, z.core.$strip>>;
|
|
372
|
+
initialExposure: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
373
|
+
}, z.core.$strip>], "intent">;
|
|
374
|
+
export type TWAPSliceOpenLeg = z.output<typeof TWAPSliceOpenLeg>;
|
|
375
|
+
export type TWAPSliceCloseLeg = z.output<typeof TWAPSliceCloseLeg>;
|
|
376
|
+
export type BaseSchedule = z.output<typeof BaseSchedule>;
|
|
377
|
+
export type TWAPOpen = z.output<typeof TWAPOpen>;
|
|
378
|
+
export type TWAPClose = z.output<typeof TWAPClose>;
|
|
379
|
+
export type Schedule = z.output<typeof Schedule>;
|
|
380
|
+
export {};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { UnsignedDecimalString, Side, SignedDecimalString } from '../common/schema';
|
|
3
|
+
import { Connector } from '../connector';
|
|
4
|
+
import { Fill } from '../fill/entities';
|
|
5
|
+
import { InstrumentId } from '../instrument';
|
|
6
|
+
|
|
7
|
+
const ScheduleStrategy = z.enum(["TWAP", "VWAP"]);
|
|
8
|
+
const ScheduleStatus = z.enum(["ACTIVE", "COMPLETED", "FAILED", "CANCELLED"]);
|
|
9
|
+
const ScheduleIntent = z.enum(["OPEN", "CLOSE"]);
|
|
10
|
+
const ScheduleExecutionType = z.enum(["MARKET"]);
|
|
11
|
+
const ScheduleSliceMode = z.enum(["QUANTITY", "USD"]);
|
|
12
|
+
const ScheduleCancelledReason = z.enum(["POSITION_CLOSED", "USER", "SYSTEM"]);
|
|
13
|
+
const TWAPSliceOpenLeg = z.object({
|
|
14
|
+
/**
|
|
15
|
+
* Instrument ID
|
|
16
|
+
*/
|
|
17
|
+
symbol: InstrumentId,
|
|
18
|
+
/**
|
|
19
|
+
* Side
|
|
20
|
+
*/
|
|
21
|
+
side: Side,
|
|
22
|
+
/**
|
|
23
|
+
* Mode to interpret the step amount
|
|
24
|
+
* @example QUANTITY: 0.001 means 0.001 BTC units
|
|
25
|
+
* @example USD: 100 means $100 USD
|
|
26
|
+
*/
|
|
27
|
+
mode: ScheduleSliceMode,
|
|
28
|
+
/**
|
|
29
|
+
* Step amount
|
|
30
|
+
*/
|
|
31
|
+
stepAmount: UnsignedDecimalString
|
|
32
|
+
});
|
|
33
|
+
const TWAPSliceCloseLeg = z.object({
|
|
34
|
+
/**
|
|
35
|
+
* Instrument ID
|
|
36
|
+
*/
|
|
37
|
+
symbol: InstrumentId,
|
|
38
|
+
/**
|
|
39
|
+
* Step amount
|
|
40
|
+
*/
|
|
41
|
+
stepAmount: UnsignedDecimalString
|
|
42
|
+
});
|
|
43
|
+
const BaseSchedule = z.object({
|
|
44
|
+
/**
|
|
45
|
+
* Schedule UUID
|
|
46
|
+
*/
|
|
47
|
+
id: z.uuid(),
|
|
48
|
+
/**
|
|
49
|
+
* Connector
|
|
50
|
+
*/
|
|
51
|
+
connector: Connector,
|
|
52
|
+
/**
|
|
53
|
+
* Schedule strategy
|
|
54
|
+
*/
|
|
55
|
+
strategy: ScheduleStrategy,
|
|
56
|
+
/**
|
|
57
|
+
* Schedule status
|
|
58
|
+
*/
|
|
59
|
+
status: ScheduleStatus,
|
|
60
|
+
/**
|
|
61
|
+
* Intent
|
|
62
|
+
*/
|
|
63
|
+
intent: ScheduleIntent,
|
|
64
|
+
/**
|
|
65
|
+
* Position key
|
|
66
|
+
*/
|
|
67
|
+
positionKey: z.string(),
|
|
68
|
+
/**
|
|
69
|
+
* Execution type
|
|
70
|
+
*/
|
|
71
|
+
executionType: ScheduleExecutionType,
|
|
72
|
+
/**
|
|
73
|
+
* Last slice at timestamp
|
|
74
|
+
*/
|
|
75
|
+
lastSliceAt: z.string().optional(),
|
|
76
|
+
/**
|
|
77
|
+
* Start at timestamp
|
|
78
|
+
*/
|
|
79
|
+
startAt: z.string(),
|
|
80
|
+
/**
|
|
81
|
+
* End at timestamp
|
|
82
|
+
*/
|
|
83
|
+
endAt: z.string(),
|
|
84
|
+
/**
|
|
85
|
+
* When the schedule was cancelled
|
|
86
|
+
*/
|
|
87
|
+
cancelledAt: z.string().optional(),
|
|
88
|
+
/**
|
|
89
|
+
* Reason for the schedule being cancelled
|
|
90
|
+
*/
|
|
91
|
+
cancelledReason: ScheduleCancelledReason.optional(),
|
|
92
|
+
/**
|
|
93
|
+
* Created at timestamp
|
|
94
|
+
*/
|
|
95
|
+
createdAt: z.string(),
|
|
96
|
+
/**
|
|
97
|
+
* Updated at timestamp
|
|
98
|
+
*/
|
|
99
|
+
updatedAt: z.string(),
|
|
100
|
+
/**
|
|
101
|
+
* Fills
|
|
102
|
+
*/
|
|
103
|
+
fills: z.array(Fill).optional()
|
|
104
|
+
});
|
|
105
|
+
const TWAPOpen = BaseSchedule.extend({
|
|
106
|
+
/**
|
|
107
|
+
* Strategy
|
|
108
|
+
*/
|
|
109
|
+
strategy: z.literal("TWAP"),
|
|
110
|
+
/**
|
|
111
|
+
* Intent
|
|
112
|
+
*/
|
|
113
|
+
intent: z.literal("OPEN"),
|
|
114
|
+
/**
|
|
115
|
+
* Slice interval in milliseconds
|
|
116
|
+
*/
|
|
117
|
+
sliceIntervalMs: z.number(),
|
|
118
|
+
/**
|
|
119
|
+
* Slice legs
|
|
120
|
+
*/
|
|
121
|
+
sliceLegs: z.array(TWAPSliceOpenLeg),
|
|
122
|
+
/**
|
|
123
|
+
* Target notional
|
|
124
|
+
*/
|
|
125
|
+
targetNotional: UnsignedDecimalString,
|
|
126
|
+
/**
|
|
127
|
+
* Remaining notional
|
|
128
|
+
*/
|
|
129
|
+
remainingNotional: UnsignedDecimalString
|
|
130
|
+
});
|
|
131
|
+
const TWAPClose = BaseSchedule.extend({
|
|
132
|
+
/**
|
|
133
|
+
* Strategy
|
|
134
|
+
*/
|
|
135
|
+
strategy: z.literal("TWAP"),
|
|
136
|
+
/**
|
|
137
|
+
* Intent
|
|
138
|
+
*/
|
|
139
|
+
intent: z.literal("CLOSE"),
|
|
140
|
+
/**
|
|
141
|
+
* Slice interval in milliseconds
|
|
142
|
+
*/
|
|
143
|
+
sliceIntervalMs: z.number(),
|
|
144
|
+
/**
|
|
145
|
+
* Position UUID
|
|
146
|
+
*/
|
|
147
|
+
positionId: z.uuid(),
|
|
148
|
+
/**
|
|
149
|
+
* Slice legs
|
|
150
|
+
*/
|
|
151
|
+
sliceLegs: z.array(TWAPSliceCloseLeg),
|
|
152
|
+
/**
|
|
153
|
+
* Initial exposure
|
|
154
|
+
*/
|
|
155
|
+
initialExposure: z.record(InstrumentId, SignedDecimalString)
|
|
156
|
+
});
|
|
157
|
+
const Schedule = z.discriminatedUnion("intent", [TWAPOpen, TWAPClose]);
|
|
158
|
+
|
|
159
|
+
export { Schedule, ScheduleCancelledReason, ScheduleExecutionType, ScheduleIntent, ScheduleSliceMode, ScheduleStatus, ScheduleStrategy, TWAPClose, TWAPOpen };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const CreateTWAPOpen: z.ZodObject<{
|
|
3
|
+
startAt: z.ZodDefault<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
4
|
+
endAt: z.ZodDefault<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
5
|
+
strategy: z.ZodLiteral<"TWAP">;
|
|
6
|
+
intent: z.ZodLiteral<"OPEN">;
|
|
7
|
+
executionType: z.ZodLiteral<"MARKET">;
|
|
8
|
+
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
9
|
+
symbol: z.ZodString;
|
|
10
|
+
side: z.ZodEnum<{
|
|
11
|
+
BUY: "BUY";
|
|
12
|
+
SELL: "SELL";
|
|
13
|
+
}>;
|
|
14
|
+
mode: z.ZodEnum<{
|
|
15
|
+
QUANTITY: "QUANTITY";
|
|
16
|
+
USD: "USD";
|
|
17
|
+
}>;
|
|
18
|
+
stepAmount: z.ZodString;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
targetNotional: z.ZodString;
|
|
21
|
+
sliceIntervalMs: z.ZodInt;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
declare const CreateTWAPClose: z.ZodObject<{
|
|
24
|
+
startAt: z.ZodDefault<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
25
|
+
endAt: z.ZodDefault<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
26
|
+
strategy: z.ZodLiteral<"TWAP">;
|
|
27
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
28
|
+
executionType: z.ZodLiteral<"MARKET">;
|
|
29
|
+
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
30
|
+
symbol: z.ZodString;
|
|
31
|
+
stepAmount: z.ZodString;
|
|
32
|
+
}, z.core.$strip>>;
|
|
33
|
+
positionId: z.ZodUUID;
|
|
34
|
+
sliceIntervalMs: z.ZodInt;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export declare const CreateSchedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
37
|
+
startAt: z.ZodDefault<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
38
|
+
endAt: z.ZodDefault<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
39
|
+
strategy: z.ZodLiteral<"TWAP">;
|
|
40
|
+
intent: z.ZodLiteral<"OPEN">;
|
|
41
|
+
executionType: z.ZodLiteral<"MARKET">;
|
|
42
|
+
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
43
|
+
symbol: z.ZodString;
|
|
44
|
+
side: z.ZodEnum<{
|
|
45
|
+
BUY: "BUY";
|
|
46
|
+
SELL: "SELL";
|
|
47
|
+
}>;
|
|
48
|
+
mode: z.ZodEnum<{
|
|
49
|
+
QUANTITY: "QUANTITY";
|
|
50
|
+
USD: "USD";
|
|
51
|
+
}>;
|
|
52
|
+
stepAmount: z.ZodString;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
targetNotional: z.ZodString;
|
|
55
|
+
sliceIntervalMs: z.ZodInt;
|
|
56
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
57
|
+
startAt: z.ZodDefault<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
58
|
+
endAt: z.ZodDefault<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
59
|
+
strategy: z.ZodLiteral<"TWAP">;
|
|
60
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
61
|
+
executionType: z.ZodLiteral<"MARKET">;
|
|
62
|
+
sliceLegs: z.ZodArray<z.ZodObject<{
|
|
63
|
+
symbol: z.ZodString;
|
|
64
|
+
stepAmount: z.ZodString;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
positionId: z.ZodUUID;
|
|
67
|
+
sliceIntervalMs: z.ZodInt;
|
|
68
|
+
}, z.core.$strip>], "intent">;
|
|
69
|
+
export type CreateTWAPOpen = z.output<typeof CreateTWAPOpen>;
|
|
70
|
+
export type CreateTWAPClose = z.output<typeof CreateTWAPClose>;
|
|
71
|
+
export type CreateSchedule = z.output<typeof CreateSchedule>;
|
|
72
|
+
export {};
|