@pear-protocol/types 2.6.0 → 2.9.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/common/trade-legs.d.ts +33 -0
- package/dist/common/trade-legs.js +12 -1
- package/dist/execution/entities.d.ts +107 -0
- package/dist/execution/entities.js +25 -2
- package/dist/execution/responses.d.ts +62 -0
- package/dist/ladder/entities.d.ts +10 -10
- package/dist/ladder/responses.d.ts +30 -30
- package/dist/portfolio/responses.d.ts +2 -0
- package/dist/portfolio/responses.js +4 -0
- package/dist/position/entities.d.ts +2 -0
- package/dist/position/entities.js +4 -1
- package/dist/position/responses.d.ts +2 -0
- package/dist/trade/payloads.d.ts +28 -74
- package/dist/trade/payloads.js +17 -21
- package/dist/trade/responses.d.ts +155 -9
- package/dist/trade/responses.js +1 -9
- package/dist/trigger/common/index.d.ts +1 -1
- package/dist/trigger/entities/index.d.ts +32 -32
- package/dist/trigger/payloads/index.d.ts +6 -6
- package/dist/trigger/responses.d.ts +20 -20
- package/package.json +1 -1
|
@@ -161,14 +161,14 @@ export declare const CreateLadderResponse: z.ZodObject<{
|
|
|
161
161
|
}, z.core.$strip>>;
|
|
162
162
|
}, z.core.$strip>>>;
|
|
163
163
|
bracketType: z.ZodEnum<{
|
|
164
|
+
NONE: "NONE";
|
|
164
165
|
STOP_LOSS: "STOP_LOSS";
|
|
165
166
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
166
|
-
NONE: "NONE";
|
|
167
167
|
}>;
|
|
168
168
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
169
|
+
NONE: "NONE";
|
|
169
170
|
STOP_LOSS: "STOP_LOSS";
|
|
170
171
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
171
|
-
NONE: "NONE";
|
|
172
172
|
}>>;
|
|
173
173
|
createdAt: z.ZodString;
|
|
174
174
|
updatedAt: z.ZodString;
|
|
@@ -372,14 +372,14 @@ export declare const CreateLadderResponse: z.ZodObject<{
|
|
|
372
372
|
}, z.core.$strip>>;
|
|
373
373
|
}, z.core.$strip>>>;
|
|
374
374
|
bracketType: z.ZodEnum<{
|
|
375
|
+
NONE: "NONE";
|
|
375
376
|
STOP_LOSS: "STOP_LOSS";
|
|
376
377
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
377
|
-
NONE: "NONE";
|
|
378
378
|
}>;
|
|
379
379
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
380
|
+
NONE: "NONE";
|
|
380
381
|
STOP_LOSS: "STOP_LOSS";
|
|
381
382
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
382
|
-
NONE: "NONE";
|
|
383
383
|
}>>;
|
|
384
384
|
createdAt: z.ZodString;
|
|
385
385
|
updatedAt: z.ZodString;
|
|
@@ -629,14 +629,14 @@ export declare const CreateLadderResponse: z.ZodObject<{
|
|
|
629
629
|
}, z.core.$strip>>;
|
|
630
630
|
}, z.core.$strip>>>;
|
|
631
631
|
bracketType: z.ZodEnum<{
|
|
632
|
+
NONE: "NONE";
|
|
632
633
|
STOP_LOSS: "STOP_LOSS";
|
|
633
634
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
634
|
-
NONE: "NONE";
|
|
635
635
|
}>;
|
|
636
636
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
637
|
+
NONE: "NONE";
|
|
637
638
|
STOP_LOSS: "STOP_LOSS";
|
|
638
639
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
639
|
-
NONE: "NONE";
|
|
640
640
|
}>>;
|
|
641
641
|
createdAt: z.ZodString;
|
|
642
642
|
updatedAt: z.ZodString;
|
|
@@ -918,14 +918,14 @@ export declare const CreateLadderResponse: z.ZodObject<{
|
|
|
918
918
|
}, z.core.$strip>>;
|
|
919
919
|
}, z.core.$strip>>>;
|
|
920
920
|
bracketType: z.ZodEnum<{
|
|
921
|
+
NONE: "NONE";
|
|
921
922
|
STOP_LOSS: "STOP_LOSS";
|
|
922
923
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
923
|
-
NONE: "NONE";
|
|
924
924
|
}>;
|
|
925
925
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
926
|
+
NONE: "NONE";
|
|
926
927
|
STOP_LOSS: "STOP_LOSS";
|
|
927
928
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
928
|
-
NONE: "NONE";
|
|
929
929
|
}>>;
|
|
930
930
|
createdAt: z.ZodString;
|
|
931
931
|
updatedAt: z.ZodString;
|
|
@@ -1173,14 +1173,14 @@ export declare const CreateLadderResponse: z.ZodObject<{
|
|
|
1173
1173
|
}, z.core.$strip>>;
|
|
1174
1174
|
}, z.core.$strip>>>;
|
|
1175
1175
|
bracketType: z.ZodEnum<{
|
|
1176
|
+
NONE: "NONE";
|
|
1176
1177
|
STOP_LOSS: "STOP_LOSS";
|
|
1177
1178
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1178
|
-
NONE: "NONE";
|
|
1179
1179
|
}>;
|
|
1180
1180
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1181
|
+
NONE: "NONE";
|
|
1181
1182
|
STOP_LOSS: "STOP_LOSS";
|
|
1182
1183
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1183
|
-
NONE: "NONE";
|
|
1184
1184
|
}>>;
|
|
1185
1185
|
createdAt: z.ZodString;
|
|
1186
1186
|
updatedAt: z.ZodString;
|
|
@@ -1570,14 +1570,14 @@ export declare const LadderResponse: z.ZodObject<{
|
|
|
1570
1570
|
}, z.core.$strip>>;
|
|
1571
1571
|
}, z.core.$strip>>>;
|
|
1572
1572
|
bracketType: z.ZodEnum<{
|
|
1573
|
+
NONE: "NONE";
|
|
1573
1574
|
STOP_LOSS: "STOP_LOSS";
|
|
1574
1575
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1575
|
-
NONE: "NONE";
|
|
1576
1576
|
}>;
|
|
1577
1577
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1578
|
+
NONE: "NONE";
|
|
1578
1579
|
STOP_LOSS: "STOP_LOSS";
|
|
1579
1580
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1580
|
-
NONE: "NONE";
|
|
1581
1581
|
}>>;
|
|
1582
1582
|
createdAt: z.ZodString;
|
|
1583
1583
|
updatedAt: z.ZodString;
|
|
@@ -1781,14 +1781,14 @@ export declare const LadderResponse: z.ZodObject<{
|
|
|
1781
1781
|
}, z.core.$strip>>;
|
|
1782
1782
|
}, z.core.$strip>>>;
|
|
1783
1783
|
bracketType: z.ZodEnum<{
|
|
1784
|
+
NONE: "NONE";
|
|
1784
1785
|
STOP_LOSS: "STOP_LOSS";
|
|
1785
1786
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1786
|
-
NONE: "NONE";
|
|
1787
1787
|
}>;
|
|
1788
1788
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
1789
|
+
NONE: "NONE";
|
|
1789
1790
|
STOP_LOSS: "STOP_LOSS";
|
|
1790
1791
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
1791
|
-
NONE: "NONE";
|
|
1792
1792
|
}>>;
|
|
1793
1793
|
createdAt: z.ZodString;
|
|
1794
1794
|
updatedAt: z.ZodString;
|
|
@@ -2038,14 +2038,14 @@ export declare const LadderResponse: z.ZodObject<{
|
|
|
2038
2038
|
}, z.core.$strip>>;
|
|
2039
2039
|
}, z.core.$strip>>>;
|
|
2040
2040
|
bracketType: z.ZodEnum<{
|
|
2041
|
+
NONE: "NONE";
|
|
2041
2042
|
STOP_LOSS: "STOP_LOSS";
|
|
2042
2043
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
2043
|
-
NONE: "NONE";
|
|
2044
2044
|
}>;
|
|
2045
2045
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
2046
|
+
NONE: "NONE";
|
|
2046
2047
|
STOP_LOSS: "STOP_LOSS";
|
|
2047
2048
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
2048
|
-
NONE: "NONE";
|
|
2049
2049
|
}>>;
|
|
2050
2050
|
createdAt: z.ZodString;
|
|
2051
2051
|
updatedAt: z.ZodString;
|
|
@@ -2327,14 +2327,14 @@ export declare const LadderResponse: z.ZodObject<{
|
|
|
2327
2327
|
}, z.core.$strip>>;
|
|
2328
2328
|
}, z.core.$strip>>>;
|
|
2329
2329
|
bracketType: z.ZodEnum<{
|
|
2330
|
+
NONE: "NONE";
|
|
2330
2331
|
STOP_LOSS: "STOP_LOSS";
|
|
2331
2332
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
2332
|
-
NONE: "NONE";
|
|
2333
2333
|
}>;
|
|
2334
2334
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
2335
|
+
NONE: "NONE";
|
|
2335
2336
|
STOP_LOSS: "STOP_LOSS";
|
|
2336
2337
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
2337
|
-
NONE: "NONE";
|
|
2338
2338
|
}>>;
|
|
2339
2339
|
createdAt: z.ZodString;
|
|
2340
2340
|
updatedAt: z.ZodString;
|
|
@@ -2582,14 +2582,14 @@ export declare const LadderResponse: z.ZodObject<{
|
|
|
2582
2582
|
}, z.core.$strip>>;
|
|
2583
2583
|
}, z.core.$strip>>>;
|
|
2584
2584
|
bracketType: z.ZodEnum<{
|
|
2585
|
+
NONE: "NONE";
|
|
2585
2586
|
STOP_LOSS: "STOP_LOSS";
|
|
2586
2587
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
2587
|
-
NONE: "NONE";
|
|
2588
2588
|
}>;
|
|
2589
2589
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
2590
|
+
NONE: "NONE";
|
|
2590
2591
|
STOP_LOSS: "STOP_LOSS";
|
|
2591
2592
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
2592
|
-
NONE: "NONE";
|
|
2593
2593
|
}>>;
|
|
2594
2594
|
createdAt: z.ZodString;
|
|
2595
2595
|
updatedAt: z.ZodString;
|
|
@@ -2981,14 +2981,14 @@ export declare const LadderListResponse: z.ZodObject<{
|
|
|
2981
2981
|
}, z.core.$strip>>;
|
|
2982
2982
|
}, z.core.$strip>>>;
|
|
2983
2983
|
bracketType: z.ZodEnum<{
|
|
2984
|
+
NONE: "NONE";
|
|
2984
2985
|
STOP_LOSS: "STOP_LOSS";
|
|
2985
2986
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
2986
|
-
NONE: "NONE";
|
|
2987
2987
|
}>;
|
|
2988
2988
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
2989
|
+
NONE: "NONE";
|
|
2989
2990
|
STOP_LOSS: "STOP_LOSS";
|
|
2990
2991
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
2991
|
-
NONE: "NONE";
|
|
2992
2992
|
}>>;
|
|
2993
2993
|
createdAt: z.ZodString;
|
|
2994
2994
|
updatedAt: z.ZodString;
|
|
@@ -3192,14 +3192,14 @@ export declare const LadderListResponse: z.ZodObject<{
|
|
|
3192
3192
|
}, z.core.$strip>>;
|
|
3193
3193
|
}, z.core.$strip>>>;
|
|
3194
3194
|
bracketType: z.ZodEnum<{
|
|
3195
|
+
NONE: "NONE";
|
|
3195
3196
|
STOP_LOSS: "STOP_LOSS";
|
|
3196
3197
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
3197
|
-
NONE: "NONE";
|
|
3198
3198
|
}>;
|
|
3199
3199
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
3200
|
+
NONE: "NONE";
|
|
3200
3201
|
STOP_LOSS: "STOP_LOSS";
|
|
3201
3202
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
3202
|
-
NONE: "NONE";
|
|
3203
3203
|
}>>;
|
|
3204
3204
|
createdAt: z.ZodString;
|
|
3205
3205
|
updatedAt: z.ZodString;
|
|
@@ -3449,14 +3449,14 @@ export declare const LadderListResponse: z.ZodObject<{
|
|
|
3449
3449
|
}, z.core.$strip>>;
|
|
3450
3450
|
}, z.core.$strip>>>;
|
|
3451
3451
|
bracketType: z.ZodEnum<{
|
|
3452
|
+
NONE: "NONE";
|
|
3452
3453
|
STOP_LOSS: "STOP_LOSS";
|
|
3453
3454
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
3454
|
-
NONE: "NONE";
|
|
3455
3455
|
}>;
|
|
3456
3456
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
3457
|
+
NONE: "NONE";
|
|
3457
3458
|
STOP_LOSS: "STOP_LOSS";
|
|
3458
3459
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
3459
|
-
NONE: "NONE";
|
|
3460
3460
|
}>>;
|
|
3461
3461
|
createdAt: z.ZodString;
|
|
3462
3462
|
updatedAt: z.ZodString;
|
|
@@ -3738,14 +3738,14 @@ export declare const LadderListResponse: z.ZodObject<{
|
|
|
3738
3738
|
}, z.core.$strip>>;
|
|
3739
3739
|
}, z.core.$strip>>>;
|
|
3740
3740
|
bracketType: z.ZodEnum<{
|
|
3741
|
+
NONE: "NONE";
|
|
3741
3742
|
STOP_LOSS: "STOP_LOSS";
|
|
3742
3743
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
3743
|
-
NONE: "NONE";
|
|
3744
3744
|
}>;
|
|
3745
3745
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
3746
|
+
NONE: "NONE";
|
|
3746
3747
|
STOP_LOSS: "STOP_LOSS";
|
|
3747
3748
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
3748
|
-
NONE: "NONE";
|
|
3749
3749
|
}>>;
|
|
3750
3750
|
createdAt: z.ZodString;
|
|
3751
3751
|
updatedAt: z.ZodString;
|
|
@@ -3993,14 +3993,14 @@ export declare const LadderListResponse: z.ZodObject<{
|
|
|
3993
3993
|
}, z.core.$strip>>;
|
|
3994
3994
|
}, z.core.$strip>>>;
|
|
3995
3995
|
bracketType: z.ZodEnum<{
|
|
3996
|
+
NONE: "NONE";
|
|
3996
3997
|
STOP_LOSS: "STOP_LOSS";
|
|
3997
3998
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
3998
|
-
NONE: "NONE";
|
|
3999
3999
|
}>;
|
|
4000
4000
|
semanticBracketType: z.ZodOptional<z.ZodEnum<{
|
|
4001
|
+
NONE: "NONE";
|
|
4001
4002
|
STOP_LOSS: "STOP_LOSS";
|
|
4002
4003
|
TAKE_PROFIT: "TAKE_PROFIT";
|
|
4003
|
-
NONE: "NONE";
|
|
4004
4004
|
}>>;
|
|
4005
4005
|
createdAt: z.ZodString;
|
|
4006
4006
|
updatedAt: z.ZodString;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const PortfolioResponse: z.ZodObject<{
|
|
3
|
+
hasProvisionalFills: z.ZodBoolean;
|
|
3
4
|
realizedCashflow: z.ZodObject<{
|
|
4
5
|
grossPnl: z.ZodNumber;
|
|
5
6
|
tradeFees: z.ZodNumber;
|
|
@@ -120,6 +121,7 @@ export declare const PortfolioAnalyticsResponse: z.ZodObject<{
|
|
|
120
121
|
startDate: z.ZodString;
|
|
121
122
|
endDate: z.ZodString;
|
|
122
123
|
}, z.core.$strip>;
|
|
124
|
+
hasProvisionalFills: z.ZodBoolean;
|
|
123
125
|
realizedCashflow: z.ZodObject<{
|
|
124
126
|
grossPnl: z.ZodNumber;
|
|
125
127
|
tradeFees: z.ZodNumber;
|
|
@@ -2,6 +2,8 @@ import { z } from 'zod';
|
|
|
2
2
|
import { PortfolioOpenSnapshot, PortfolioClosedPositionStats, PortfolioVolumeAmounts, PortfolioVolumeIntervals, PortfolioCashflowAmounts, PortfolioCashflowIntervals, PortfolioAnalyticsConfig, PortfolioVolumeSeriesPoint, PortfolioPairBreakdown, PortfolioCashflowSeriesPoint } from './entities';
|
|
3
3
|
|
|
4
4
|
const PortfolioResponse = z.object({
|
|
5
|
+
/** Historical accounting or the current open snapshot still uses provisional fills. */
|
|
6
|
+
hasProvisionalFills: z.boolean(),
|
|
5
7
|
realizedCashflow: PortfolioCashflowAmounts.extend({
|
|
6
8
|
fundingSynced: z.boolean(),
|
|
7
9
|
intervals: PortfolioCashflowIntervals.optional()
|
|
@@ -14,6 +16,8 @@ const PortfolioResponse = z.object({
|
|
|
14
16
|
});
|
|
15
17
|
const PortfolioAnalyticsResponse = z.object({
|
|
16
18
|
config: PortfolioAnalyticsConfig,
|
|
19
|
+
/** Historical accounting or the current open snapshot still uses provisional fills. */
|
|
20
|
+
hasProvisionalFills: z.boolean(),
|
|
17
21
|
realizedCashflow: PortfolioCashflowAmounts.extend({
|
|
18
22
|
fundingSynced: z.boolean(),
|
|
19
23
|
series: z.array(PortfolioCashflowSeriesPoint).optional()
|
|
@@ -259,6 +259,7 @@ export declare const ClosedPosition: z.ZodObject<{
|
|
|
259
259
|
exitNotional: z.ZodString;
|
|
260
260
|
exitNotionalComplete: z.ZodBoolean;
|
|
261
261
|
hasSyntheticFills: z.ZodBoolean;
|
|
262
|
+
hasProvisionalFills: z.ZodBoolean;
|
|
262
263
|
unstableHistoricalData: z.ZodBoolean;
|
|
263
264
|
longAssets: z.ZodArray<z.ZodString>;
|
|
264
265
|
shortAssets: z.ZodArray<z.ZodString>;
|
|
@@ -570,6 +571,7 @@ export declare const VaultClosedPosition: z.ZodObject<{
|
|
|
570
571
|
netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
571
572
|
positionId: z.ZodUUID;
|
|
572
573
|
openedAt: z.ZodString;
|
|
574
|
+
hasProvisionalFills: z.ZodBoolean;
|
|
573
575
|
legs: z.ZodArray<z.ZodObject<{
|
|
574
576
|
side: z.ZodEnum<{
|
|
575
577
|
LONG: "LONG";
|
|
@@ -220,6 +220,8 @@ const ClosedPosition = z.object({
|
|
|
220
220
|
exitNotionalComplete: z.boolean(),
|
|
221
221
|
/** Whether any fill on the position was a synthetic bridge fill (gap/gone reconstruction). */
|
|
222
222
|
hasSyntheticFills: z.boolean(),
|
|
223
|
+
/** Whether any fill is still PROVISIONAL, so fees and net PnL may still settle. */
|
|
224
|
+
hasProvisionalFills: z.boolean(),
|
|
223
225
|
/** Whether a backfilled fill made this position's historical metrics unreliable. */
|
|
224
226
|
unstableHistoricalData: z.boolean(),
|
|
225
227
|
longAssets: z.array(InstrumentId),
|
|
@@ -406,7 +408,8 @@ const VaultClosedPosition = ClosedPosition.pick({
|
|
|
406
408
|
closedAt: true,
|
|
407
409
|
closedReason: true,
|
|
408
410
|
grossPnl: true,
|
|
409
|
-
netPnl: true
|
|
411
|
+
netPnl: true,
|
|
412
|
+
hasProvisionalFills: true
|
|
410
413
|
}).extend({
|
|
411
414
|
legs: z.array(VaultClosedPositionLeg)
|
|
412
415
|
});
|
|
@@ -126,6 +126,7 @@ export declare const ClosedPositionListResponse: z.ZodObject<{
|
|
|
126
126
|
exitNotional: z.ZodString;
|
|
127
127
|
exitNotionalComplete: z.ZodBoolean;
|
|
128
128
|
hasSyntheticFills: z.ZodBoolean;
|
|
129
|
+
hasProvisionalFills: z.ZodBoolean;
|
|
129
130
|
unstableHistoricalData: z.ZodBoolean;
|
|
130
131
|
longAssets: z.ZodArray<z.ZodString>;
|
|
131
132
|
shortAssets: z.ZodArray<z.ZodString>;
|
|
@@ -371,6 +372,7 @@ export declare const VaultClosedPositionListResponse: z.ZodObject<{
|
|
|
371
372
|
netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
372
373
|
positionId: z.ZodUUID;
|
|
373
374
|
openedAt: z.ZodString;
|
|
375
|
+
hasProvisionalFills: z.ZodBoolean;
|
|
374
376
|
legs: z.ZodArray<z.ZodObject<{
|
|
375
377
|
side: z.ZodEnum<{
|
|
376
378
|
LONG: "LONG";
|
package/dist/trade/payloads.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const BOUNDED_MARKET_MAX_TTL_MS = 10000;
|
|
3
2
|
export declare const CreateMarketOpen: z.ZodObject<{
|
|
4
3
|
type: z.ZodLiteral<"MARKET">;
|
|
5
4
|
legs: z.ZodTuple<[z.ZodObject<{
|
|
@@ -14,7 +13,9 @@ export declare const CreateMarketOpen: z.ZodObject<{
|
|
|
14
13
|
USD: "USD";
|
|
15
14
|
}>;
|
|
16
15
|
amount: z.ZodString;
|
|
17
|
-
|
|
16
|
+
limitPrice: z.ZodOptional<z.ZodNever>;
|
|
17
|
+
maxImpactPrice: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>], z.ZodObject<{
|
|
18
19
|
symbol: z.ZodString;
|
|
19
20
|
id: z.ZodOptional<z.ZodString>;
|
|
20
21
|
side: z.ZodEnum<{
|
|
@@ -26,7 +27,10 @@ export declare const CreateMarketOpen: z.ZodObject<{
|
|
|
26
27
|
USD: "USD";
|
|
27
28
|
}>;
|
|
28
29
|
amount: z.ZodString;
|
|
29
|
-
|
|
30
|
+
limitPrice: z.ZodOptional<z.ZodNever>;
|
|
31
|
+
maxImpactPrice: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strict>>;
|
|
33
|
+
expiresAt: z.ZodOptional<z.ZodNumber>;
|
|
30
34
|
trigger: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
31
35
|
intent: z.ZodLiteral<"CLOSE">;
|
|
32
36
|
type: z.ZodLiteral<"MARKET">;
|
|
@@ -101,39 +105,6 @@ export declare const CreateMarketOpen: z.ZodObject<{
|
|
|
101
105
|
}, z.core.$strip>]>>;
|
|
102
106
|
clientId: z.ZodOptional<z.ZodString>;
|
|
103
107
|
}, z.core.$strip>;
|
|
104
|
-
/** Explicit price protection: legacy gateways reject this request type instead of stripping limits. */
|
|
105
|
-
export declare const CreateBoundedMarketOpen: z.ZodObject<{
|
|
106
|
-
type: z.ZodLiteral<"BOUNDED_MARKET">;
|
|
107
|
-
expiresAt: z.ZodNumber;
|
|
108
|
-
legs: z.ZodTuple<[z.ZodObject<{
|
|
109
|
-
symbol: z.ZodString;
|
|
110
|
-
id: z.ZodOptional<z.ZodString>;
|
|
111
|
-
side: z.ZodEnum<{
|
|
112
|
-
BUY: "BUY";
|
|
113
|
-
SELL: "SELL";
|
|
114
|
-
}>;
|
|
115
|
-
mode: z.ZodEnum<{
|
|
116
|
-
QUANTITY: "QUANTITY";
|
|
117
|
-
USD: "USD";
|
|
118
|
-
}>;
|
|
119
|
-
amount: z.ZodString;
|
|
120
|
-
limitPrice: z.ZodString;
|
|
121
|
-
}, z.core.$strip>], z.ZodObject<{
|
|
122
|
-
symbol: z.ZodString;
|
|
123
|
-
id: z.ZodOptional<z.ZodString>;
|
|
124
|
-
side: z.ZodEnum<{
|
|
125
|
-
BUY: "BUY";
|
|
126
|
-
SELL: "SELL";
|
|
127
|
-
}>;
|
|
128
|
-
mode: z.ZodEnum<{
|
|
129
|
-
QUANTITY: "QUANTITY";
|
|
130
|
-
USD: "USD";
|
|
131
|
-
}>;
|
|
132
|
-
amount: z.ZodString;
|
|
133
|
-
limitPrice: z.ZodString;
|
|
134
|
-
}, z.core.$strip>>;
|
|
135
|
-
clientId: z.ZodOptional<z.ZodString>;
|
|
136
|
-
}, z.core.$strip>;
|
|
137
108
|
export declare const CreateMarketAdjust: z.ZodObject<{
|
|
138
109
|
type: z.ZodLiteral<"MARKET">;
|
|
139
110
|
legs: z.ZodTuple<[z.ZodObject<{
|
|
@@ -149,7 +120,9 @@ export declare const CreateMarketAdjust: z.ZodObject<{
|
|
|
149
120
|
}>;
|
|
150
121
|
amount: z.ZodString;
|
|
151
122
|
reduceOnly: z.ZodBoolean;
|
|
152
|
-
|
|
123
|
+
limitPrice: z.ZodOptional<z.ZodNever>;
|
|
124
|
+
maxImpactPrice: z.ZodOptional<z.ZodString>;
|
|
125
|
+
}, z.core.$strict>], z.ZodObject<{
|
|
153
126
|
id: z.ZodOptional<z.ZodString>;
|
|
154
127
|
symbol: z.ZodString;
|
|
155
128
|
side: z.ZodEnum<{
|
|
@@ -162,7 +135,10 @@ export declare const CreateMarketAdjust: z.ZodObject<{
|
|
|
162
135
|
}>;
|
|
163
136
|
amount: z.ZodString;
|
|
164
137
|
reduceOnly: z.ZodBoolean;
|
|
165
|
-
|
|
138
|
+
limitPrice: z.ZodOptional<z.ZodNever>;
|
|
139
|
+
maxImpactPrice: z.ZodOptional<z.ZodString>;
|
|
140
|
+
}, z.core.$strict>>;
|
|
141
|
+
expiresAt: z.ZodOptional<z.ZodNumber>;
|
|
166
142
|
clientId: z.ZodOptional<z.ZodString>;
|
|
167
143
|
}, z.core.$strip>;
|
|
168
144
|
export declare const CreateMarketClose: z.ZodObject<{
|
|
@@ -191,7 +167,9 @@ export declare const CreateTradeOpen: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
191
167
|
USD: "USD";
|
|
192
168
|
}>;
|
|
193
169
|
amount: z.ZodString;
|
|
194
|
-
|
|
170
|
+
limitPrice: z.ZodOptional<z.ZodNever>;
|
|
171
|
+
maxImpactPrice: z.ZodOptional<z.ZodString>;
|
|
172
|
+
}, z.core.$strict>], z.ZodObject<{
|
|
195
173
|
symbol: z.ZodString;
|
|
196
174
|
id: z.ZodOptional<z.ZodString>;
|
|
197
175
|
side: z.ZodEnum<{
|
|
@@ -203,7 +181,10 @@ export declare const CreateTradeOpen: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
203
181
|
USD: "USD";
|
|
204
182
|
}>;
|
|
205
183
|
amount: z.ZodString;
|
|
206
|
-
|
|
184
|
+
limitPrice: z.ZodOptional<z.ZodNever>;
|
|
185
|
+
maxImpactPrice: z.ZodOptional<z.ZodString>;
|
|
186
|
+
}, z.core.$strict>>;
|
|
187
|
+
expiresAt: z.ZodOptional<z.ZodNumber>;
|
|
207
188
|
trigger: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
208
189
|
intent: z.ZodLiteral<"CLOSE">;
|
|
209
190
|
type: z.ZodLiteral<"MARKET">;
|
|
@@ -277,37 +258,6 @@ export declare const CreateTradeOpen: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
277
258
|
}, z.core.$strip>;
|
|
278
259
|
}, z.core.$strip>]>>;
|
|
279
260
|
clientId: z.ZodOptional<z.ZodString>;
|
|
280
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
281
|
-
type: z.ZodLiteral<"BOUNDED_MARKET">;
|
|
282
|
-
expiresAt: z.ZodNumber;
|
|
283
|
-
legs: z.ZodTuple<[z.ZodObject<{
|
|
284
|
-
symbol: z.ZodString;
|
|
285
|
-
id: z.ZodOptional<z.ZodString>;
|
|
286
|
-
side: z.ZodEnum<{
|
|
287
|
-
BUY: "BUY";
|
|
288
|
-
SELL: "SELL";
|
|
289
|
-
}>;
|
|
290
|
-
mode: z.ZodEnum<{
|
|
291
|
-
QUANTITY: "QUANTITY";
|
|
292
|
-
USD: "USD";
|
|
293
|
-
}>;
|
|
294
|
-
amount: z.ZodString;
|
|
295
|
-
limitPrice: z.ZodString;
|
|
296
|
-
}, z.core.$strip>], z.ZodObject<{
|
|
297
|
-
symbol: z.ZodString;
|
|
298
|
-
id: z.ZodOptional<z.ZodString>;
|
|
299
|
-
side: z.ZodEnum<{
|
|
300
|
-
BUY: "BUY";
|
|
301
|
-
SELL: "SELL";
|
|
302
|
-
}>;
|
|
303
|
-
mode: z.ZodEnum<{
|
|
304
|
-
QUANTITY: "QUANTITY";
|
|
305
|
-
USD: "USD";
|
|
306
|
-
}>;
|
|
307
|
-
amount: z.ZodString;
|
|
308
|
-
limitPrice: z.ZodString;
|
|
309
|
-
}, z.core.$strip>>;
|
|
310
|
-
clientId: z.ZodOptional<z.ZodString>;
|
|
311
261
|
}, z.core.$strip>], "type">;
|
|
312
262
|
export declare const CreateTradeAdjust: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
313
263
|
type: z.ZodLiteral<"MARKET">;
|
|
@@ -324,7 +274,9 @@ export declare const CreateTradeAdjust: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
324
274
|
}>;
|
|
325
275
|
amount: z.ZodString;
|
|
326
276
|
reduceOnly: z.ZodBoolean;
|
|
327
|
-
|
|
277
|
+
limitPrice: z.ZodOptional<z.ZodNever>;
|
|
278
|
+
maxImpactPrice: z.ZodOptional<z.ZodString>;
|
|
279
|
+
}, z.core.$strict>], z.ZodObject<{
|
|
328
280
|
id: z.ZodOptional<z.ZodString>;
|
|
329
281
|
symbol: z.ZodString;
|
|
330
282
|
side: z.ZodEnum<{
|
|
@@ -337,7 +289,10 @@ export declare const CreateTradeAdjust: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
337
289
|
}>;
|
|
338
290
|
amount: z.ZodString;
|
|
339
291
|
reduceOnly: z.ZodBoolean;
|
|
340
|
-
|
|
292
|
+
limitPrice: z.ZodOptional<z.ZodNever>;
|
|
293
|
+
maxImpactPrice: z.ZodOptional<z.ZodString>;
|
|
294
|
+
}, z.core.$strict>>;
|
|
295
|
+
expiresAt: z.ZodOptional<z.ZodNumber>;
|
|
341
296
|
clientId: z.ZodOptional<z.ZodString>;
|
|
342
297
|
}, z.core.$strip>], "type">;
|
|
343
298
|
export declare const CreateTradeClose: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -353,7 +308,6 @@ export declare const CreateTradeCloseAll: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
353
308
|
clientId: z.ZodOptional<z.ZodString>;
|
|
354
309
|
}, z.core.$strip>], "type">;
|
|
355
310
|
export type CreateMarketOpen = z.output<typeof CreateMarketOpen>;
|
|
356
|
-
export type CreateBoundedMarketOpen = z.output<typeof CreateBoundedMarketOpen>;
|
|
357
311
|
export type CreateMarketAdjust = z.output<typeof CreateMarketAdjust>;
|
|
358
312
|
export type CreateMarketClose = z.output<typeof CreateMarketClose>;
|
|
359
313
|
export type CreateMarketReverse = z.output<typeof CreateMarketReverse>;
|
package/dist/trade/payloads.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ClientIdCode } from '../common/client-id';
|
|
3
3
|
import { RefineMinimumOneSymbol, RefineUniqueSymbols } from '../common/refinement';
|
|
4
|
-
import {
|
|
5
|
-
import { TradeLegPostOnly, TradeLeg } from '../common/trade-legs';
|
|
4
|
+
import { TradeLegPostOnlyWithMaxImpactPrice, TradeLegWithMaxImpactPrice } from '../common/trade-legs';
|
|
6
5
|
import { AttachTriggerMarketClose } from '../trigger';
|
|
7
6
|
|
|
8
|
-
const BOUNDED_MARKET_MAX_TTL_MS = 1e4;
|
|
9
|
-
const BoundedTradeLeg = TradeLegPostOnly.safeExtend({
|
|
10
|
-
limitPrice: UnsignedDecimalString.refine((value) => Number.isFinite(Number(value)) && Number(value) > 0)
|
|
11
|
-
});
|
|
12
7
|
const CreateMarketOpen = z.object({
|
|
13
8
|
type: z.literal("MARKET"),
|
|
14
9
|
/**
|
|
15
10
|
* Requested legs
|
|
16
11
|
*/
|
|
17
12
|
legs: z.tuple([
|
|
18
|
-
|
|
19
|
-
]).rest(
|
|
13
|
+
TradeLegPostOnlyWithMaxImpactPrice
|
|
14
|
+
]).rest(TradeLegPostOnlyWithMaxImpactPrice).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols).describe("Array of legs to make up the exposure"),
|
|
15
|
+
/**
|
|
16
|
+
* Optional absolute deadline (epoch ms); the engine refuses to plan the open after this time.
|
|
17
|
+
* The floor rejects an epoch-seconds timestamp sent by mistake, which would always be expired.
|
|
18
|
+
*/
|
|
19
|
+
expiresAt: z.number().int().min(1e12).optional(),
|
|
20
20
|
/**
|
|
21
21
|
* Close trigger to attach to the execution
|
|
22
22
|
*/
|
|
@@ -26,22 +26,19 @@ const CreateMarketOpen = z.object({
|
|
|
26
26
|
*/
|
|
27
27
|
clientId: ClientIdCode
|
|
28
28
|
});
|
|
29
|
-
const CreateBoundedMarketOpen = z.object({
|
|
30
|
-
type: z.literal("BOUNDED_MARKET"),
|
|
31
|
-
expiresAt: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
32
|
-
legs: z.tuple([
|
|
33
|
-
BoundedTradeLeg
|
|
34
|
-
]).rest(BoundedTradeLeg).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols),
|
|
35
|
-
clientId: ClientIdCode
|
|
36
|
-
});
|
|
37
29
|
const CreateMarketAdjust = z.object({
|
|
38
30
|
type: z.literal("MARKET"),
|
|
39
31
|
/**
|
|
40
32
|
* Requested legs
|
|
41
33
|
*/
|
|
42
34
|
legs: z.tuple([
|
|
43
|
-
|
|
44
|
-
]).rest(
|
|
35
|
+
TradeLegWithMaxImpactPrice
|
|
36
|
+
]).rest(TradeLegWithMaxImpactPrice).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols).describe("Array of legs to modify the position"),
|
|
37
|
+
/**
|
|
38
|
+
* Optional absolute deadline (epoch ms); the engine refuses to plan the adjust after this time.
|
|
39
|
+
* The floor rejects an epoch-seconds timestamp sent by mistake, which would always be expired.
|
|
40
|
+
*/
|
|
41
|
+
expiresAt: z.number().int().min(1e12).optional(),
|
|
45
42
|
/**
|
|
46
43
|
* Attribution route code (client_ids.code)
|
|
47
44
|
*/
|
|
@@ -69,8 +66,7 @@ const CreateMarketCloseAll = z.object({
|
|
|
69
66
|
clientId: ClientIdCode
|
|
70
67
|
});
|
|
71
68
|
const CreateTradeOpen = z.discriminatedUnion("type", [
|
|
72
|
-
CreateMarketOpen
|
|
73
|
-
CreateBoundedMarketOpen
|
|
69
|
+
CreateMarketOpen
|
|
74
70
|
]);
|
|
75
71
|
const CreateTradeAdjust = z.discriminatedUnion("type", [
|
|
76
72
|
CreateMarketAdjust
|
|
@@ -85,4 +81,4 @@ const CreateTradeCloseAll = z.discriminatedUnion("type", [
|
|
|
85
81
|
CreateMarketCloseAll
|
|
86
82
|
]);
|
|
87
83
|
|
|
88
|
-
export {
|
|
84
|
+
export { CreateMarketAdjust, CreateMarketClose, CreateMarketCloseAll, CreateMarketOpen, CreateMarketReverse, CreateTradeAdjust, CreateTradeClose, CreateTradeCloseAll, CreateTradeOpen, CreateTradeReverse };
|