@pear-protocol/types 2.13.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.
- package/dist/copy/entities.d.ts +108 -0
- package/dist/copy/entities.js +23 -2
- package/dist/copy/queries.d.ts +8 -0
- package/dist/copy/queries.js +5 -1
- package/dist/copy/responses.d.ts +35 -5
- package/dist/copy/responses.js +3 -5
- package/dist/position/entities.d.ts +11 -4
- package/dist/position/entities.js +16 -0
- package/dist/position/responses.d.ts +8 -0
- package/dist/traders/public.d.ts +33 -0
- package/dist/traders/public.js +28 -1
- package/package.json +1 -1
package/dist/copy/entities.d.ts
CHANGED
|
@@ -37,6 +37,114 @@ export declare const CopySubscription: z.ZodObject<{
|
|
|
37
37
|
endedAt: z.ZodOptional<z.ZodString>;
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
export type CopySubscription = z.infer<typeof CopySubscription>;
|
|
40
|
+
/** Active position-lifetime USD totals; mark, basis, or exposure gaps can leave measured PnL partial. */
|
|
41
|
+
export declare const CopySubscriptionMetrics: z.ZodObject<{
|
|
42
|
+
volume: z.ZodString;
|
|
43
|
+
grossRealizedPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
44
|
+
grossUpnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
45
|
+
fundingPayment: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
46
|
+
tradeFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
47
|
+
pearFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
48
|
+
totalNetPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type CopySubscriptionMetrics = z.output<typeof CopySubscriptionMetrics>;
|
|
51
|
+
/** Current subscription with volume, gross PnL, attributed funding, signed fees, and net PnL. */
|
|
52
|
+
export declare const CopySubscriptionWithMetrics: z.ZodObject<{
|
|
53
|
+
id: z.ZodUUID;
|
|
54
|
+
leaderTradeAccountId: z.ZodUUID;
|
|
55
|
+
followerTradeAccountId: z.ZodUUID;
|
|
56
|
+
connector: z.ZodEnum<{
|
|
57
|
+
hyperliquid: "hyperliquid";
|
|
58
|
+
binance: "binance";
|
|
59
|
+
bybit: "bybit";
|
|
60
|
+
okx: "okx";
|
|
61
|
+
lighter: "lighter";
|
|
62
|
+
lighter_rhc: "lighter_rhc";
|
|
63
|
+
}>;
|
|
64
|
+
sizing: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
65
|
+
mode: z.ZodLiteral<"LEADER_EQUITY_FRACTION">;
|
|
66
|
+
}, z.core.$strip>], "mode">;
|
|
67
|
+
createdAt: z.ZodString;
|
|
68
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
69
|
+
status: z.ZodLiteral<"ACTIVE">;
|
|
70
|
+
volume: z.ZodString;
|
|
71
|
+
grossRealizedPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
72
|
+
grossUpnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
73
|
+
fundingPayment: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
74
|
+
tradeFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
75
|
+
pearFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
76
|
+
totalNetPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
export type CopySubscriptionWithMetrics = z.output<typeof CopySubscriptionWithMetrics>;
|
|
79
|
+
/** Ended subscription with lifetime turnover only. */
|
|
80
|
+
export declare const CopyEndedSubscriptionWithVolume: z.ZodObject<{
|
|
81
|
+
id: z.ZodUUID;
|
|
82
|
+
leaderTradeAccountId: z.ZodUUID;
|
|
83
|
+
followerTradeAccountId: z.ZodUUID;
|
|
84
|
+
connector: z.ZodEnum<{
|
|
85
|
+
hyperliquid: "hyperliquid";
|
|
86
|
+
binance: "binance";
|
|
87
|
+
bybit: "bybit";
|
|
88
|
+
okx: "okx";
|
|
89
|
+
lighter: "lighter";
|
|
90
|
+
lighter_rhc: "lighter_rhc";
|
|
91
|
+
}>;
|
|
92
|
+
sizing: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
93
|
+
mode: z.ZodLiteral<"LEADER_EQUITY_FRACTION">;
|
|
94
|
+
}, z.core.$strip>], "mode">;
|
|
95
|
+
createdAt: z.ZodString;
|
|
96
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
97
|
+
status: z.ZodLiteral<"ENDED">;
|
|
98
|
+
volume: z.ZodString;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
export type CopyEndedSubscriptionWithVolume = z.output<typeof CopyEndedSubscriptionWithVolume>;
|
|
101
|
+
/** Read shape selected by subscription status. */
|
|
102
|
+
export declare const CopySubscriptionRead: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
103
|
+
id: z.ZodUUID;
|
|
104
|
+
leaderTradeAccountId: z.ZodUUID;
|
|
105
|
+
followerTradeAccountId: z.ZodUUID;
|
|
106
|
+
connector: z.ZodEnum<{
|
|
107
|
+
hyperliquid: "hyperliquid";
|
|
108
|
+
binance: "binance";
|
|
109
|
+
bybit: "bybit";
|
|
110
|
+
okx: "okx";
|
|
111
|
+
lighter: "lighter";
|
|
112
|
+
lighter_rhc: "lighter_rhc";
|
|
113
|
+
}>;
|
|
114
|
+
sizing: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
115
|
+
mode: z.ZodLiteral<"LEADER_EQUITY_FRACTION">;
|
|
116
|
+
}, z.core.$strip>], "mode">;
|
|
117
|
+
createdAt: z.ZodString;
|
|
118
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
119
|
+
status: z.ZodLiteral<"ACTIVE">;
|
|
120
|
+
volume: z.ZodString;
|
|
121
|
+
grossRealizedPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
122
|
+
grossUpnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
123
|
+
fundingPayment: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
124
|
+
tradeFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
125
|
+
pearFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
126
|
+
totalNetPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
127
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
128
|
+
id: z.ZodUUID;
|
|
129
|
+
leaderTradeAccountId: z.ZodUUID;
|
|
130
|
+
followerTradeAccountId: z.ZodUUID;
|
|
131
|
+
connector: z.ZodEnum<{
|
|
132
|
+
hyperliquid: "hyperliquid";
|
|
133
|
+
binance: "binance";
|
|
134
|
+
bybit: "bybit";
|
|
135
|
+
okx: "okx";
|
|
136
|
+
lighter: "lighter";
|
|
137
|
+
lighter_rhc: "lighter_rhc";
|
|
138
|
+
}>;
|
|
139
|
+
sizing: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
140
|
+
mode: z.ZodLiteral<"LEADER_EQUITY_FRACTION">;
|
|
141
|
+
}, z.core.$strip>], "mode">;
|
|
142
|
+
createdAt: z.ZodString;
|
|
143
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
144
|
+
status: z.ZodLiteral<"ENDED">;
|
|
145
|
+
volume: z.ZodString;
|
|
146
|
+
}, z.core.$strip>], "status">;
|
|
147
|
+
export type CopySubscriptionRead = z.output<typeof CopySubscriptionRead>;
|
|
40
148
|
export declare const CopyActivityOutcome: z.ZodEnum<{
|
|
41
149
|
COPIED: "COPIED";
|
|
42
150
|
PARTIAL: "PARTIAL";
|
package/dist/copy/entities.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { SignedDecimalString } from '../common/schema';
|
|
2
|
+
import { SignedDecimalString, UnsignedDecimalString } from '../common/schema';
|
|
3
3
|
import { Connector } from '../connector';
|
|
4
4
|
import { InstrumentId } from '../instrument';
|
|
5
5
|
|
|
@@ -26,6 +26,27 @@ const CopySubscription = z.object({
|
|
|
26
26
|
createdAt: z.string().describe("ISO 8601"),
|
|
27
27
|
endedAt: z.string().optional().describe("ISO 8601; set once the follower unsubscribed")
|
|
28
28
|
});
|
|
29
|
+
const CopySubscriptionMetrics = z.object({
|
|
30
|
+
volume: UnsignedDecimalString.describe("Lifetime executed USD turnover across opens and closes; excludes fees and funding"),
|
|
31
|
+
grossRealizedPnl: SignedDecimalString.describe("Gross realized USD PnL over attributed positions, including partial reductions; excludes fees and funding"),
|
|
32
|
+
grossUpnl: SignedDecimalString.describe("Gross unrealized USD PnL on OPEN attributed positions at current marks; missing marks or entry basis can make this total partial; excludes fees and funding"),
|
|
33
|
+
fundingPayment: SignedDecimalString.describe("Signed USD funding attributed from historical exposure snapshots and per-unit payments; absent snapshots contribute no measured funding"),
|
|
34
|
+
tradeFee: SignedDecimalString.describe("Signed USD trade fees on attributed position fills; negative values are rebates"),
|
|
35
|
+
pearFee: SignedDecimalString.describe("Signed USD Pear fees on attributed position fills; negative values are rebates"),
|
|
36
|
+
totalNetPnl: SignedDecimalString.describe("Gross realized plus gross unrealized plus fundingPayment minus tradeFee and pearFee in USD; mark, basis, or exposure gaps can make the measured total partial")
|
|
37
|
+
});
|
|
38
|
+
const CopySubscriptionWithMetrics = CopySubscription.extend({
|
|
39
|
+
...CopySubscriptionMetrics.shape,
|
|
40
|
+
status: z.literal("ACTIVE")
|
|
41
|
+
});
|
|
42
|
+
const CopyEndedSubscriptionWithVolume = CopySubscription.extend({
|
|
43
|
+
status: z.literal("ENDED"),
|
|
44
|
+
volume: CopySubscriptionMetrics.shape.volume
|
|
45
|
+
});
|
|
46
|
+
const CopySubscriptionRead = z.discriminatedUnion("status", [
|
|
47
|
+
CopySubscriptionWithMetrics,
|
|
48
|
+
CopyEndedSubscriptionWithVolume
|
|
49
|
+
]);
|
|
29
50
|
const CopyActivityOutcome = z.enum([
|
|
30
51
|
"COPIED",
|
|
31
52
|
"PARTIAL",
|
|
@@ -110,4 +131,4 @@ const CopyFollower = z.object({
|
|
|
110
131
|
xAvatarUrl: z.string().optional()
|
|
111
132
|
});
|
|
112
133
|
|
|
113
|
-
export { CopyActivity, CopyActivityLeg, CopyActivityOutcome, CopyActivityState, CopyExecutionSource, CopyFollower, CopyLeaderAction, CopySizing, CopySkipReason, CopySubscription, CopySubscriptionStatus };
|
|
134
|
+
export { CopyActivity, CopyActivityLeg, CopyActivityOutcome, CopyActivityState, CopyEndedSubscriptionWithVolume, CopyExecutionSource, CopyFollower, CopyLeaderAction, CopySizing, CopySkipReason, CopySubscription, CopySubscriptionMetrics, CopySubscriptionRead, CopySubscriptionStatus, CopySubscriptionWithMetrics };
|
package/dist/copy/queries.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const CopySubscriptionListQuery: z.ZodObject<{
|
|
3
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
4
|
+
ACTIVE: "ACTIVE";
|
|
5
|
+
ENDED: "ENDED";
|
|
6
|
+
}>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type CopySubscriptionListQueryInput = z.input<typeof CopySubscriptionListQuery>;
|
|
9
|
+
export type CopySubscriptionListQuery = z.output<typeof CopySubscriptionListQuery>;
|
|
2
10
|
export declare const CopyActivityListParams: z.ZodObject<{
|
|
3
11
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
4
12
|
}, z.core.$strip>;
|
package/dist/copy/queries.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { CopySubscriptionStatus } from './entities';
|
|
2
3
|
|
|
4
|
+
const CopySubscriptionListQuery = z.object({
|
|
5
|
+
status: CopySubscriptionStatus.optional()
|
|
6
|
+
});
|
|
3
7
|
const CopyActivityListParams = z.object({
|
|
4
8
|
limit: z.coerce.number().int().min(1).max(200).default(50)
|
|
5
9
|
});
|
|
@@ -13,4 +17,4 @@ const CopyStatsParams = z.object({
|
|
|
13
17
|
]
|
|
14
18
|
});
|
|
15
19
|
|
|
16
|
-
export { CopyActivityListParams, CopyStatsParams };
|
|
20
|
+
export { CopyActivityListParams, CopyStatsParams, CopySubscriptionListQuery };
|
package/dist/copy/responses.d.ts
CHANGED
|
@@ -22,6 +22,13 @@ export declare const CopyStateResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
22
22
|
createdAt: z.ZodString;
|
|
23
23
|
endedAt: z.ZodOptional<z.ZodString>;
|
|
24
24
|
status: z.ZodLiteral<"ACTIVE">;
|
|
25
|
+
volume: z.ZodString;
|
|
26
|
+
grossRealizedPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
27
|
+
grossUpnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
28
|
+
fundingPayment: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
29
|
+
tradeFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
30
|
+
pearFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
31
|
+
totalNetPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
25
32
|
}, z.core.$strip>;
|
|
26
33
|
}, z.core.$strip>], "state">;
|
|
27
34
|
export type CopyStateResponse = z.output<typeof CopyStateResponse>;
|
|
@@ -190,7 +197,7 @@ export declare const CreateCopySubscriptionResponse: z.ZodObject<{
|
|
|
190
197
|
}, z.core.$strip>;
|
|
191
198
|
export type CreateCopySubscriptionResponse = z.output<typeof CreateCopySubscriptionResponse>;
|
|
192
199
|
export declare const CopySubscriptionListResponse: z.ZodObject<{
|
|
193
|
-
subscriptions: z.ZodArray<z.ZodObject<{
|
|
200
|
+
subscriptions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
194
201
|
id: z.ZodUUID;
|
|
195
202
|
leaderTradeAccountId: z.ZodUUID;
|
|
196
203
|
followerTradeAccountId: z.ZodUUID;
|
|
@@ -202,16 +209,39 @@ export declare const CopySubscriptionListResponse: z.ZodObject<{
|
|
|
202
209
|
lighter: "lighter";
|
|
203
210
|
lighter_rhc: "lighter_rhc";
|
|
204
211
|
}>;
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
212
|
+
sizing: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
213
|
+
mode: z.ZodLiteral<"LEADER_EQUITY_FRACTION">;
|
|
214
|
+
}, z.core.$strip>], "mode">;
|
|
215
|
+
createdAt: z.ZodString;
|
|
216
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
217
|
+
status: z.ZodLiteral<"ACTIVE">;
|
|
218
|
+
volume: z.ZodString;
|
|
219
|
+
grossRealizedPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
220
|
+
grossUpnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
221
|
+
fundingPayment: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
222
|
+
tradeFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
223
|
+
pearFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
224
|
+
totalNetPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
225
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
226
|
+
id: z.ZodUUID;
|
|
227
|
+
leaderTradeAccountId: z.ZodUUID;
|
|
228
|
+
followerTradeAccountId: z.ZodUUID;
|
|
229
|
+
connector: z.ZodEnum<{
|
|
230
|
+
hyperliquid: "hyperliquid";
|
|
231
|
+
binance: "binance";
|
|
232
|
+
bybit: "bybit";
|
|
233
|
+
okx: "okx";
|
|
234
|
+
lighter: "lighter";
|
|
235
|
+
lighter_rhc: "lighter_rhc";
|
|
208
236
|
}>;
|
|
209
237
|
sizing: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
210
238
|
mode: z.ZodLiteral<"LEADER_EQUITY_FRACTION">;
|
|
211
239
|
}, z.core.$strip>], "mode">;
|
|
212
240
|
createdAt: z.ZodString;
|
|
213
241
|
endedAt: z.ZodOptional<z.ZodString>;
|
|
214
|
-
|
|
242
|
+
status: z.ZodLiteral<"ENDED">;
|
|
243
|
+
volume: z.ZodString;
|
|
244
|
+
}, z.core.$strip>], "status">>;
|
|
215
245
|
}, z.core.$strip>;
|
|
216
246
|
export type CopySubscriptionListResponse = z.output<typeof CopySubscriptionListResponse>;
|
|
217
247
|
export declare const CopyActivityListResponse: z.ZodObject<{
|
package/dist/copy/responses.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { UnsignedDecimalString } from '../common/schema';
|
|
3
|
-
import {
|
|
3
|
+
import { CopySubscriptionWithMetrics, CopyFollower, CopySubscription, CopySkipReason, CopySubscriptionRead, CopyActivity, CopySubscriptionStatus } from './entities';
|
|
4
4
|
|
|
5
5
|
const CopyStateResponse = z.discriminatedUnion("state", [
|
|
6
6
|
z.object({
|
|
@@ -8,9 +8,7 @@ const CopyStateResponse = z.discriminatedUnion("state", [
|
|
|
8
8
|
}),
|
|
9
9
|
z.object({
|
|
10
10
|
state: z.literal("ACTIVE"),
|
|
11
|
-
subscription:
|
|
12
|
-
status: z.literal("ACTIVE")
|
|
13
|
-
})
|
|
11
|
+
subscription: CopySubscriptionWithMetrics
|
|
14
12
|
})
|
|
15
13
|
]);
|
|
16
14
|
const CopyFollowersResponse = z.object({
|
|
@@ -52,7 +50,7 @@ const CreateCopySubscriptionResponse = CopySubscriptionResponse.extend({
|
|
|
52
50
|
joinResults: z.array(CopyJoinResult)
|
|
53
51
|
});
|
|
54
52
|
const CopySubscriptionListResponse = z.object({
|
|
55
|
-
subscriptions: z.array(
|
|
53
|
+
subscriptions: z.array(CopySubscriptionRead)
|
|
56
54
|
});
|
|
57
55
|
const CopyActivityListResponse = z.object({
|
|
58
56
|
activities: z.array(CopyActivity)
|
|
@@ -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>>;
|
|
@@ -359,11 +363,10 @@ export declare const OpenPositionLeg: z.ZodObject<{
|
|
|
359
363
|
}, z.core.$strip>;
|
|
360
364
|
export type OpenPositionLeg = z.output<typeof OpenPositionLeg>;
|
|
361
365
|
/**
|
|
362
|
-
* The
|
|
363
|
-
* composed server-side from
|
|
366
|
+
* The lifetime economics of one open position, including booked realized PnL and
|
|
367
|
+
* gross unrealized PnL at live marks, composed server-side from shared position math.
|
|
364
368
|
*
|
|
365
|
-
*
|
|
366
|
-
* /positions and /portfolio's openSnapshot already carry.
|
|
369
|
+
* Its gross unrealized PnL uses current marks where a priced entry basis is known.
|
|
367
370
|
*/
|
|
368
371
|
export declare const OpenPosition: z.ZodObject<{
|
|
369
372
|
positionId: z.ZodUUID;
|
|
@@ -383,7 +386,11 @@ export declare const OpenPosition: z.ZodObject<{
|
|
|
383
386
|
PEAR: "PEAR";
|
|
384
387
|
EXTERNAL: "EXTERNAL";
|
|
385
388
|
}>;
|
|
389
|
+
copySubscriptionId: z.ZodOptional<z.ZodUUID>;
|
|
390
|
+
isCopying: z.ZodOptional<z.ZodBoolean>;
|
|
386
391
|
realizedGrossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
392
|
+
volume: z.ZodString;
|
|
393
|
+
grossUpnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
387
394
|
netCashflow: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
388
395
|
totalFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
389
396
|
tradeFees: 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,11 +316,19 @@ 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.
|
|
314
326
|
*/
|
|
315
327
|
realizedGrossPnl: SignedDecimalString,
|
|
328
|
+
/** Lifetime executed USD turnover, including opening and closing fills. */
|
|
329
|
+
volume: UnsignedDecimalString.describe("Lifetime executed USD turnover across opening and closing fills"),
|
|
330
|
+
/** Gross unrealized PnL at current marks; missing marks or entry basis can make this total partial. */
|
|
331
|
+
grossUpnl: SignedDecimalString.describe("Gross unrealized USD PnL at current marks; missing marks or entry basis can make this total partial; excludes fees and funding"),
|
|
316
332
|
/**
|
|
317
333
|
* Cash booked so far: realized gross PnL minus every fee charged to date. Not a
|
|
318
334
|
* settled return on closed quantity — it books every fee charged so far, including
|
|
@@ -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,7 +227,11 @@ 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>>;
|
|
233
|
+
volume: z.ZodString;
|
|
234
|
+
grossUpnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
227
235
|
netCashflow: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
228
236
|
totalFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
229
237
|
tradeFees: 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 };
|