@pear-protocol/types 0.0.6 → 0.0.8
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/connector/index.d.ts +3 -3
- package/dist/connector/index.js +1 -1
- package/dist/execution/entities.d.ts +20 -20
- package/dist/execution/queries.d.ts +1 -1
- package/dist/execution/responses.d.ts +6 -6
- package/dist/fill/entities.d.ts +1 -1
- package/dist/fill/queries.d.ts +1 -1
- package/dist/fill/responses.d.ts +2 -2
- package/dist/funding/queries.d.ts +1 -1
- package/dist/instrument/entities.d.ts +1 -1
- package/dist/instrument/entities.js +2 -2
- package/dist/instrument/queries.d.ts +1 -1
- package/dist/instrument/responses.d.ts +1 -1
- package/dist/order/entities.d.ts +2 -2
- package/dist/position/entities.d.ts +1 -1
- package/dist/position/queries.d.ts +1 -1
- package/dist/position/responses.d.ts +1 -1
- package/dist/price/queries.d.ts +1 -1
- package/dist/schedule/entities.d.ts +10 -10
- package/dist/schedule/payloads.d.ts +8 -8
- package/dist/schedule/payloads.js +9 -5
- package/dist/schedule/queries.d.ts +1 -1
- package/dist/schedule/responses.d.ts +8 -8
- package/dist/trade/responses.d.ts +24 -24
- package/dist/trade-accounts/entities.d.ts +1 -1
- package/dist/trade-accounts/payloads.d.ts +4 -4
- package/dist/trade-accounts/payloads.js +9 -9
- package/dist/trade-accounts/response.d.ts +3 -3
- package/dist/trade-accounts/response.js +3 -3
- package/dist/trigger/entities/index.d.ts +20 -20
- package/dist/trigger/queries.d.ts +1 -1
- package/dist/trigger/responses.d.ts +12 -12
- package/dist/users/payloads.d.ts +1 -1
- package/dist/users/payloads.js +19 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const Connector: z.ZodEnum<{
|
|
3
3
|
hyperliquid: "hyperliquid";
|
|
4
|
-
|
|
4
|
+
binance: "binance";
|
|
5
5
|
bybit: "bybit";
|
|
6
6
|
okx: "okx";
|
|
7
7
|
}>;
|
|
@@ -9,7 +9,7 @@ export type Connector = z.infer<typeof Connector>;
|
|
|
9
9
|
export type HyperliquidCredentialsDTO = {
|
|
10
10
|
signer_key: `0x${string}`;
|
|
11
11
|
};
|
|
12
|
-
export type
|
|
12
|
+
export type BinanceCredentialsDTO = {
|
|
13
13
|
api_key: string;
|
|
14
14
|
api_secret: string;
|
|
15
15
|
};
|
|
@@ -24,7 +24,7 @@ export type OkxCredentialsDTO = {
|
|
|
24
24
|
};
|
|
25
25
|
export type ConnectorCredentialsDTO = {
|
|
26
26
|
hyperliquid: HyperliquidCredentialsDTO;
|
|
27
|
-
|
|
27
|
+
binance: BinanceCredentialsDTO;
|
|
28
28
|
bybit: BybitCredentialsDTO;
|
|
29
29
|
okx: OkxCredentialsDTO;
|
|
30
30
|
};
|
package/dist/connector/index.js
CHANGED
|
@@ -39,7 +39,7 @@ export declare const BaseExecution: z.ZodObject<{
|
|
|
39
39
|
id: z.ZodUUID;
|
|
40
40
|
connector: z.ZodEnum<{
|
|
41
41
|
hyperliquid: "hyperliquid";
|
|
42
|
-
|
|
42
|
+
binance: "binance";
|
|
43
43
|
bybit: "bybit";
|
|
44
44
|
okx: "okx";
|
|
45
45
|
}>;
|
|
@@ -65,7 +65,7 @@ export declare const BaseExecution: z.ZodObject<{
|
|
|
65
65
|
id: z.ZodUUID;
|
|
66
66
|
connector: z.ZodEnum<{
|
|
67
67
|
hyperliquid: "hyperliquid";
|
|
68
|
-
|
|
68
|
+
binance: "binance";
|
|
69
69
|
bybit: "bybit";
|
|
70
70
|
okx: "okx";
|
|
71
71
|
}>;
|
|
@@ -97,7 +97,7 @@ export declare const MarketOpenExecution: z.ZodObject<{
|
|
|
97
97
|
id: z.ZodUUID;
|
|
98
98
|
connector: z.ZodEnum<{
|
|
99
99
|
hyperliquid: "hyperliquid";
|
|
100
|
-
|
|
100
|
+
binance: "binance";
|
|
101
101
|
bybit: "bybit";
|
|
102
102
|
okx: "okx";
|
|
103
103
|
}>;
|
|
@@ -115,7 +115,7 @@ export declare const MarketOpenExecution: z.ZodObject<{
|
|
|
115
115
|
id: z.ZodUUID;
|
|
116
116
|
connector: z.ZodEnum<{
|
|
117
117
|
hyperliquid: "hyperliquid";
|
|
118
|
-
|
|
118
|
+
binance: "binance";
|
|
119
119
|
bybit: "bybit";
|
|
120
120
|
okx: "okx";
|
|
121
121
|
}>;
|
|
@@ -174,7 +174,7 @@ export declare const MarketAdjustExecution: z.ZodObject<{
|
|
|
174
174
|
id: z.ZodUUID;
|
|
175
175
|
connector: z.ZodEnum<{
|
|
176
176
|
hyperliquid: "hyperliquid";
|
|
177
|
-
|
|
177
|
+
binance: "binance";
|
|
178
178
|
bybit: "bybit";
|
|
179
179
|
okx: "okx";
|
|
180
180
|
}>;
|
|
@@ -192,7 +192,7 @@ export declare const MarketAdjustExecution: z.ZodObject<{
|
|
|
192
192
|
id: z.ZodUUID;
|
|
193
193
|
connector: z.ZodEnum<{
|
|
194
194
|
hyperliquid: "hyperliquid";
|
|
195
|
-
|
|
195
|
+
binance: "binance";
|
|
196
196
|
bybit: "bybit";
|
|
197
197
|
okx: "okx";
|
|
198
198
|
}>;
|
|
@@ -255,7 +255,7 @@ export declare const MarketCloseExecution: z.ZodObject<{
|
|
|
255
255
|
id: z.ZodUUID;
|
|
256
256
|
connector: z.ZodEnum<{
|
|
257
257
|
hyperliquid: "hyperliquid";
|
|
258
|
-
|
|
258
|
+
binance: "binance";
|
|
259
259
|
bybit: "bybit";
|
|
260
260
|
okx: "okx";
|
|
261
261
|
}>;
|
|
@@ -273,7 +273,7 @@ export declare const MarketCloseExecution: z.ZodObject<{
|
|
|
273
273
|
id: z.ZodUUID;
|
|
274
274
|
connector: z.ZodEnum<{
|
|
275
275
|
hyperliquid: "hyperliquid";
|
|
276
|
-
|
|
276
|
+
binance: "binance";
|
|
277
277
|
bybit: "bybit";
|
|
278
278
|
okx: "okx";
|
|
279
279
|
}>;
|
|
@@ -311,7 +311,7 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
311
311
|
id: z.ZodUUID;
|
|
312
312
|
connector: z.ZodEnum<{
|
|
313
313
|
hyperliquid: "hyperliquid";
|
|
314
|
-
|
|
314
|
+
binance: "binance";
|
|
315
315
|
bybit: "bybit";
|
|
316
316
|
okx: "okx";
|
|
317
317
|
}>;
|
|
@@ -329,7 +329,7 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
329
329
|
id: z.ZodUUID;
|
|
330
330
|
connector: z.ZodEnum<{
|
|
331
331
|
hyperliquid: "hyperliquid";
|
|
332
|
-
|
|
332
|
+
binance: "binance";
|
|
333
333
|
bybit: "bybit";
|
|
334
334
|
okx: "okx";
|
|
335
335
|
}>;
|
|
@@ -387,7 +387,7 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
387
387
|
id: z.ZodUUID;
|
|
388
388
|
connector: z.ZodEnum<{
|
|
389
389
|
hyperliquid: "hyperliquid";
|
|
390
|
-
|
|
390
|
+
binance: "binance";
|
|
391
391
|
bybit: "bybit";
|
|
392
392
|
okx: "okx";
|
|
393
393
|
}>;
|
|
@@ -405,7 +405,7 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
405
405
|
id: z.ZodUUID;
|
|
406
406
|
connector: z.ZodEnum<{
|
|
407
407
|
hyperliquid: "hyperliquid";
|
|
408
|
-
|
|
408
|
+
binance: "binance";
|
|
409
409
|
bybit: "bybit";
|
|
410
410
|
okx: "okx";
|
|
411
411
|
}>;
|
|
@@ -467,7 +467,7 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
467
467
|
id: z.ZodUUID;
|
|
468
468
|
connector: z.ZodEnum<{
|
|
469
469
|
hyperliquid: "hyperliquid";
|
|
470
|
-
|
|
470
|
+
binance: "binance";
|
|
471
471
|
bybit: "bybit";
|
|
472
472
|
okx: "okx";
|
|
473
473
|
}>;
|
|
@@ -485,7 +485,7 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
485
485
|
id: z.ZodUUID;
|
|
486
486
|
connector: z.ZodEnum<{
|
|
487
487
|
hyperliquid: "hyperliquid";
|
|
488
|
-
|
|
488
|
+
binance: "binance";
|
|
489
489
|
bybit: "bybit";
|
|
490
490
|
okx: "okx";
|
|
491
491
|
}>;
|
|
@@ -523,7 +523,7 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
|
|
|
523
523
|
id: z.ZodUUID;
|
|
524
524
|
connector: z.ZodEnum<{
|
|
525
525
|
hyperliquid: "hyperliquid";
|
|
526
|
-
|
|
526
|
+
binance: "binance";
|
|
527
527
|
bybit: "bybit";
|
|
528
528
|
okx: "okx";
|
|
529
529
|
}>;
|
|
@@ -541,7 +541,7 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
|
|
|
541
541
|
id: z.ZodUUID;
|
|
542
542
|
connector: z.ZodEnum<{
|
|
543
543
|
hyperliquid: "hyperliquid";
|
|
544
|
-
|
|
544
|
+
binance: "binance";
|
|
545
545
|
bybit: "bybit";
|
|
546
546
|
okx: "okx";
|
|
547
547
|
}>;
|
|
@@ -599,7 +599,7 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
|
|
|
599
599
|
id: z.ZodUUID;
|
|
600
600
|
connector: z.ZodEnum<{
|
|
601
601
|
hyperliquid: "hyperliquid";
|
|
602
|
-
|
|
602
|
+
binance: "binance";
|
|
603
603
|
bybit: "bybit";
|
|
604
604
|
okx: "okx";
|
|
605
605
|
}>;
|
|
@@ -617,7 +617,7 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
|
|
|
617
617
|
id: z.ZodUUID;
|
|
618
618
|
connector: z.ZodEnum<{
|
|
619
619
|
hyperliquid: "hyperliquid";
|
|
620
|
-
|
|
620
|
+
binance: "binance";
|
|
621
621
|
bybit: "bybit";
|
|
622
622
|
okx: "okx";
|
|
623
623
|
}>;
|
|
@@ -679,7 +679,7 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
|
|
|
679
679
|
id: z.ZodUUID;
|
|
680
680
|
connector: z.ZodEnum<{
|
|
681
681
|
hyperliquid: "hyperliquid";
|
|
682
|
-
|
|
682
|
+
binance: "binance";
|
|
683
683
|
bybit: "bybit";
|
|
684
684
|
okx: "okx";
|
|
685
685
|
}>;
|
|
@@ -697,7 +697,7 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
|
|
|
697
697
|
id: z.ZodUUID;
|
|
698
698
|
connector: z.ZodEnum<{
|
|
699
699
|
hyperliquid: "hyperliquid";
|
|
700
|
-
|
|
700
|
+
binance: "binance";
|
|
701
701
|
bybit: "bybit";
|
|
702
702
|
okx: "okx";
|
|
703
703
|
}>;
|
|
@@ -6,7 +6,7 @@ export declare const ExecutionListResponse: z.ZodObject<{
|
|
|
6
6
|
id: z.ZodUUID;
|
|
7
7
|
connector: z.ZodEnum<{
|
|
8
8
|
hyperliquid: "hyperliquid";
|
|
9
|
-
|
|
9
|
+
binance: "binance";
|
|
10
10
|
bybit: "bybit";
|
|
11
11
|
okx: "okx";
|
|
12
12
|
}>;
|
|
@@ -24,7 +24,7 @@ export declare const ExecutionListResponse: z.ZodObject<{
|
|
|
24
24
|
id: z.ZodUUID;
|
|
25
25
|
connector: z.ZodEnum<{
|
|
26
26
|
hyperliquid: "hyperliquid";
|
|
27
|
-
|
|
27
|
+
binance: "binance";
|
|
28
28
|
bybit: "bybit";
|
|
29
29
|
okx: "okx";
|
|
30
30
|
}>;
|
|
@@ -82,7 +82,7 @@ export declare const ExecutionListResponse: z.ZodObject<{
|
|
|
82
82
|
id: z.ZodUUID;
|
|
83
83
|
connector: z.ZodEnum<{
|
|
84
84
|
hyperliquid: "hyperliquid";
|
|
85
|
-
|
|
85
|
+
binance: "binance";
|
|
86
86
|
bybit: "bybit";
|
|
87
87
|
okx: "okx";
|
|
88
88
|
}>;
|
|
@@ -100,7 +100,7 @@ export declare const ExecutionListResponse: z.ZodObject<{
|
|
|
100
100
|
id: z.ZodUUID;
|
|
101
101
|
connector: z.ZodEnum<{
|
|
102
102
|
hyperliquid: "hyperliquid";
|
|
103
|
-
|
|
103
|
+
binance: "binance";
|
|
104
104
|
bybit: "bybit";
|
|
105
105
|
okx: "okx";
|
|
106
106
|
}>;
|
|
@@ -162,7 +162,7 @@ export declare const ExecutionListResponse: z.ZodObject<{
|
|
|
162
162
|
id: z.ZodUUID;
|
|
163
163
|
connector: z.ZodEnum<{
|
|
164
164
|
hyperliquid: "hyperliquid";
|
|
165
|
-
|
|
165
|
+
binance: "binance";
|
|
166
166
|
bybit: "bybit";
|
|
167
167
|
okx: "okx";
|
|
168
168
|
}>;
|
|
@@ -180,7 +180,7 @@ export declare const ExecutionListResponse: z.ZodObject<{
|
|
|
180
180
|
id: z.ZodUUID;
|
|
181
181
|
connector: z.ZodEnum<{
|
|
182
182
|
hyperliquid: "hyperliquid";
|
|
183
|
-
|
|
183
|
+
binance: "binance";
|
|
184
184
|
bybit: "bybit";
|
|
185
185
|
okx: "okx";
|
|
186
186
|
}>;
|
package/dist/fill/entities.d.ts
CHANGED
package/dist/fill/queries.d.ts
CHANGED
package/dist/fill/responses.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare const FillListResponse: z.ZodObject<{
|
|
|
10
10
|
positionId: z.ZodUUID;
|
|
11
11
|
connector: z.ZodEnum<{
|
|
12
12
|
hyperliquid: "hyperliquid";
|
|
13
|
-
|
|
13
|
+
binance: "binance";
|
|
14
14
|
bybit: "bybit";
|
|
15
15
|
okx: "okx";
|
|
16
16
|
}>;
|
|
@@ -36,7 +36,7 @@ export declare const PositionFillListResponse: z.ZodObject<{
|
|
|
36
36
|
positionId: z.ZodUUID;
|
|
37
37
|
connector: z.ZodEnum<{
|
|
38
38
|
hyperliquid: "hyperliquid";
|
|
39
|
-
|
|
39
|
+
binance: "binance";
|
|
40
40
|
bybit: "bybit";
|
|
41
41
|
okx: "okx";
|
|
42
42
|
}>;
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { Connector } from '../connector';
|
|
3
3
|
import { InstrumentPrecision } from '../instrument-precision';
|
|
4
4
|
|
|
5
|
-
const InstrumentId = z.string();
|
|
5
|
+
const InstrumentId = z.string().trim().min(1, "Instrument ID is required").max(64, "Instrument ID must be at most 64 characters").regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/, "Instrument ID contains invalid characters");
|
|
6
6
|
const InstrumentType = z.enum(["spot", "perp", "hip3"]);
|
|
7
7
|
const Instrument = z.object({
|
|
8
8
|
/**
|
|
@@ -24,7 +24,7 @@ const Instrument = z.object({
|
|
|
24
24
|
/**
|
|
25
25
|
* The connector of the instrument.
|
|
26
26
|
* @example "hyperliquid"
|
|
27
|
-
* @example "
|
|
27
|
+
* @example "binance"
|
|
28
28
|
*/
|
|
29
29
|
connector: Connector,
|
|
30
30
|
/**
|
package/dist/order/entities.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const MarketOrder: z.ZodObject<{
|
|
|
11
11
|
id: z.ZodUUID;
|
|
12
12
|
connector: z.ZodEnum<{
|
|
13
13
|
hyperliquid: "hyperliquid";
|
|
14
|
-
|
|
14
|
+
binance: "binance";
|
|
15
15
|
bybit: "bybit";
|
|
16
16
|
okx: "okx";
|
|
17
17
|
}>;
|
|
@@ -42,7 +42,7 @@ export declare const Order: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
42
42
|
id: z.ZodUUID;
|
|
43
43
|
connector: z.ZodEnum<{
|
|
44
44
|
hyperliquid: "hyperliquid";
|
|
45
|
-
|
|
45
|
+
binance: "binance";
|
|
46
46
|
bybit: "bybit";
|
|
47
47
|
okx: "okx";
|
|
48
48
|
}>;
|
package/dist/price/queries.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ declare const BaseSchedule: z.ZodObject<{
|
|
|
51
51
|
id: z.ZodUUID;
|
|
52
52
|
connector: z.ZodEnum<{
|
|
53
53
|
hyperliquid: "hyperliquid";
|
|
54
|
-
|
|
54
|
+
binance: "binance";
|
|
55
55
|
bybit: "bybit";
|
|
56
56
|
okx: "okx";
|
|
57
57
|
}>;
|
|
@@ -92,7 +92,7 @@ declare const BaseSchedule: z.ZodObject<{
|
|
|
92
92
|
positionId: z.ZodUUID;
|
|
93
93
|
connector: z.ZodEnum<{
|
|
94
94
|
hyperliquid: "hyperliquid";
|
|
95
|
-
|
|
95
|
+
binance: "binance";
|
|
96
96
|
bybit: "bybit";
|
|
97
97
|
okx: "okx";
|
|
98
98
|
}>;
|
|
@@ -112,7 +112,7 @@ export declare const TWAPOpen: z.ZodObject<{
|
|
|
112
112
|
id: z.ZodUUID;
|
|
113
113
|
connector: z.ZodEnum<{
|
|
114
114
|
hyperliquid: "hyperliquid";
|
|
115
|
-
|
|
115
|
+
binance: "binance";
|
|
116
116
|
bybit: "bybit";
|
|
117
117
|
okx: "okx";
|
|
118
118
|
}>;
|
|
@@ -145,7 +145,7 @@ export declare const TWAPOpen: z.ZodObject<{
|
|
|
145
145
|
positionId: z.ZodUUID;
|
|
146
146
|
connector: z.ZodEnum<{
|
|
147
147
|
hyperliquid: "hyperliquid";
|
|
148
|
-
|
|
148
|
+
binance: "binance";
|
|
149
149
|
bybit: "bybit";
|
|
150
150
|
okx: "okx";
|
|
151
151
|
}>;
|
|
@@ -182,7 +182,7 @@ export declare const TWAPClose: z.ZodObject<{
|
|
|
182
182
|
id: z.ZodUUID;
|
|
183
183
|
connector: z.ZodEnum<{
|
|
184
184
|
hyperliquid: "hyperliquid";
|
|
185
|
-
|
|
185
|
+
binance: "binance";
|
|
186
186
|
bybit: "bybit";
|
|
187
187
|
okx: "okx";
|
|
188
188
|
}>;
|
|
@@ -215,7 +215,7 @@ export declare const TWAPClose: z.ZodObject<{
|
|
|
215
215
|
positionId: z.ZodUUID;
|
|
216
216
|
connector: z.ZodEnum<{
|
|
217
217
|
hyperliquid: "hyperliquid";
|
|
218
|
-
|
|
218
|
+
binance: "binance";
|
|
219
219
|
bybit: "bybit";
|
|
220
220
|
okx: "okx";
|
|
221
221
|
}>;
|
|
@@ -244,7 +244,7 @@ export declare const Schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
244
244
|
id: z.ZodUUID;
|
|
245
245
|
connector: z.ZodEnum<{
|
|
246
246
|
hyperliquid: "hyperliquid";
|
|
247
|
-
|
|
247
|
+
binance: "binance";
|
|
248
248
|
bybit: "bybit";
|
|
249
249
|
okx: "okx";
|
|
250
250
|
}>;
|
|
@@ -277,7 +277,7 @@ export declare const Schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
277
277
|
positionId: z.ZodUUID;
|
|
278
278
|
connector: z.ZodEnum<{
|
|
279
279
|
hyperliquid: "hyperliquid";
|
|
280
|
-
|
|
280
|
+
binance: "binance";
|
|
281
281
|
bybit: "bybit";
|
|
282
282
|
okx: "okx";
|
|
283
283
|
}>;
|
|
@@ -313,7 +313,7 @@ export declare const Schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
313
313
|
id: z.ZodUUID;
|
|
314
314
|
connector: z.ZodEnum<{
|
|
315
315
|
hyperliquid: "hyperliquid";
|
|
316
|
-
|
|
316
|
+
binance: "binance";
|
|
317
317
|
bybit: "bybit";
|
|
318
318
|
okx: "okx";
|
|
319
319
|
}>;
|
|
@@ -346,7 +346,7 @@ export declare const Schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
346
346
|
positionId: z.ZodUUID;
|
|
347
347
|
connector: z.ZodEnum<{
|
|
348
348
|
hyperliquid: "hyperliquid";
|
|
349
|
-
|
|
349
|
+
binance: "binance";
|
|
350
350
|
bybit: "bybit";
|
|
351
351
|
okx: "okx";
|
|
352
352
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
declare const CreateTWAPOpen: z.ZodObject<{
|
|
3
|
-
startAt: z.
|
|
4
|
-
endAt: z.
|
|
3
|
+
startAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
|
|
4
|
+
endAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
|
|
5
5
|
strategy: z.ZodLiteral<"TWAP">;
|
|
6
6
|
intent: z.ZodLiteral<"OPEN">;
|
|
7
7
|
executionType: z.ZodLiteral<"MARKET">;
|
|
@@ -21,8 +21,8 @@ declare const CreateTWAPOpen: z.ZodObject<{
|
|
|
21
21
|
sliceIntervalMs: z.ZodInt;
|
|
22
22
|
}, z.core.$strip>;
|
|
23
23
|
declare const CreateTWAPClose: z.ZodObject<{
|
|
24
|
-
startAt: z.
|
|
25
|
-
endAt: z.
|
|
24
|
+
startAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
|
|
25
|
+
endAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
|
|
26
26
|
strategy: z.ZodLiteral<"TWAP">;
|
|
27
27
|
intent: z.ZodLiteral<"CLOSE">;
|
|
28
28
|
executionType: z.ZodLiteral<"MARKET">;
|
|
@@ -34,8 +34,8 @@ declare const CreateTWAPClose: z.ZodObject<{
|
|
|
34
34
|
sliceIntervalMs: z.ZodInt;
|
|
35
35
|
}, z.core.$strip>;
|
|
36
36
|
export declare const CreateSchedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
37
|
-
startAt: z.
|
|
38
|
-
endAt: z.
|
|
37
|
+
startAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
|
|
38
|
+
endAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
|
|
39
39
|
strategy: z.ZodLiteral<"TWAP">;
|
|
40
40
|
intent: z.ZodLiteral<"OPEN">;
|
|
41
41
|
executionType: z.ZodLiteral<"MARKET">;
|
|
@@ -54,8 +54,8 @@ export declare const CreateSchedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
54
54
|
targetNotional: z.ZodString;
|
|
55
55
|
sliceIntervalMs: z.ZodInt;
|
|
56
56
|
}, z.core.$strip>, z.ZodObject<{
|
|
57
|
-
startAt: z.
|
|
58
|
-
endAt: z.
|
|
57
|
+
startAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
|
|
58
|
+
endAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
|
|
59
59
|
strategy: z.ZodLiteral<"TWAP">;
|
|
60
60
|
intent: z.ZodLiteral<"CLOSE">;
|
|
61
61
|
executionType: z.ZodLiteral<"MARKET">;
|
|
@@ -4,6 +4,9 @@ import { InstrumentId } from '../instrument';
|
|
|
4
4
|
import { ScheduleSliceMode } from './entities';
|
|
5
5
|
|
|
6
6
|
const SliceInterval = z.int().min(6e4).max(26784e5);
|
|
7
|
+
const THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
8
|
+
const DefaultStartAt = z.coerce.date().optional().transform((value) => value ?? /* @__PURE__ */ new Date());
|
|
9
|
+
const DefaultEndAt = z.coerce.date().optional().transform((value) => value ?? new Date(Date.now() + THIRTY_DAYS_MS));
|
|
7
10
|
const TWAPSliceOpenLeg = z.object({
|
|
8
11
|
/**
|
|
9
12
|
* Instrument ID
|
|
@@ -38,14 +41,15 @@ const BaseSchedule = z.object({
|
|
|
38
41
|
/**
|
|
39
42
|
* Start at date
|
|
40
43
|
*/
|
|
41
|
-
startAt:
|
|
44
|
+
startAt: DefaultStartAt,
|
|
42
45
|
/**
|
|
43
46
|
* End at date
|
|
44
47
|
*/
|
|
45
|
-
endAt:
|
|
46
|
-
|
|
48
|
+
endAt: DefaultEndAt
|
|
49
|
+
}).refine((data) => data.startAt && data.endAt && data.startAt < data.endAt, {
|
|
50
|
+
message: "Start at date must be before end at date"
|
|
47
51
|
});
|
|
48
|
-
const CreateTWAPOpen = BaseSchedule.
|
|
52
|
+
const CreateTWAPOpen = BaseSchedule.safeExtend({
|
|
49
53
|
/**
|
|
50
54
|
* Strategy
|
|
51
55
|
*/
|
|
@@ -71,7 +75,7 @@ const CreateTWAPOpen = BaseSchedule.extend({
|
|
|
71
75
|
*/
|
|
72
76
|
sliceIntervalMs: SliceInterval
|
|
73
77
|
});
|
|
74
|
-
const CreateTWAPClose = BaseSchedule.
|
|
78
|
+
const CreateTWAPClose = BaseSchedule.safeExtend({
|
|
75
79
|
/**
|
|
76
80
|
* Strategy
|
|
77
81
|
*/
|