@pear-protocol/types 2.14.0 → 2.15.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.
|
@@ -83,6 +83,8 @@ export declare const Position: z.ZodObject<{
|
|
|
83
83
|
PEAR: "PEAR";
|
|
84
84
|
EXTERNAL: "EXTERNAL";
|
|
85
85
|
}>;
|
|
86
|
+
copySubscriptionId: z.ZodOptional<z.ZodUUID>;
|
|
87
|
+
isCopying: z.ZodOptional<z.ZodBoolean>;
|
|
86
88
|
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
87
89
|
unstableHistoricalData: z.ZodBoolean;
|
|
88
90
|
totalFundingPayment: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
@@ -249,6 +251,8 @@ export declare const ClosedPosition: z.ZodObject<{
|
|
|
249
251
|
PEAR: "PEAR";
|
|
250
252
|
EXTERNAL: "EXTERNAL";
|
|
251
253
|
}>;
|
|
254
|
+
copySubscriptionId: z.ZodOptional<z.ZodUUID>;
|
|
255
|
+
isCopying: z.ZodOptional<z.ZodLiteral<false>>;
|
|
252
256
|
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
253
257
|
netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
254
258
|
totalFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
@@ -382,6 +386,8 @@ export declare const OpenPosition: z.ZodObject<{
|
|
|
382
386
|
PEAR: "PEAR";
|
|
383
387
|
EXTERNAL: "EXTERNAL";
|
|
384
388
|
}>;
|
|
389
|
+
copySubscriptionId: z.ZodOptional<z.ZodUUID>;
|
|
390
|
+
isCopying: z.ZodOptional<z.ZodBoolean>;
|
|
385
391
|
realizedGrossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
386
392
|
volume: z.ZodString;
|
|
387
393
|
grossUpnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
@@ -43,6 +43,10 @@ const Position = z.object({
|
|
|
43
43
|
*/
|
|
44
44
|
closedReason: PositionClosedReason.nullable().optional(),
|
|
45
45
|
origin: PositionOrigin,
|
|
46
|
+
/** The subscription that opened this position, retained after copying stops. */
|
|
47
|
+
copySubscriptionId: z.uuid().optional(),
|
|
48
|
+
/** Whether the existing copy eligibility rules still allow this position to follow its leader. */
|
|
49
|
+
isCopying: z.boolean().optional(),
|
|
46
50
|
/**
|
|
47
51
|
* Position exposure
|
|
48
52
|
*/
|
|
@@ -184,6 +188,10 @@ const ClosedPosition = z.object({
|
|
|
184
188
|
closedAt: z.string(),
|
|
185
189
|
closedReason: PositionClosedReason.optional(),
|
|
186
190
|
origin: PositionOrigin,
|
|
191
|
+
/** The subscription that opened this position, retained after its lifecycle closes. */
|
|
192
|
+
copySubscriptionId: z.uuid().optional(),
|
|
193
|
+
/** A closed copy position no longer follows its leader, regardless of subscription status. */
|
|
194
|
+
isCopying: z.literal(false).optional(),
|
|
187
195
|
grossPnl: SignedDecimalString,
|
|
188
196
|
netPnl: SignedDecimalString,
|
|
189
197
|
totalFees: SignedDecimalString,
|
|
@@ -308,6 +316,10 @@ const OpenPosition = z.object({
|
|
|
308
316
|
/** The position's last update, independent of the page cursor. */
|
|
309
317
|
updatedAt: z.string(),
|
|
310
318
|
origin: PositionOrigin,
|
|
319
|
+
/** The subscription that opened this position, retained after copying stops. */
|
|
320
|
+
copySubscriptionId: z.uuid().optional(),
|
|
321
|
+
/** Whether the existing copy eligibility rules still allow this position to follow its leader. */
|
|
322
|
+
isCopying: z.boolean().optional(),
|
|
311
323
|
/**
|
|
312
324
|
* Realized PnL booked so far, before fees. Qualified because the position is still
|
|
313
325
|
* live, and revisable while it is — see netCashflow on reconciliation.
|
|
@@ -28,6 +28,8 @@ export declare const PositionListResponse: z.ZodObject<{
|
|
|
28
28
|
PEAR: "PEAR";
|
|
29
29
|
EXTERNAL: "EXTERNAL";
|
|
30
30
|
}>;
|
|
31
|
+
copySubscriptionId: z.ZodOptional<z.ZodUUID>;
|
|
32
|
+
isCopying: z.ZodOptional<z.ZodBoolean>;
|
|
31
33
|
exposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
32
34
|
unstableHistoricalData: z.ZodBoolean;
|
|
33
35
|
totalFundingPayment: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
@@ -119,6 +121,8 @@ export declare const ClosedPositionListResponse: z.ZodObject<{
|
|
|
119
121
|
PEAR: "PEAR";
|
|
120
122
|
EXTERNAL: "EXTERNAL";
|
|
121
123
|
}>;
|
|
124
|
+
copySubscriptionId: z.ZodOptional<z.ZodUUID>;
|
|
125
|
+
isCopying: z.ZodOptional<z.ZodLiteral<false>>;
|
|
122
126
|
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
123
127
|
netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
124
128
|
totalFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
@@ -223,6 +227,8 @@ export declare const OpenPositionListResponse: z.ZodObject<{
|
|
|
223
227
|
PEAR: "PEAR";
|
|
224
228
|
EXTERNAL: "EXTERNAL";
|
|
225
229
|
}>;
|
|
230
|
+
copySubscriptionId: z.ZodOptional<z.ZodUUID>;
|
|
231
|
+
isCopying: z.ZodOptional<z.ZodBoolean>;
|
|
226
232
|
realizedGrossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
227
233
|
volume: z.ZodString;
|
|
228
234
|
grossUpnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
package/dist/traders/public.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ export declare const PublicTraderParams: z.ZodObject<{
|
|
|
4
4
|
tradeAccountId: z.ZodUUID;
|
|
5
5
|
}, z.core.$strip>;
|
|
6
6
|
export type PublicTraderParams = z.output<typeof PublicTraderParams>;
|
|
7
|
+
/** Follower context requires authentication and an owned account selected by the standard header. */
|
|
8
|
+
export declare const PublicTraderQuery: z.ZodObject<{
|
|
9
|
+
includeCopyState: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCodec<z.ZodString, z.ZodBoolean>]>>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type PublicTraderQueryInput = z.input<typeof PublicTraderQuery>;
|
|
12
|
+
export type PublicTraderQuery = z.output<typeof PublicTraderQuery>;
|
|
7
13
|
/** Public closed-history filters; refuse steps and every unsupported private option. */
|
|
8
14
|
export declare const PublicTraderClosedPositionsParams: z.ZodObject<{
|
|
9
15
|
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<number>>>;
|
|
@@ -14,6 +20,15 @@ export declare const PublicTraderClosedPositionsParams: z.ZodObject<{
|
|
|
14
20
|
}, z.core.$strict>;
|
|
15
21
|
export type PublicTraderClosedPositionsParamsInput = z.input<typeof PublicTraderClosedPositionsParams>;
|
|
16
22
|
export type PublicTraderClosedPositionsParams = z.output<typeof PublicTraderClosedPositionsParams>;
|
|
23
|
+
/** A selected follower's result for one leader position. */
|
|
24
|
+
export declare const ViewerCopyStatus: z.ZodEnum<{
|
|
25
|
+
COPIED: "COPIED";
|
|
26
|
+
PARTIAL: "PARTIAL";
|
|
27
|
+
PENDING: "PENDING";
|
|
28
|
+
NOT_COPIED: "NOT_COPIED";
|
|
29
|
+
UNKNOWN: "UNKNOWN";
|
|
30
|
+
}>;
|
|
31
|
+
export type ViewerCopyStatus = z.output<typeof ViewerCopyStatus>;
|
|
17
32
|
export declare const PublicOpenPosition: z.ZodObject<{
|
|
18
33
|
status: z.ZodLiteral<"OPEN">;
|
|
19
34
|
connector: z.ZodEnum<{
|
|
@@ -26,9 +41,18 @@ export declare const PublicOpenPosition: z.ZodObject<{
|
|
|
26
41
|
}>;
|
|
27
42
|
updatedAt: z.ZodString;
|
|
28
43
|
positionId: z.ZodUUID;
|
|
44
|
+
copySubscriptionId: z.ZodOptional<z.ZodUUID>;
|
|
29
45
|
openedAt: z.ZodString;
|
|
30
46
|
realizedGrossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
31
47
|
netCashflow: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
48
|
+
copyStatus: z.ZodOptional<z.ZodEnum<{
|
|
49
|
+
COPIED: "COPIED";
|
|
50
|
+
PARTIAL: "PARTIAL";
|
|
51
|
+
PENDING: "PENDING";
|
|
52
|
+
NOT_COPIED: "NOT_COPIED";
|
|
53
|
+
UNKNOWN: "UNKNOWN";
|
|
54
|
+
}>>;
|
|
55
|
+
copyReason: z.ZodOptional<z.ZodString>;
|
|
32
56
|
legs: z.ZodArray<z.ZodObject<{
|
|
33
57
|
side: z.ZodEnum<{
|
|
34
58
|
LONG: "LONG";
|
|
@@ -2598,9 +2622,18 @@ export declare const PublicTraderResponse: z.ZodObject<{
|
|
|
2598
2622
|
}>;
|
|
2599
2623
|
updatedAt: z.ZodString;
|
|
2600
2624
|
positionId: z.ZodUUID;
|
|
2625
|
+
copySubscriptionId: z.ZodOptional<z.ZodUUID>;
|
|
2601
2626
|
openedAt: z.ZodString;
|
|
2602
2627
|
realizedGrossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
2603
2628
|
netCashflow: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
2629
|
+
copyStatus: z.ZodOptional<z.ZodEnum<{
|
|
2630
|
+
COPIED: "COPIED";
|
|
2631
|
+
PARTIAL: "PARTIAL";
|
|
2632
|
+
PENDING: "PENDING";
|
|
2633
|
+
NOT_COPIED: "NOT_COPIED";
|
|
2634
|
+
UNKNOWN: "UNKNOWN";
|
|
2635
|
+
}>>;
|
|
2636
|
+
copyReason: z.ZodOptional<z.ZodString>;
|
|
2604
2637
|
legs: z.ZodArray<z.ZodObject<{
|
|
2605
2638
|
side: z.ZodEnum<{
|
|
2606
2639
|
LONG: "LONG";
|
package/dist/traders/public.js
CHANGED
|
@@ -11,6 +11,21 @@ import { TriggerMarketOpen, TriggerMarketAdjust, TriggerMarketClose, TriggerTWAP
|
|
|
11
11
|
const PublicTraderParams = z.object({
|
|
12
12
|
tradeAccountId: z.uuid()
|
|
13
13
|
});
|
|
14
|
+
const PublicTraderQuery = z.object({
|
|
15
|
+
/** Accept exact HTTP boolean strings without treating the string "false" as true. */
|
|
16
|
+
includeCopyState: z.union([
|
|
17
|
+
z.boolean(),
|
|
18
|
+
z.stringbool({
|
|
19
|
+
truthy: [
|
|
20
|
+
"true"
|
|
21
|
+
],
|
|
22
|
+
falsy: [
|
|
23
|
+
"false"
|
|
24
|
+
],
|
|
25
|
+
case: "sensitive"
|
|
26
|
+
})
|
|
27
|
+
]).optional().default(false)
|
|
28
|
+
});
|
|
14
29
|
const PublicTraderClosedPositionsParams = z.object({
|
|
15
30
|
limit: ClosedPositionListParams.shape.limit,
|
|
16
31
|
cursor: ClosedPositionListParams.shape.cursor,
|
|
@@ -18,15 +33,27 @@ const PublicTraderClosedPositionsParams = z.object({
|
|
|
18
33
|
endDate: ClosedPositionListParams.shape.endDate,
|
|
19
34
|
positionId: ClosedPositionListParams.shape.positionId
|
|
20
35
|
}).strict();
|
|
36
|
+
const ViewerCopyStatus = z.enum([
|
|
37
|
+
"COPIED",
|
|
38
|
+
"PARTIAL",
|
|
39
|
+
"NOT_COPIED",
|
|
40
|
+
"PENDING",
|
|
41
|
+
"UNKNOWN"
|
|
42
|
+
]);
|
|
21
43
|
const PublicOpenPosition = OpenPosition.pick({
|
|
22
44
|
positionId: true,
|
|
23
45
|
status: true,
|
|
24
46
|
connector: true,
|
|
25
47
|
openedAt: true,
|
|
26
48
|
updatedAt: true,
|
|
49
|
+
copySubscriptionId: true,
|
|
27
50
|
realizedGrossPnl: true,
|
|
28
51
|
netCashflow: true
|
|
29
52
|
}).extend({
|
|
53
|
+
/** The selected follower's result for this leader position; absent without viewer context. */
|
|
54
|
+
copyStatus: ViewerCopyStatus.optional(),
|
|
55
|
+
/** The recorded attempt, exclusion, or lifecycle reason for this follower's result. */
|
|
56
|
+
copyReason: z.string().optional(),
|
|
30
57
|
legs: z.array(OpenPositionLeg.pick({
|
|
31
58
|
asset: true,
|
|
32
59
|
side: true,
|
|
@@ -163,4 +190,4 @@ const PublicTraderResponse = z.object({
|
|
|
163
190
|
ladders: z.array(PublicLadder)
|
|
164
191
|
});
|
|
165
192
|
|
|
166
|
-
export { PublicClosedPosition, PublicLadder, PublicOpenPosition, PublicSchedule, PublicTraderClosedPositionsParams, PublicTraderClosedPositionsResponse, PublicTraderParams, PublicTraderResponse, PublicTrigger };
|
|
193
|
+
export { PublicClosedPosition, PublicLadder, PublicOpenPosition, PublicSchedule, PublicTraderClosedPositionsParams, PublicTraderClosedPositionsResponse, PublicTraderParams, PublicTraderQuery, PublicTraderResponse, PublicTrigger, ViewerCopyStatus };
|