@pear-protocol/types 1.32.0 → 2.0.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.
@@ -0,0 +1,284 @@
1
+ import { z } from 'zod';
2
+ /** The basis state immediately before or after a fill. */
3
+ export declare const TradePositionState: z.ZodObject<{
4
+ signedQuantity: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
5
+ basis: z.ZodDiscriminatedUnion<[z.ZodObject<{
6
+ kind: z.ZodLiteral<"FLAT">;
7
+ }, z.core.$strip>, z.ZodObject<{
8
+ kind: z.ZodLiteral<"PRICED">;
9
+ entryPrice: z.ZodString;
10
+ }, z.core.$strip>, z.ZodObject<{
11
+ kind: z.ZodLiteral<"UNPRICED">;
12
+ }, z.core.$strip>], "kind">;
13
+ }, z.core.$strip>;
14
+ export type TradePositionState = z.output<typeof TradePositionState>;
15
+ /** The priced or unpriceable quantity reduced by one fill. */
16
+ export declare const TradeRealization: z.ZodDiscriminatedUnion<[z.ZodObject<{
17
+ kind: z.ZodLiteral<"PRICED">;
18
+ quantity: z.ZodString;
19
+ entryPrice: z.ZodString;
20
+ exitPrice: z.ZodString;
21
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
22
+ }, z.core.$strip>, z.ZodObject<{
23
+ kind: z.ZodLiteral<"UNPRICED">;
24
+ quantity: z.ZodString;
25
+ }, z.core.$strip>], "kind">;
26
+ export type TradeRealization = z.output<typeof TradeRealization>;
27
+ /** The complete exposure effect of one fill, including flip quantities. */
28
+ export declare const TradePositionEffect: z.ZodDiscriminatedUnion<[z.ZodObject<{
29
+ kind: z.ZodLiteral<"OPEN">;
30
+ openedQuantity: z.ZodString;
31
+ }, z.core.$strip>, z.ZodObject<{
32
+ kind: z.ZodLiteral<"INCREASE">;
33
+ increasedQuantity: z.ZodString;
34
+ }, z.core.$strip>, z.ZodObject<{
35
+ kind: z.ZodLiteral<"REDUCE">;
36
+ reducedQuantity: z.ZodString;
37
+ realization: z.ZodDiscriminatedUnion<[z.ZodObject<{
38
+ kind: z.ZodLiteral<"PRICED">;
39
+ quantity: z.ZodString;
40
+ entryPrice: z.ZodString;
41
+ exitPrice: z.ZodString;
42
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
43
+ }, z.core.$strip>, z.ZodObject<{
44
+ kind: z.ZodLiteral<"UNPRICED">;
45
+ quantity: z.ZodString;
46
+ }, z.core.$strip>], "kind">;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ kind: z.ZodLiteral<"CLOSE">;
49
+ reducedQuantity: z.ZodString;
50
+ realization: z.ZodDiscriminatedUnion<[z.ZodObject<{
51
+ kind: z.ZodLiteral<"PRICED">;
52
+ quantity: z.ZodString;
53
+ entryPrice: z.ZodString;
54
+ exitPrice: z.ZodString;
55
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
56
+ }, z.core.$strip>, z.ZodObject<{
57
+ kind: z.ZodLiteral<"UNPRICED">;
58
+ quantity: z.ZodString;
59
+ }, z.core.$strip>], "kind">;
60
+ }, z.core.$strip>, z.ZodObject<{
61
+ kind: z.ZodLiteral<"FLIP">;
62
+ reducedQuantity: z.ZodString;
63
+ openedQuantity: z.ZodString;
64
+ realization: z.ZodDiscriminatedUnion<[z.ZodObject<{
65
+ kind: z.ZodLiteral<"PRICED">;
66
+ quantity: z.ZodString;
67
+ entryPrice: z.ZodString;
68
+ exitPrice: z.ZodString;
69
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
70
+ }, z.core.$strip>, z.ZodObject<{
71
+ kind: z.ZodLiteral<"UNPRICED">;
72
+ quantity: z.ZodString;
73
+ }, z.core.$strip>], "kind">;
74
+ }, z.core.$strip>], "kind">;
75
+ export type TradePositionEffect = z.output<typeof TradePositionEffect>;
76
+ /** One executed fill enriched with its position transition. */
77
+ export declare const TradeFill: z.ZodObject<{
78
+ id: z.ZodUUID;
79
+ positionId: z.ZodUUID;
80
+ symbol: z.ZodString;
81
+ connector: z.ZodEnum<{
82
+ hyperliquid: "hyperliquid";
83
+ binance: "binance";
84
+ bybit: "bybit";
85
+ okx: "okx";
86
+ lighter: "lighter";
87
+ }>;
88
+ side: z.ZodEnum<{
89
+ BUY: "BUY";
90
+ SELL: "SELL";
91
+ }>;
92
+ quantity: z.ZodString;
93
+ price: z.ZodString;
94
+ tradeFee: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
95
+ pearFee: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
96
+ timestamp: z.ZodISODateTime;
97
+ settlement: z.ZodEnum<{
98
+ PROVISIONAL: "PROVISIONAL";
99
+ CONFIRMED: "CONFIRMED";
100
+ }>;
101
+ executionId: z.ZodOptional<z.ZodUUID>;
102
+ positionEffect: z.ZodDiscriminatedUnion<[z.ZodObject<{
103
+ kind: z.ZodLiteral<"OPEN">;
104
+ openedQuantity: z.ZodString;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ kind: z.ZodLiteral<"INCREASE">;
107
+ increasedQuantity: z.ZodString;
108
+ }, z.core.$strip>, z.ZodObject<{
109
+ kind: z.ZodLiteral<"REDUCE">;
110
+ reducedQuantity: z.ZodString;
111
+ realization: z.ZodDiscriminatedUnion<[z.ZodObject<{
112
+ kind: z.ZodLiteral<"PRICED">;
113
+ quantity: z.ZodString;
114
+ entryPrice: z.ZodString;
115
+ exitPrice: z.ZodString;
116
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
117
+ }, z.core.$strip>, z.ZodObject<{
118
+ kind: z.ZodLiteral<"UNPRICED">;
119
+ quantity: z.ZodString;
120
+ }, z.core.$strip>], "kind">;
121
+ }, z.core.$strip>, z.ZodObject<{
122
+ kind: z.ZodLiteral<"CLOSE">;
123
+ reducedQuantity: z.ZodString;
124
+ realization: z.ZodDiscriminatedUnion<[z.ZodObject<{
125
+ kind: z.ZodLiteral<"PRICED">;
126
+ quantity: z.ZodString;
127
+ entryPrice: z.ZodString;
128
+ exitPrice: z.ZodString;
129
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
130
+ }, z.core.$strip>, z.ZodObject<{
131
+ kind: z.ZodLiteral<"UNPRICED">;
132
+ quantity: z.ZodString;
133
+ }, z.core.$strip>], "kind">;
134
+ }, z.core.$strip>, z.ZodObject<{
135
+ kind: z.ZodLiteral<"FLIP">;
136
+ reducedQuantity: z.ZodString;
137
+ openedQuantity: z.ZodString;
138
+ realization: z.ZodDiscriminatedUnion<[z.ZodObject<{
139
+ kind: z.ZodLiteral<"PRICED">;
140
+ quantity: z.ZodString;
141
+ entryPrice: z.ZodString;
142
+ exitPrice: z.ZodString;
143
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
144
+ }, z.core.$strip>, z.ZodObject<{
145
+ kind: z.ZodLiteral<"UNPRICED">;
146
+ quantity: z.ZodString;
147
+ }, z.core.$strip>], "kind">;
148
+ }, z.core.$strip>], "kind">;
149
+ basisBefore: z.ZodObject<{
150
+ signedQuantity: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
151
+ basis: z.ZodDiscriminatedUnion<[z.ZodObject<{
152
+ kind: z.ZodLiteral<"FLAT">;
153
+ }, z.core.$strip>, z.ZodObject<{
154
+ kind: z.ZodLiteral<"PRICED">;
155
+ entryPrice: z.ZodString;
156
+ }, z.core.$strip>, z.ZodObject<{
157
+ kind: z.ZodLiteral<"UNPRICED">;
158
+ }, z.core.$strip>], "kind">;
159
+ }, z.core.$strip>;
160
+ basisAfter: z.ZodObject<{
161
+ signedQuantity: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
162
+ basis: z.ZodDiscriminatedUnion<[z.ZodObject<{
163
+ kind: z.ZodLiteral<"FLAT">;
164
+ }, z.core.$strip>, z.ZodObject<{
165
+ kind: z.ZodLiteral<"PRICED">;
166
+ entryPrice: z.ZodString;
167
+ }, z.core.$strip>, z.ZodObject<{
168
+ kind: z.ZodLiteral<"UNPRICED">;
169
+ }, z.core.$strip>], "kind">;
170
+ }, z.core.$strip>;
171
+ }, z.core.$strip>;
172
+ export type TradeFill = z.output<typeof TradeFill>;
173
+ /** A presentation group: one Pear execution or one ungrouped external fill. */
174
+ export declare const TradeGroup: z.ZodObject<{
175
+ id: z.ZodString;
176
+ executionId: z.ZodOptional<z.ZodUUID>;
177
+ scheduleId: z.ZodOptional<z.ZodUUID>;
178
+ triggerId: z.ZodOptional<z.ZodUUID>;
179
+ connector: z.ZodEnum<{
180
+ hyperliquid: "hyperliquid";
181
+ binance: "binance";
182
+ bybit: "bybit";
183
+ okx: "okx";
184
+ lighter: "lighter";
185
+ }>;
186
+ at: z.ZodISODateTime;
187
+ netCashflow: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
188
+ trades: z.ZodArray<z.ZodObject<{
189
+ id: z.ZodUUID;
190
+ positionId: z.ZodUUID;
191
+ symbol: z.ZodString;
192
+ connector: z.ZodEnum<{
193
+ hyperliquid: "hyperliquid";
194
+ binance: "binance";
195
+ bybit: "bybit";
196
+ okx: "okx";
197
+ lighter: "lighter";
198
+ }>;
199
+ side: z.ZodEnum<{
200
+ BUY: "BUY";
201
+ SELL: "SELL";
202
+ }>;
203
+ quantity: z.ZodString;
204
+ price: z.ZodString;
205
+ tradeFee: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
206
+ pearFee: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
207
+ timestamp: z.ZodISODateTime;
208
+ settlement: z.ZodEnum<{
209
+ PROVISIONAL: "PROVISIONAL";
210
+ CONFIRMED: "CONFIRMED";
211
+ }>;
212
+ executionId: z.ZodOptional<z.ZodUUID>;
213
+ positionEffect: z.ZodDiscriminatedUnion<[z.ZodObject<{
214
+ kind: z.ZodLiteral<"OPEN">;
215
+ openedQuantity: z.ZodString;
216
+ }, z.core.$strip>, z.ZodObject<{
217
+ kind: z.ZodLiteral<"INCREASE">;
218
+ increasedQuantity: z.ZodString;
219
+ }, z.core.$strip>, z.ZodObject<{
220
+ kind: z.ZodLiteral<"REDUCE">;
221
+ reducedQuantity: z.ZodString;
222
+ realization: z.ZodDiscriminatedUnion<[z.ZodObject<{
223
+ kind: z.ZodLiteral<"PRICED">;
224
+ quantity: z.ZodString;
225
+ entryPrice: z.ZodString;
226
+ exitPrice: z.ZodString;
227
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
228
+ }, z.core.$strip>, z.ZodObject<{
229
+ kind: z.ZodLiteral<"UNPRICED">;
230
+ quantity: z.ZodString;
231
+ }, z.core.$strip>], "kind">;
232
+ }, z.core.$strip>, z.ZodObject<{
233
+ kind: z.ZodLiteral<"CLOSE">;
234
+ reducedQuantity: z.ZodString;
235
+ realization: z.ZodDiscriminatedUnion<[z.ZodObject<{
236
+ kind: z.ZodLiteral<"PRICED">;
237
+ quantity: z.ZodString;
238
+ entryPrice: z.ZodString;
239
+ exitPrice: z.ZodString;
240
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
241
+ }, z.core.$strip>, z.ZodObject<{
242
+ kind: z.ZodLiteral<"UNPRICED">;
243
+ quantity: z.ZodString;
244
+ }, z.core.$strip>], "kind">;
245
+ }, z.core.$strip>, z.ZodObject<{
246
+ kind: z.ZodLiteral<"FLIP">;
247
+ reducedQuantity: z.ZodString;
248
+ openedQuantity: z.ZodString;
249
+ realization: z.ZodDiscriminatedUnion<[z.ZodObject<{
250
+ kind: z.ZodLiteral<"PRICED">;
251
+ quantity: z.ZodString;
252
+ entryPrice: z.ZodString;
253
+ exitPrice: z.ZodString;
254
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
255
+ }, z.core.$strip>, z.ZodObject<{
256
+ kind: z.ZodLiteral<"UNPRICED">;
257
+ quantity: z.ZodString;
258
+ }, z.core.$strip>], "kind">;
259
+ }, z.core.$strip>], "kind">;
260
+ basisBefore: z.ZodObject<{
261
+ signedQuantity: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
262
+ basis: z.ZodDiscriminatedUnion<[z.ZodObject<{
263
+ kind: z.ZodLiteral<"FLAT">;
264
+ }, z.core.$strip>, z.ZodObject<{
265
+ kind: z.ZodLiteral<"PRICED">;
266
+ entryPrice: z.ZodString;
267
+ }, z.core.$strip>, z.ZodObject<{
268
+ kind: z.ZodLiteral<"UNPRICED">;
269
+ }, z.core.$strip>], "kind">;
270
+ }, z.core.$strip>;
271
+ basisAfter: z.ZodObject<{
272
+ signedQuantity: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
273
+ basis: z.ZodDiscriminatedUnion<[z.ZodObject<{
274
+ kind: z.ZodLiteral<"FLAT">;
275
+ }, z.core.$strip>, z.ZodObject<{
276
+ kind: z.ZodLiteral<"PRICED">;
277
+ entryPrice: z.ZodString;
278
+ }, z.core.$strip>, z.ZodObject<{
279
+ kind: z.ZodLiteral<"UNPRICED">;
280
+ }, z.core.$strip>], "kind">;
281
+ }, z.core.$strip>;
282
+ }, z.core.$strip>>;
283
+ }, z.core.$strip>;
284
+ export type TradeGroup = z.output<typeof TradeGroup>;
@@ -0,0 +1,101 @@
1
+ import { z } from 'zod';
2
+ import { SignedDecimalString, UnsignedDecimalString } from '../common/schema';
3
+ import { Connector } from '../connector';
4
+ import { FillStatus } from '../fill';
5
+ import { InstrumentId } from '../instrument';
6
+
7
+ const TradePositionState = z.object({
8
+ signedQuantity: SignedDecimalString,
9
+ basis: z.discriminatedUnion("kind", [
10
+ z.object({
11
+ kind: z.literal("FLAT")
12
+ }),
13
+ z.object({
14
+ kind: z.literal("PRICED"),
15
+ entryPrice: UnsignedDecimalString
16
+ }),
17
+ z.object({
18
+ kind: z.literal("UNPRICED")
19
+ })
20
+ ])
21
+ });
22
+ const TradeRealization = z.discriminatedUnion("kind", [
23
+ z.object({
24
+ kind: z.literal("PRICED"),
25
+ quantity: UnsignedDecimalString,
26
+ entryPrice: UnsignedDecimalString,
27
+ exitPrice: UnsignedDecimalString,
28
+ grossPnl: SignedDecimalString
29
+ }),
30
+ z.object({
31
+ kind: z.literal("UNPRICED"),
32
+ quantity: UnsignedDecimalString
33
+ })
34
+ ]);
35
+ const TradePositionEffect = z.discriminatedUnion("kind", [
36
+ z.object({
37
+ kind: z.literal("OPEN"),
38
+ openedQuantity: UnsignedDecimalString
39
+ }),
40
+ z.object({
41
+ kind: z.literal("INCREASE"),
42
+ increasedQuantity: UnsignedDecimalString
43
+ }),
44
+ z.object({
45
+ kind: z.literal("REDUCE"),
46
+ reducedQuantity: UnsignedDecimalString,
47
+ realization: TradeRealization
48
+ }),
49
+ z.object({
50
+ kind: z.literal("CLOSE"),
51
+ reducedQuantity: UnsignedDecimalString,
52
+ realization: TradeRealization
53
+ }),
54
+ z.object({
55
+ kind: z.literal("FLIP"),
56
+ reducedQuantity: UnsignedDecimalString,
57
+ openedQuantity: UnsignedDecimalString,
58
+ realization: TradeRealization
59
+ })
60
+ ]);
61
+ const TradeFill = z.object({
62
+ id: z.uuid(),
63
+ positionId: z.uuid(),
64
+ symbol: InstrumentId,
65
+ connector: Connector,
66
+ side: z.enum([
67
+ "BUY",
68
+ "SELL"
69
+ ]),
70
+ quantity: UnsignedDecimalString,
71
+ price: UnsignedDecimalString,
72
+ /** Fee polarity is a charge: `+` is paid, `-` is a rebate — the opposite of `grossPnl`/`netCashflow`, where `+` is a gain. */
73
+ tradeFee: SignedDecimalString.optional(),
74
+ /** Same polarity as `tradeFee`: `+` is a charge paid to Pear. */
75
+ pearFee: SignedDecimalString.optional(),
76
+ /** Microsecond-precision UTC instant, rendered exactly like the group's `at`. */
77
+ timestamp: z.iso.datetime(),
78
+ /** RECONCILED rows are superseded and never listed, so only these two states can appear. */
79
+ settlement: FillStatus.extract([
80
+ "PROVISIONAL",
81
+ "CONFIRMED"
82
+ ]),
83
+ executionId: z.uuid().optional(),
84
+ positionEffect: TradePositionEffect,
85
+ basisBefore: TradePositionState,
86
+ basisAfter: TradePositionState
87
+ });
88
+ const TradeGroup = z.object({
89
+ id: z.string().regex(/^(execution|fill):[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),
90
+ executionId: z.uuid().optional(),
91
+ scheduleId: z.uuid().optional(),
92
+ triggerId: z.uuid().optional(),
93
+ connector: Connector,
94
+ /** Earliest fill instant in the group at microsecond precision; the cursor key. */
95
+ at: z.iso.datetime(),
96
+ /** Priced realized PnL minus every fee in the group; `+` is a gain. */
97
+ netCashflow: SignedDecimalString,
98
+ trades: z.array(TradeFill)
99
+ });
100
+
101
+ export { TradeFill, TradeGroup, TradePositionEffect, TradePositionState, TradeRealization };
@@ -1,2 +1,4 @@
1
+ export * from './entities';
1
2
  export * from './payloads';
3
+ export * from './queries';
2
4
  export * from './responses';
@@ -1,2 +1,4 @@
1
+ export * from './entities';
1
2
  export * from './payloads';
3
+ export * from './queries';
2
4
  export * from './responses';
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ /** Cursor-paginated grouped Trade History query. */
3
+ export declare const TradeListParams: z.ZodObject<{
4
+ cursor: z.ZodOptional<z.ZodString>;
5
+ limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<number>>>;
6
+ }, z.core.$strip>;
7
+ export type TradeListParamsInput = z.input<typeof TradeListParams>;
8
+ export type TradeListParams = z.output<typeof TradeListParams>;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ import { CursorFindParams } from '../common';
3
+
4
+ const TradeListParams = CursorFindParams.extend({
5
+ /** Groups contain every fill in an execution, so keep pages bounded. */
6
+ limit: z.coerce.number().int().positive().max(100).optional().default(20)
7
+ });
8
+
9
+ export { TradeListParams };
@@ -1409,3 +1409,119 @@ export declare const CreateTradeCloseAllResponse: z.ZodObject<{
1409
1409
  }, z.core.$strip>], "intent">], "orderType">>;
1410
1410
  }, z.core.$strip>;
1411
1411
  export type CreateTradeCloseAllResponse = z.output<typeof CreateTradeCloseAllResponse>;
1412
+ /** One cursor page of execution-grouped fill history. */
1413
+ export declare const TradeListResponse: z.ZodObject<{
1414
+ limit: z.ZodNumber;
1415
+ nextCursor: z.ZodOptional<z.ZodString>;
1416
+ groups: z.ZodArray<z.ZodObject<{
1417
+ id: z.ZodString;
1418
+ executionId: z.ZodOptional<z.ZodUUID>;
1419
+ scheduleId: z.ZodOptional<z.ZodUUID>;
1420
+ triggerId: z.ZodOptional<z.ZodUUID>;
1421
+ connector: z.ZodEnum<{
1422
+ hyperliquid: "hyperliquid";
1423
+ binance: "binance";
1424
+ bybit: "bybit";
1425
+ okx: "okx";
1426
+ lighter: "lighter";
1427
+ }>;
1428
+ at: z.ZodISODateTime;
1429
+ netCashflow: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
1430
+ trades: z.ZodArray<z.ZodObject<{
1431
+ id: z.ZodUUID;
1432
+ positionId: z.ZodUUID;
1433
+ symbol: z.ZodString;
1434
+ connector: z.ZodEnum<{
1435
+ hyperliquid: "hyperliquid";
1436
+ binance: "binance";
1437
+ bybit: "bybit";
1438
+ okx: "okx";
1439
+ lighter: "lighter";
1440
+ }>;
1441
+ side: z.ZodEnum<{
1442
+ BUY: "BUY";
1443
+ SELL: "SELL";
1444
+ }>;
1445
+ quantity: z.ZodString;
1446
+ price: z.ZodString;
1447
+ tradeFee: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
1448
+ pearFee: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
1449
+ timestamp: z.ZodISODateTime;
1450
+ settlement: z.ZodEnum<{
1451
+ PROVISIONAL: "PROVISIONAL";
1452
+ CONFIRMED: "CONFIRMED";
1453
+ }>;
1454
+ executionId: z.ZodOptional<z.ZodUUID>;
1455
+ positionEffect: z.ZodDiscriminatedUnion<[z.ZodObject<{
1456
+ kind: z.ZodLiteral<"OPEN">;
1457
+ openedQuantity: z.ZodString;
1458
+ }, z.core.$strip>, z.ZodObject<{
1459
+ kind: z.ZodLiteral<"INCREASE">;
1460
+ increasedQuantity: z.ZodString;
1461
+ }, z.core.$strip>, z.ZodObject<{
1462
+ kind: z.ZodLiteral<"REDUCE">;
1463
+ reducedQuantity: z.ZodString;
1464
+ realization: z.ZodDiscriminatedUnion<[z.ZodObject<{
1465
+ kind: z.ZodLiteral<"PRICED">;
1466
+ quantity: z.ZodString;
1467
+ entryPrice: z.ZodString;
1468
+ exitPrice: z.ZodString;
1469
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
1470
+ }, z.core.$strip>, z.ZodObject<{
1471
+ kind: z.ZodLiteral<"UNPRICED">;
1472
+ quantity: z.ZodString;
1473
+ }, z.core.$strip>], "kind">;
1474
+ }, z.core.$strip>, z.ZodObject<{
1475
+ kind: z.ZodLiteral<"CLOSE">;
1476
+ reducedQuantity: z.ZodString;
1477
+ realization: z.ZodDiscriminatedUnion<[z.ZodObject<{
1478
+ kind: z.ZodLiteral<"PRICED">;
1479
+ quantity: z.ZodString;
1480
+ entryPrice: z.ZodString;
1481
+ exitPrice: z.ZodString;
1482
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
1483
+ }, z.core.$strip>, z.ZodObject<{
1484
+ kind: z.ZodLiteral<"UNPRICED">;
1485
+ quantity: z.ZodString;
1486
+ }, z.core.$strip>], "kind">;
1487
+ }, z.core.$strip>, z.ZodObject<{
1488
+ kind: z.ZodLiteral<"FLIP">;
1489
+ reducedQuantity: z.ZodString;
1490
+ openedQuantity: z.ZodString;
1491
+ realization: z.ZodDiscriminatedUnion<[z.ZodObject<{
1492
+ kind: z.ZodLiteral<"PRICED">;
1493
+ quantity: z.ZodString;
1494
+ entryPrice: z.ZodString;
1495
+ exitPrice: z.ZodString;
1496
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
1497
+ }, z.core.$strip>, z.ZodObject<{
1498
+ kind: z.ZodLiteral<"UNPRICED">;
1499
+ quantity: z.ZodString;
1500
+ }, z.core.$strip>], "kind">;
1501
+ }, z.core.$strip>], "kind">;
1502
+ basisBefore: z.ZodObject<{
1503
+ signedQuantity: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
1504
+ basis: z.ZodDiscriminatedUnion<[z.ZodObject<{
1505
+ kind: z.ZodLiteral<"FLAT">;
1506
+ }, z.core.$strip>, z.ZodObject<{
1507
+ kind: z.ZodLiteral<"PRICED">;
1508
+ entryPrice: z.ZodString;
1509
+ }, z.core.$strip>, z.ZodObject<{
1510
+ kind: z.ZodLiteral<"UNPRICED">;
1511
+ }, z.core.$strip>], "kind">;
1512
+ }, z.core.$strip>;
1513
+ basisAfter: z.ZodObject<{
1514
+ signedQuantity: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
1515
+ basis: z.ZodDiscriminatedUnion<[z.ZodObject<{
1516
+ kind: z.ZodLiteral<"FLAT">;
1517
+ }, z.core.$strip>, z.ZodObject<{
1518
+ kind: z.ZodLiteral<"PRICED">;
1519
+ entryPrice: z.ZodString;
1520
+ }, z.core.$strip>, z.ZodObject<{
1521
+ kind: z.ZodLiteral<"UNPRICED">;
1522
+ }, z.core.$strip>], "kind">;
1523
+ }, z.core.$strip>;
1524
+ }, z.core.$strip>>;
1525
+ }, z.core.$strip>>;
1526
+ }, z.core.$strip>;
1527
+ export type TradeListResponse = z.output<typeof TradeListResponse>;
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
+ import { CursorResponse } from '../common';
2
3
  import { Execution } from '../execution/entities';
4
+ import { TradeGroup } from './entities';
3
5
 
4
6
  const CreateTradeOpenResponse = z.object({
5
7
  execution: Execution
@@ -16,5 +18,8 @@ const CreateTradeReverseResponse = z.object({
16
18
  const CreateTradeCloseAllResponse = z.object({
17
19
  executions: z.array(Execution)
18
20
  });
21
+ const TradeListResponse = CursorResponse.extend({
22
+ groups: z.array(TradeGroup)
23
+ });
19
24
 
20
- export { CreateTradeAdjustResponse, CreateTradeCloseAllResponse, CreateTradeCloseResponse, CreateTradeOpenResponse, CreateTradeReverseResponse };
25
+ export { CreateTradeAdjustResponse, CreateTradeCloseAllResponse, CreateTradeCloseResponse, CreateTradeOpenResponse, CreateTradeReverseResponse, TradeListResponse };
@@ -24,6 +24,7 @@ export declare const BoundReferralReferee: z.ZodObject<{
24
24
  address: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
25
25
  referredAt: z.ZodOptional<z.ZodNumber>;
26
26
  tradeCount: z.ZodNumber;
27
+ volumeUsd: z.ZodString;
27
28
  }, z.core.$strip>;
28
29
  export declare const PendingReferralReferee: z.ZodObject<{
29
30
  status: z.ZodLiteral<"PENDING">;
@@ -34,6 +35,7 @@ export declare const ReferralReferee: z.ZodDiscriminatedUnion<[z.ZodObject<{
34
35
  address: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
35
36
  referredAt: z.ZodOptional<z.ZodNumber>;
36
37
  tradeCount: z.ZodNumber;
38
+ volumeUsd: z.ZodString;
37
39
  }, z.core.$strip>, z.ZodObject<{
38
40
  status: z.ZodLiteral<"PENDING">;
39
41
  address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { EthereumAddress } from '../common/address';
3
+ import { UnsignedDecimalString } from '../common/schema';
3
4
 
4
5
  const UserPreferences = z.object({
5
6
  slippageToleranceBps: z.int().describe("User slippage preference in basis points")
@@ -28,7 +29,8 @@ const BoundReferralReferee = z.object({
28
29
  status: z.literal("BOUND").describe("The referee resolves to a V3 user with a permanent binding"),
29
30
  address: EthereumAddress.optional().describe("Linked EVM wallet address when the referee has one"),
30
31
  referredAt: z.number().int().nonnegative().optional().describe("V3 attribution time in epoch milliseconds; not the original legacy on-chain referral time, and absent on a historical binding without a recoverable date"),
31
- tradeCount: z.number().int().nonnegative().describe("Distinct Pear executions with at least one real confirmed fill")
32
+ tradeCount: z.number().int().nonnegative().describe("Distinct Pear executions with at least one real confirmed fill"),
33
+ volumeUsd: UnsignedDecimalString.describe("Post-binding V3 volume from real confirmed Pear fills, in USD")
32
34
  });
33
35
  const PendingReferralReferee = z.object({
34
36
  status: z.literal("PENDING").describe("A verified legacy referee that has no V3 identity yet"),
@@ -40,11 +40,13 @@ export declare const ReferralRefereeListResponse: z.ZodObject<{
40
40
  nextCursor: z.ZodOptional<z.ZodString>;
41
41
  count: z.ZodNumber;
42
42
  pendingCount: z.ZodNumber;
43
+ totalVolumeUsd: z.ZodString;
43
44
  referees: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
44
45
  status: z.ZodLiteral<"BOUND">;
45
46
  address: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
46
47
  referredAt: z.ZodOptional<z.ZodNumber>;
47
48
  tradeCount: z.ZodNumber;
49
+ volumeUsd: z.ZodString;
48
50
  }, z.core.$strip>, z.ZodObject<{
49
51
  status: z.ZodLiteral<"PENDING">;
50
52
  address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { CursorResponse } from '../common/response';
3
+ import { UnsignedDecimalString } from '../common/schema';
3
4
  import { UserPreferences, UserProfile, ReferralReferee } from './entities';
4
5
 
5
6
  const ProfileResponse = z.object({
@@ -19,6 +20,7 @@ const ReferralStatusResponse = z.object({
19
20
  const ReferralRefereeListResponse = CursorResponse.extend({
20
21
  count: z.number().int().nonnegative().describe("Total referees this list yields, counting bound V3 users and pending legacy wallets together"),
21
22
  pendingCount: z.number().int().nonnegative().describe("Subset of count whose verified legacy wallet has no V3 identity yet, so no binding exists"),
23
+ totalVolumeUsd: UnsignedDecimalString.describe("Post-binding V3 volume from real confirmed Pear fills across the complete bound referee set, independent of pagination"),
22
24
  referees: z.array(ReferralReferee)
23
25
  });
24
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/types",
3
- "version": "1.32.0",
3
+ "version": "2.0.0",
4
4
  "description": "Pear Protocol Types definitions",
5
5
  "private": false,
6
6
  "type": "module",