@pear-protocol/types 2.12.0 → 2.12.1

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.
@@ -4,6 +4,16 @@ 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
+ /** Public closed-history filters; refuse steps and every unsupported private option. */
8
+ export declare const PublicTraderClosedPositionsParams: z.ZodObject<{
9
+ limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<number>>>;
10
+ cursor: z.ZodOptional<z.ZodString>;
11
+ startDate: z.ZodOptional<z.ZodString>;
12
+ endDate: z.ZodOptional<z.ZodString>;
13
+ positionId: z.ZodOptional<z.ZodUUID>;
14
+ }, z.core.$strict>;
15
+ export type PublicTraderClosedPositionsParamsInput = z.input<typeof PublicTraderClosedPositionsParams>;
16
+ export type PublicTraderClosedPositionsParams = z.output<typeof PublicTraderClosedPositionsParams>;
7
17
  export declare const PublicOpenPosition: z.ZodObject<{
8
18
  status: z.ZodLiteral<"OPEN">;
9
19
  connector: z.ZodEnum<{
@@ -39,6 +49,82 @@ export declare const PublicOpenPosition: z.ZodObject<{
39
49
  }, z.core.$strip>>;
40
50
  }, z.core.$strip>;
41
51
  export type PublicOpenPosition = z.output<typeof PublicOpenPosition>;
52
+ /** Public closed-history fields follow the existing public vault history contract. */
53
+ export declare const PublicClosedPosition: z.ZodObject<{
54
+ status: z.ZodLiteral<"CLOSED">;
55
+ connector: z.ZodEnum<{
56
+ hyperliquid: "hyperliquid";
57
+ binance: "binance";
58
+ bybit: "bybit";
59
+ okx: "okx";
60
+ lighter: "lighter";
61
+ lighter_rhc: "lighter_rhc";
62
+ }>;
63
+ positionId: z.ZodUUID;
64
+ closedReason: z.ZodOptional<z.ZodEnum<{
65
+ NETTED: "NETTED";
66
+ USER: "USER";
67
+ LIQUIDATED: "LIQUIDATED";
68
+ }>>;
69
+ closedAt: z.ZodString;
70
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
71
+ netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
72
+ openedAt: z.ZodString;
73
+ hasProvisionalFills: z.ZodBoolean;
74
+ legs: z.ZodArray<z.ZodObject<{
75
+ side: z.ZodEnum<{
76
+ LONG: "LONG";
77
+ SHORT: "SHORT";
78
+ }>;
79
+ asset: z.ZodString;
80
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
81
+ netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
82
+ entryNotional: z.ZodString;
83
+ entryVwap: z.ZodOptional<z.ZodString>;
84
+ exitVwap: z.ZodOptional<z.ZodString>;
85
+ }, z.core.$strip>>;
86
+ }, z.core.$strip>;
87
+ export type PublicClosedPosition = z.output<typeof PublicClosedPosition>;
88
+ /** Preserve the reader's cursor even when a page contains fewer composed positions than its limit. */
89
+ export declare const PublicTraderClosedPositionsResponse: z.ZodObject<{
90
+ limit: z.ZodNumber;
91
+ nextCursor: z.ZodOptional<z.ZodString>;
92
+ positions: z.ZodArray<z.ZodObject<{
93
+ status: z.ZodLiteral<"CLOSED">;
94
+ connector: z.ZodEnum<{
95
+ hyperliquid: "hyperliquid";
96
+ binance: "binance";
97
+ bybit: "bybit";
98
+ okx: "okx";
99
+ lighter: "lighter";
100
+ lighter_rhc: "lighter_rhc";
101
+ }>;
102
+ positionId: z.ZodUUID;
103
+ closedReason: z.ZodOptional<z.ZodEnum<{
104
+ NETTED: "NETTED";
105
+ USER: "USER";
106
+ LIQUIDATED: "LIQUIDATED";
107
+ }>>;
108
+ closedAt: z.ZodString;
109
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
110
+ netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
111
+ openedAt: z.ZodString;
112
+ hasProvisionalFills: z.ZodBoolean;
113
+ legs: z.ZodArray<z.ZodObject<{
114
+ side: z.ZodEnum<{
115
+ LONG: "LONG";
116
+ SHORT: "SHORT";
117
+ }>;
118
+ asset: z.ZodString;
119
+ grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
120
+ netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
121
+ entryNotional: z.ZodString;
122
+ entryVwap: z.ZodOptional<z.ZodString>;
123
+ exitVwap: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$strip>>;
125
+ }, z.core.$strip>>;
126
+ }, z.core.$strip>;
127
+ export type PublicTraderClosedPositionsResponse = z.output<typeof PublicTraderClosedPositionsResponse>;
42
128
  export declare const PublicTrigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
43
129
  type: z.ZodLiteral<"MARKET">;
44
130
  id: z.ZodUUID;
@@ -1,14 +1,23 @@
1
1
  import { z } from 'zod';
2
+ import { CursorResponse } from '../common';
2
3
  import { Connector } from '../connector';
3
4
  import { CopyFollower } from '../copy/entities';
4
5
  import { Ladder } from '../ladder/entities';
5
- import { OpenPosition, OpenPositionLeg } from '../position/entities';
6
+ import { OpenPosition, OpenPositionLeg, ClosedPosition, ClosedPositionLeg } from '../position/entities';
7
+ import { ClosedPositionListParams } from '../position/queries';
6
8
  import { TWAPOpen, TWAPClose } from '../schedule/entities';
7
9
  import { TriggerMarketOpen, TriggerMarketAdjust, TriggerMarketClose, TriggerTWAPAdjust, TriggerTWAPClose } from '../trigger/entities';
8
10
 
9
11
  const PublicTraderParams = z.object({
10
12
  tradeAccountId: z.uuid()
11
13
  });
14
+ const PublicTraderClosedPositionsParams = z.object({
15
+ limit: ClosedPositionListParams.shape.limit,
16
+ cursor: ClosedPositionListParams.shape.cursor,
17
+ startDate: ClosedPositionListParams.shape.startDate,
18
+ endDate: ClosedPositionListParams.shape.endDate,
19
+ positionId: ClosedPositionListParams.shape.positionId
20
+ }).strict();
12
21
  const PublicOpenPosition = OpenPosition.pick({
13
22
  positionId: true,
14
23
  status: true,
@@ -25,6 +34,30 @@ const PublicOpenPosition = OpenPosition.pick({
25
34
  remaining: true
26
35
  }))
27
36
  });
37
+ const PublicClosedPosition = ClosedPosition.pick({
38
+ positionId: true,
39
+ status: true,
40
+ connector: true,
41
+ openedAt: true,
42
+ closedAt: true,
43
+ closedReason: true,
44
+ grossPnl: true,
45
+ netPnl: true,
46
+ hasProvisionalFills: true
47
+ }).extend({
48
+ legs: z.array(ClosedPositionLeg.pick({
49
+ asset: true,
50
+ side: true,
51
+ entryVwap: true,
52
+ exitVwap: true,
53
+ entryNotional: true,
54
+ grossPnl: true,
55
+ netPnl: true
56
+ }))
57
+ });
58
+ const PublicTraderClosedPositionsResponse = CursorResponse.extend({
59
+ positions: z.array(PublicClosedPosition)
60
+ });
28
61
  const triggerFields = {
29
62
  id: true,
30
63
  connector: true,
@@ -125,4 +158,4 @@ const PublicTraderResponse = z.object({
125
158
  ladders: z.array(PublicLadder)
126
159
  });
127
160
 
128
- export { PublicLadder, PublicOpenPosition, PublicSchedule, PublicTraderParams, PublicTraderResponse, PublicTrigger };
161
+ export { PublicClosedPosition, PublicLadder, PublicOpenPosition, PublicSchedule, PublicTraderClosedPositionsParams, PublicTraderClosedPositionsResponse, PublicTraderParams, PublicTraderResponse, PublicTrigger };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/types",
3
- "version": "2.12.0",
3
+ "version": "2.12.1",
4
4
  "description": "Pear Protocol Types definitions",
5
5
  "private": false,
6
6
  "type": "module",