@pear-protocol/types 1.20.0 → 1.22.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/trade/responses.d.ts +273 -1
- package/dist/trade/responses.js +1 -1
- 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
|
@@ -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;
|
|
@@ -1095,5 +1095,277 @@ export declare const CreateTradeReverseResponse: z.ZodObject<{
|
|
|
1095
1095
|
}, z.core.$strip>], "intent">], "orderType">;
|
|
1096
1096
|
}, z.core.$strip>;
|
|
1097
1097
|
export type CreateTradeReverseResponse = z.output<typeof CreateTradeReverseResponse>;
|
|
1098
|
-
export declare const CreateTradeCloseAllResponse: z.ZodObject<{
|
|
1098
|
+
export declare const CreateTradeCloseAllResponse: z.ZodObject<{
|
|
1099
|
+
executions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1100
|
+
id: z.ZodUUID;
|
|
1101
|
+
connector: z.ZodEnum<{
|
|
1102
|
+
hyperliquid: "hyperliquid";
|
|
1103
|
+
binance: "binance";
|
|
1104
|
+
bybit: "bybit";
|
|
1105
|
+
okx: "okx";
|
|
1106
|
+
lighter: "lighter";
|
|
1107
|
+
}>;
|
|
1108
|
+
status: z.ZodEnum<{
|
|
1109
|
+
CANCELLED: "CANCELLED";
|
|
1110
|
+
IDLE: "IDLE";
|
|
1111
|
+
ACTIVE: "ACTIVE";
|
|
1112
|
+
COMPLETED: "COMPLETED";
|
|
1113
|
+
FAILED: "FAILED";
|
|
1114
|
+
}>;
|
|
1115
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1116
|
+
createdAt: z.ZodString;
|
|
1117
|
+
updatedAt: z.ZodString;
|
|
1118
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1119
|
+
id: z.ZodUUID;
|
|
1120
|
+
connector: z.ZodEnum<{
|
|
1121
|
+
hyperliquid: "hyperliquid";
|
|
1122
|
+
binance: "binance";
|
|
1123
|
+
bybit: "bybit";
|
|
1124
|
+
okx: "okx";
|
|
1125
|
+
lighter: "lighter";
|
|
1126
|
+
}>;
|
|
1127
|
+
status: z.ZodEnum<{
|
|
1128
|
+
PENDING: "PENDING";
|
|
1129
|
+
PARTIAL: "PARTIAL";
|
|
1130
|
+
FILLED: "FILLED";
|
|
1131
|
+
CANCELLED: "CANCELLED";
|
|
1132
|
+
REJECTED: "REJECTED";
|
|
1133
|
+
}>;
|
|
1134
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1135
|
+
createdAt: z.ZodString;
|
|
1136
|
+
updatedAt: z.ZodString;
|
|
1137
|
+
type: z.ZodLiteral<"MARKET">;
|
|
1138
|
+
symbol: z.ZodString;
|
|
1139
|
+
side: z.ZodEnum<{
|
|
1140
|
+
BUY: "BUY";
|
|
1141
|
+
SELL: "SELL";
|
|
1142
|
+
}>;
|
|
1143
|
+
reduceOnly: z.ZodBoolean;
|
|
1144
|
+
quantity: z.ZodString;
|
|
1145
|
+
price: z.ZodString;
|
|
1146
|
+
filledQuantity: z.ZodString;
|
|
1147
|
+
filledPrice: z.ZodOptional<z.ZodString>;
|
|
1148
|
+
}, z.core.$strip>], "type">>>;
|
|
1149
|
+
intent: z.ZodLiteral<"OPEN">;
|
|
1150
|
+
orderType: z.ZodLiteral<"MARKET">;
|
|
1151
|
+
legs: z.ZodTuple<[z.ZodObject<{
|
|
1152
|
+
symbol: z.ZodString;
|
|
1153
|
+
side: z.ZodEnum<{
|
|
1154
|
+
BUY: "BUY";
|
|
1155
|
+
SELL: "SELL";
|
|
1156
|
+
}>;
|
|
1157
|
+
mode: z.ZodEnum<{
|
|
1158
|
+
QUANTITY: "QUANTITY";
|
|
1159
|
+
USD: "USD";
|
|
1160
|
+
}>;
|
|
1161
|
+
amount: z.ZodString;
|
|
1162
|
+
reduceOnly: z.ZodBoolean;
|
|
1163
|
+
}, z.core.$strip>], z.ZodObject<{
|
|
1164
|
+
symbol: z.ZodString;
|
|
1165
|
+
side: z.ZodEnum<{
|
|
1166
|
+
BUY: "BUY";
|
|
1167
|
+
SELL: "SELL";
|
|
1168
|
+
}>;
|
|
1169
|
+
mode: z.ZodEnum<{
|
|
1170
|
+
QUANTITY: "QUANTITY";
|
|
1171
|
+
USD: "USD";
|
|
1172
|
+
}>;
|
|
1173
|
+
amount: z.ZodString;
|
|
1174
|
+
reduceOnly: z.ZodBoolean;
|
|
1175
|
+
}, z.core.$strip>>;
|
|
1176
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1177
|
+
id: z.ZodUUID;
|
|
1178
|
+
connector: z.ZodEnum<{
|
|
1179
|
+
hyperliquid: "hyperliquid";
|
|
1180
|
+
binance: "binance";
|
|
1181
|
+
bybit: "bybit";
|
|
1182
|
+
okx: "okx";
|
|
1183
|
+
lighter: "lighter";
|
|
1184
|
+
}>;
|
|
1185
|
+
status: z.ZodEnum<{
|
|
1186
|
+
CANCELLED: "CANCELLED";
|
|
1187
|
+
IDLE: "IDLE";
|
|
1188
|
+
ACTIVE: "ACTIVE";
|
|
1189
|
+
COMPLETED: "COMPLETED";
|
|
1190
|
+
FAILED: "FAILED";
|
|
1191
|
+
}>;
|
|
1192
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1193
|
+
createdAt: z.ZodString;
|
|
1194
|
+
updatedAt: z.ZodString;
|
|
1195
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1196
|
+
id: z.ZodUUID;
|
|
1197
|
+
connector: z.ZodEnum<{
|
|
1198
|
+
hyperliquid: "hyperliquid";
|
|
1199
|
+
binance: "binance";
|
|
1200
|
+
bybit: "bybit";
|
|
1201
|
+
okx: "okx";
|
|
1202
|
+
lighter: "lighter";
|
|
1203
|
+
}>;
|
|
1204
|
+
status: z.ZodEnum<{
|
|
1205
|
+
PENDING: "PENDING";
|
|
1206
|
+
PARTIAL: "PARTIAL";
|
|
1207
|
+
FILLED: "FILLED";
|
|
1208
|
+
CANCELLED: "CANCELLED";
|
|
1209
|
+
REJECTED: "REJECTED";
|
|
1210
|
+
}>;
|
|
1211
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1212
|
+
createdAt: z.ZodString;
|
|
1213
|
+
updatedAt: z.ZodString;
|
|
1214
|
+
type: z.ZodLiteral<"MARKET">;
|
|
1215
|
+
symbol: z.ZodString;
|
|
1216
|
+
side: z.ZodEnum<{
|
|
1217
|
+
BUY: "BUY";
|
|
1218
|
+
SELL: "SELL";
|
|
1219
|
+
}>;
|
|
1220
|
+
reduceOnly: z.ZodBoolean;
|
|
1221
|
+
quantity: z.ZodString;
|
|
1222
|
+
price: z.ZodString;
|
|
1223
|
+
filledQuantity: z.ZodString;
|
|
1224
|
+
filledPrice: z.ZodOptional<z.ZodString>;
|
|
1225
|
+
}, z.core.$strip>], "type">>>;
|
|
1226
|
+
intent: z.ZodLiteral<"ADJUST">;
|
|
1227
|
+
orderType: z.ZodLiteral<"MARKET">;
|
|
1228
|
+
position: z.ZodObject<{
|
|
1229
|
+
id: z.ZodUUID;
|
|
1230
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
1231
|
+
}, z.core.$strip>;
|
|
1232
|
+
legs: z.ZodTuple<[z.ZodObject<{
|
|
1233
|
+
symbol: z.ZodString;
|
|
1234
|
+
side: z.ZodEnum<{
|
|
1235
|
+
BUY: "BUY";
|
|
1236
|
+
SELL: "SELL";
|
|
1237
|
+
}>;
|
|
1238
|
+
mode: z.ZodEnum<{
|
|
1239
|
+
QUANTITY: "QUANTITY";
|
|
1240
|
+
USD: "USD";
|
|
1241
|
+
}>;
|
|
1242
|
+
amount: z.ZodString;
|
|
1243
|
+
reduceOnly: z.ZodBoolean;
|
|
1244
|
+
}, z.core.$strip>], z.ZodObject<{
|
|
1245
|
+
symbol: z.ZodString;
|
|
1246
|
+
side: z.ZodEnum<{
|
|
1247
|
+
BUY: "BUY";
|
|
1248
|
+
SELL: "SELL";
|
|
1249
|
+
}>;
|
|
1250
|
+
mode: z.ZodEnum<{
|
|
1251
|
+
QUANTITY: "QUANTITY";
|
|
1252
|
+
USD: "USD";
|
|
1253
|
+
}>;
|
|
1254
|
+
amount: z.ZodString;
|
|
1255
|
+
reduceOnly: z.ZodBoolean;
|
|
1256
|
+
}, z.core.$strip>>;
|
|
1257
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1258
|
+
id: z.ZodUUID;
|
|
1259
|
+
connector: z.ZodEnum<{
|
|
1260
|
+
hyperliquid: "hyperliquid";
|
|
1261
|
+
binance: "binance";
|
|
1262
|
+
bybit: "bybit";
|
|
1263
|
+
okx: "okx";
|
|
1264
|
+
lighter: "lighter";
|
|
1265
|
+
}>;
|
|
1266
|
+
status: z.ZodEnum<{
|
|
1267
|
+
CANCELLED: "CANCELLED";
|
|
1268
|
+
IDLE: "IDLE";
|
|
1269
|
+
ACTIVE: "ACTIVE";
|
|
1270
|
+
COMPLETED: "COMPLETED";
|
|
1271
|
+
FAILED: "FAILED";
|
|
1272
|
+
}>;
|
|
1273
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1274
|
+
createdAt: z.ZodString;
|
|
1275
|
+
updatedAt: z.ZodString;
|
|
1276
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1277
|
+
id: z.ZodUUID;
|
|
1278
|
+
connector: z.ZodEnum<{
|
|
1279
|
+
hyperliquid: "hyperliquid";
|
|
1280
|
+
binance: "binance";
|
|
1281
|
+
bybit: "bybit";
|
|
1282
|
+
okx: "okx";
|
|
1283
|
+
lighter: "lighter";
|
|
1284
|
+
}>;
|
|
1285
|
+
status: z.ZodEnum<{
|
|
1286
|
+
PENDING: "PENDING";
|
|
1287
|
+
PARTIAL: "PARTIAL";
|
|
1288
|
+
FILLED: "FILLED";
|
|
1289
|
+
CANCELLED: "CANCELLED";
|
|
1290
|
+
REJECTED: "REJECTED";
|
|
1291
|
+
}>;
|
|
1292
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1293
|
+
createdAt: z.ZodString;
|
|
1294
|
+
updatedAt: z.ZodString;
|
|
1295
|
+
type: z.ZodLiteral<"MARKET">;
|
|
1296
|
+
symbol: z.ZodString;
|
|
1297
|
+
side: z.ZodEnum<{
|
|
1298
|
+
BUY: "BUY";
|
|
1299
|
+
SELL: "SELL";
|
|
1300
|
+
}>;
|
|
1301
|
+
reduceOnly: z.ZodBoolean;
|
|
1302
|
+
quantity: z.ZodString;
|
|
1303
|
+
price: z.ZodString;
|
|
1304
|
+
filledQuantity: z.ZodString;
|
|
1305
|
+
filledPrice: z.ZodOptional<z.ZodString>;
|
|
1306
|
+
}, z.core.$strip>], "type">>>;
|
|
1307
|
+
intent: z.ZodLiteral<"CLOSE">;
|
|
1308
|
+
orderType: z.ZodLiteral<"MARKET">;
|
|
1309
|
+
position: z.ZodObject<{
|
|
1310
|
+
id: z.ZodUUID;
|
|
1311
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
1312
|
+
}, z.core.$strip>;
|
|
1313
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1314
|
+
id: z.ZodUUID;
|
|
1315
|
+
connector: z.ZodEnum<{
|
|
1316
|
+
hyperliquid: "hyperliquid";
|
|
1317
|
+
binance: "binance";
|
|
1318
|
+
bybit: "bybit";
|
|
1319
|
+
okx: "okx";
|
|
1320
|
+
lighter: "lighter";
|
|
1321
|
+
}>;
|
|
1322
|
+
status: z.ZodEnum<{
|
|
1323
|
+
CANCELLED: "CANCELLED";
|
|
1324
|
+
IDLE: "IDLE";
|
|
1325
|
+
ACTIVE: "ACTIVE";
|
|
1326
|
+
COMPLETED: "COMPLETED";
|
|
1327
|
+
FAILED: "FAILED";
|
|
1328
|
+
}>;
|
|
1329
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1330
|
+
createdAt: z.ZodString;
|
|
1331
|
+
updatedAt: z.ZodString;
|
|
1332
|
+
orders: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1333
|
+
id: z.ZodUUID;
|
|
1334
|
+
connector: z.ZodEnum<{
|
|
1335
|
+
hyperliquid: "hyperliquid";
|
|
1336
|
+
binance: "binance";
|
|
1337
|
+
bybit: "bybit";
|
|
1338
|
+
okx: "okx";
|
|
1339
|
+
lighter: "lighter";
|
|
1340
|
+
}>;
|
|
1341
|
+
status: z.ZodEnum<{
|
|
1342
|
+
PENDING: "PENDING";
|
|
1343
|
+
PARTIAL: "PARTIAL";
|
|
1344
|
+
FILLED: "FILLED";
|
|
1345
|
+
CANCELLED: "CANCELLED";
|
|
1346
|
+
REJECTED: "REJECTED";
|
|
1347
|
+
}>;
|
|
1348
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1349
|
+
createdAt: z.ZodString;
|
|
1350
|
+
updatedAt: z.ZodString;
|
|
1351
|
+
type: z.ZodLiteral<"MARKET">;
|
|
1352
|
+
symbol: z.ZodString;
|
|
1353
|
+
side: z.ZodEnum<{
|
|
1354
|
+
BUY: "BUY";
|
|
1355
|
+
SELL: "SELL";
|
|
1356
|
+
}>;
|
|
1357
|
+
reduceOnly: z.ZodBoolean;
|
|
1358
|
+
quantity: z.ZodString;
|
|
1359
|
+
price: z.ZodString;
|
|
1360
|
+
filledQuantity: z.ZodString;
|
|
1361
|
+
filledPrice: z.ZodOptional<z.ZodString>;
|
|
1362
|
+
}, z.core.$strip>], "type">>>;
|
|
1363
|
+
intent: z.ZodLiteral<"REVERSE">;
|
|
1364
|
+
orderType: z.ZodLiteral<"MARKET">;
|
|
1365
|
+
position: z.ZodObject<{
|
|
1366
|
+
id: z.ZodUUID;
|
|
1367
|
+
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
1368
|
+
}, z.core.$strip>;
|
|
1369
|
+
}, z.core.$strip>], "intent">], "orderType">>;
|
|
1370
|
+
}, z.core.$strip>;
|
|
1099
1371
|
export type CreateTradeCloseAllResponse = z.output<typeof CreateTradeCloseAllResponse>;
|
package/dist/trade/responses.js
CHANGED
|
@@ -5,6 +5,6 @@ const CreateTradeOpenResponse = z.object({ execution: Execution });
|
|
|
5
5
|
const CreateTradeAdjustResponse = z.object({ execution: Execution });
|
|
6
6
|
const CreateTradeCloseResponse = z.object({ execution: Execution });
|
|
7
7
|
const CreateTradeReverseResponse = z.object({ execution: Execution });
|
|
8
|
-
const CreateTradeCloseAllResponse = z.object({});
|
|
8
|
+
const CreateTradeCloseAllResponse = z.object({ executions: z.array(Execution) });
|
|
9
9
|
|
|
10
10
|
export { CreateTradeAdjustResponse, CreateTradeCloseAllResponse, CreateTradeCloseResponse, CreateTradeOpenResponse, CreateTradeReverseResponse };
|
|
@@ -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
|
*/
|