@pear-protocol/types 1.16.0 → 1.17.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/instrument/entities.d.ts +19 -0
- package/dist/instrument/entities.js +12 -1
- package/dist/instrument/responses.d.ts +10 -0
- package/dist/instrument/responses.js +1 -1
- package/dist/leverage/payloads.d.ts +2 -2
- package/dist/market/entities.d.ts +23 -2
- package/dist/market/entities.js +13 -3
- package/dist/market/index.d.ts +1 -0
- package/dist/market/index.js +1 -0
- package/dist/market/payloads.d.ts +22 -0
- package/dist/market/payloads.js +11 -0
- package/dist/market/responses.d.ts +16 -2
- package/dist/market/responses.js +5 -2
- package/dist/notification/entities.d.ts +292 -34
- package/dist/notification/entities.js +72 -15
- package/dist/notification/responses.d.ts +144 -16
- package/dist/position/entities.d.ts +227 -0
- package/dist/position/entities.js +141 -1
- package/dist/position/queries.d.ts +16 -0
- package/dist/position/queries.js +25 -1
- package/dist/position/responses.d.ts +106 -0
- package/dist/position/responses.js +5 -2
- package/dist/rebalance/entities.d.ts +48 -9
- package/dist/rebalance/entities.js +33 -4
- package/dist/rebalance/responses.d.ts +70 -18
- package/dist/statistics/queries.d.ts +4 -2
- package/dist/statistics/queries.js +8 -2
- package/dist/users/payloads.d.ts +8 -0
- package/dist/users/payloads.js +9 -1
- package/dist/users/response.d.ts +5 -0
- package/dist/users/response.js +5 -1
- package/package.json +1 -1
|
@@ -79,3 +79,109 @@ export declare const OpenPositionLiteListResponse: z.ZodObject<{
|
|
|
79
79
|
}, z.core.$strip>;
|
|
80
80
|
export type OpenPositionLite = z.output<typeof OpenPositionLite>;
|
|
81
81
|
export type OpenPositionLiteListResponse = z.output<typeof OpenPositionLiteListResponse>;
|
|
82
|
+
/**
|
|
83
|
+
* A page of closed trades.
|
|
84
|
+
*
|
|
85
|
+
* A page may hold fewer than `limit` trades and still return a `nextCursor`: closed
|
|
86
|
+
* positions with no confirmed fills are skipped during composition, exactly as
|
|
87
|
+
* `/portfolio` skips them. Page until `nextCursor` is absent, never until a page
|
|
88
|
+
* comes back short — stopping early silently truncates history.
|
|
89
|
+
*/
|
|
90
|
+
export declare const ClosedPositionListResponse: z.ZodObject<{
|
|
91
|
+
limit: z.ZodNumber;
|
|
92
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
93
|
+
trades: z.ZodArray<z.ZodObject<{
|
|
94
|
+
positionId: z.ZodUUID;
|
|
95
|
+
connector: z.ZodEnum<{
|
|
96
|
+
hyperliquid: "hyperliquid";
|
|
97
|
+
binance: "binance";
|
|
98
|
+
bybit: "bybit";
|
|
99
|
+
okx: "okx";
|
|
100
|
+
lighter: "lighter";
|
|
101
|
+
}>;
|
|
102
|
+
openedAt: z.ZodString;
|
|
103
|
+
closedAt: z.ZodString;
|
|
104
|
+
closedReason: z.ZodOptional<z.ZodEnum<{
|
|
105
|
+
NETTED: "NETTED";
|
|
106
|
+
USER: "USER";
|
|
107
|
+
LIQUIDATED: "LIQUIDATED";
|
|
108
|
+
}>>;
|
|
109
|
+
origin: z.ZodEnum<{
|
|
110
|
+
PARTIAL: "PARTIAL";
|
|
111
|
+
PEAR: "PEAR";
|
|
112
|
+
EXTERNAL: "EXTERNAL";
|
|
113
|
+
}>;
|
|
114
|
+
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
115
|
+
netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
116
|
+
totalFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
117
|
+
tradeFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
118
|
+
pearFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
119
|
+
totalFunding: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
120
|
+
entryNotional: z.ZodString;
|
|
121
|
+
exitNotional: z.ZodString;
|
|
122
|
+
exitNotionalComplete: z.ZodBoolean;
|
|
123
|
+
hasSyntheticFills: z.ZodBoolean;
|
|
124
|
+
unstableHistoricalData: z.ZodBoolean;
|
|
125
|
+
longAssets: z.ZodArray<z.ZodString>;
|
|
126
|
+
shortAssets: z.ZodArray<z.ZodString>;
|
|
127
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
128
|
+
asset: z.ZodString;
|
|
129
|
+
side: z.ZodEnum<{
|
|
130
|
+
LONG: "LONG";
|
|
131
|
+
SHORT: "SHORT";
|
|
132
|
+
}>;
|
|
133
|
+
entryVwap: z.ZodOptional<z.ZodString>;
|
|
134
|
+
exitVwap: z.ZodOptional<z.ZodString>;
|
|
135
|
+
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
136
|
+
netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
137
|
+
totalFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
138
|
+
tradeFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
139
|
+
pearFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
140
|
+
funding: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
141
|
+
entryNotional: z.ZodString;
|
|
142
|
+
exitQuantity: z.ZodString;
|
|
143
|
+
undeterminedSize: z.ZodString;
|
|
144
|
+
}, z.core.$strip>>;
|
|
145
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
146
|
+
executionId: z.ZodOptional<z.ZodString>;
|
|
147
|
+
at: z.ZodString;
|
|
148
|
+
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
149
|
+
legs: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
150
|
+
kind: z.ZodLiteral<"INCREASE">;
|
|
151
|
+
asset: z.ZodString;
|
|
152
|
+
side: z.ZodEnum<{
|
|
153
|
+
BUY: "BUY";
|
|
154
|
+
SELL: "SELL";
|
|
155
|
+
}>;
|
|
156
|
+
quantity: z.ZodString;
|
|
157
|
+
price: z.ZodString;
|
|
158
|
+
tradeFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
159
|
+
pearFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
160
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
161
|
+
kind: z.ZodLiteral<"REDUCE">;
|
|
162
|
+
asset: z.ZodString;
|
|
163
|
+
side: z.ZodEnum<{
|
|
164
|
+
BUY: "BUY";
|
|
165
|
+
SELL: "SELL";
|
|
166
|
+
}>;
|
|
167
|
+
quantity: z.ZodString;
|
|
168
|
+
price: z.ZodString;
|
|
169
|
+
entryBasis: z.ZodString;
|
|
170
|
+
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
171
|
+
tradeFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
172
|
+
pearFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
173
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
174
|
+
kind: z.ZodLiteral<"REDUCE_UNPRICED">;
|
|
175
|
+
asset: z.ZodString;
|
|
176
|
+
side: z.ZodEnum<{
|
|
177
|
+
BUY: "BUY";
|
|
178
|
+
SELL: "SELL";
|
|
179
|
+
}>;
|
|
180
|
+
quantity: z.ZodString;
|
|
181
|
+
tradeFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
182
|
+
pearFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
183
|
+
}, z.core.$strip>], "kind">>;
|
|
184
|
+
}, z.core.$strip>>>;
|
|
185
|
+
}, z.core.$strip>>;
|
|
186
|
+
}, z.core.$strip>;
|
|
187
|
+
export type ClosedPositionListResponse = z.output<typeof ClosedPositionListResponse>;
|
|
@@ -3,7 +3,7 @@ import { CursorResponse } from '../common';
|
|
|
3
3
|
import { SignedDecimalString } from '../common/schema';
|
|
4
4
|
import { Connector } from '../connector';
|
|
5
5
|
import { InstrumentId } from '../instrument';
|
|
6
|
-
import { Position, PositionOrigin } from './entities';
|
|
6
|
+
import { Position, PositionOrigin, ClosedTrade } from './entities';
|
|
7
7
|
|
|
8
8
|
const PositionListResponse = CursorResponse.extend({
|
|
9
9
|
positions: z.array(Position)
|
|
@@ -20,5 +20,8 @@ const OpenPositionLite = z.object({
|
|
|
20
20
|
const OpenPositionLiteListResponse = z.object({
|
|
21
21
|
positions: z.array(OpenPositionLite)
|
|
22
22
|
});
|
|
23
|
+
const ClosedPositionListResponse = CursorResponse.extend({
|
|
24
|
+
trades: z.array(ClosedTrade)
|
|
25
|
+
});
|
|
23
26
|
|
|
24
|
-
export { OpenPositionLite, OpenPositionLiteListResponse, PositionListResponse };
|
|
27
|
+
export { ClosedPositionListResponse, OpenPositionLite, OpenPositionLiteListResponse, PositionListResponse };
|
|
@@ -29,7 +29,20 @@ export declare const RebalanceEventStatus: z.ZodEnum<{
|
|
|
29
29
|
export type RebalanceEventStatus = z.infer<typeof RebalanceEventStatus>;
|
|
30
30
|
export declare const WeightMap: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
31
31
|
export type WeightMap = z.output<typeof WeightMap>;
|
|
32
|
-
export declare const
|
|
32
|
+
export declare const AutoRebalanceBetaState: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
33
|
+
state: z.ZodLiteral<"PENDING">;
|
|
34
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
+
state: z.ZodLiteral<"BASELINED">;
|
|
36
|
+
impliedEntryBeta: z.ZodString;
|
|
37
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
+
state: z.ZodLiteral<"TRACKING">;
|
|
39
|
+
impliedEntryBeta: z.ZodString;
|
|
40
|
+
lastDerivedBeta: z.ZodString;
|
|
41
|
+
lastProcessedBetaTime: z.ZodISODateTime;
|
|
42
|
+
driftPct: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>], "state">;
|
|
44
|
+
export type AutoRebalanceBetaState = z.output<typeof AutoRebalanceBetaState>;
|
|
45
|
+
export declare const AutoRebalanceConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
33
46
|
id: z.ZodUUID;
|
|
34
47
|
positionId: z.ZodUUID;
|
|
35
48
|
status: z.ZodEnum<{
|
|
@@ -42,19 +55,45 @@ export declare const AutoRebalanceConfig: z.ZodObject<{
|
|
|
42
55
|
REPEATED_FAILURES: "REPEATED_FAILURES";
|
|
43
56
|
INVALID_LIVE_BETA_EXPOSURE: "INVALID_LIVE_BETA_EXPOSURE";
|
|
44
57
|
}>>;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
minimumDriftPct: z.ZodString;
|
|
59
|
+
createdAt: z.ZodISODateTime;
|
|
60
|
+
updatedAt: z.ZodISODateTime;
|
|
61
|
+
weightSource: z.ZodLiteral<"INITIAL_WEIGHT">;
|
|
62
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
63
|
+
id: z.ZodUUID;
|
|
64
|
+
positionId: z.ZodUUID;
|
|
65
|
+
status: z.ZodEnum<{
|
|
66
|
+
ACTIVE: "ACTIVE";
|
|
67
|
+
PAUSED: "PAUSED";
|
|
48
68
|
}>;
|
|
69
|
+
pausedReason: z.ZodOptional<z.ZodEnum<{
|
|
70
|
+
USER: "USER";
|
|
71
|
+
POSITION_CHANGED: "POSITION_CHANGED";
|
|
72
|
+
REPEATED_FAILURES: "REPEATED_FAILURES";
|
|
73
|
+
INVALID_LIVE_BETA_EXPOSURE: "INVALID_LIVE_BETA_EXPOSURE";
|
|
74
|
+
}>>;
|
|
49
75
|
minimumDriftPct: z.ZodString;
|
|
50
|
-
|
|
76
|
+
createdAt: z.ZodISODateTime;
|
|
77
|
+
updatedAt: z.ZodISODateTime;
|
|
78
|
+
weightSource: z.ZodLiteral<"LIVE_BETA">;
|
|
79
|
+
timeframe: z.ZodEnum<{
|
|
51
80
|
"1d": "1d";
|
|
52
81
|
"1h": "1h";
|
|
53
82
|
"4h": "4h";
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}, z.core.$strip
|
|
83
|
+
}>;
|
|
84
|
+
beta: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
85
|
+
state: z.ZodLiteral<"PENDING">;
|
|
86
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
87
|
+
state: z.ZodLiteral<"BASELINED">;
|
|
88
|
+
impliedEntryBeta: z.ZodString;
|
|
89
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
90
|
+
state: z.ZodLiteral<"TRACKING">;
|
|
91
|
+
impliedEntryBeta: z.ZodString;
|
|
92
|
+
lastDerivedBeta: z.ZodString;
|
|
93
|
+
lastProcessedBetaTime: z.ZodISODateTime;
|
|
94
|
+
driftPct: z.ZodOptional<z.ZodString>;
|
|
95
|
+
}, z.core.$strip>], "state">;
|
|
96
|
+
}, z.core.$strip>], "weightSource">;
|
|
58
97
|
export type AutoRebalanceConfig = z.output<typeof AutoRebalanceConfig>;
|
|
59
98
|
export declare const RebalanceEvent: z.ZodObject<{
|
|
60
99
|
id: z.ZodUUID;
|
|
@@ -13,17 +13,46 @@ const AutoRebalanceWeightSource = z.enum(["INITIAL_WEIGHT", "LIVE_BETA"]);
|
|
|
13
13
|
const AutoRebalanceTimeframe = z.enum(["1h", "4h", "1d"]);
|
|
14
14
|
const RebalanceEventStatus = z.enum(["SUCCESS", "FAILED"]);
|
|
15
15
|
const WeightMap = z.record(InstrumentId, z.number());
|
|
16
|
-
const
|
|
16
|
+
const AutoRebalanceConfigBase = z.object({
|
|
17
17
|
id: z.uuid(),
|
|
18
18
|
positionId: z.uuid(),
|
|
19
19
|
status: AutoRebalanceStatus,
|
|
20
20
|
pausedReason: AutoRebalancePausedReason.optional(),
|
|
21
|
-
weightSource: AutoRebalanceWeightSource,
|
|
22
21
|
minimumDriftPct: UnsignedDecimalString,
|
|
23
|
-
timeframe: AutoRebalanceTimeframe.optional(),
|
|
24
22
|
createdAt: z.iso.datetime(),
|
|
25
23
|
updatedAt: z.iso.datetime()
|
|
26
24
|
});
|
|
25
|
+
const AutoRebalanceBetaState = z.discriminatedUnion("state", [
|
|
26
|
+
z.object({ state: z.literal("PENDING") }),
|
|
27
|
+
z.object({
|
|
28
|
+
state: z.literal("BASELINED"),
|
|
29
|
+
// The frozen drift baseline: implied beta of the achieved leg split at entry, re-snapshotted after
|
|
30
|
+
// every rebalance.
|
|
31
|
+
impliedEntryBeta: UnsignedDecimalString
|
|
32
|
+
}),
|
|
33
|
+
z.object({
|
|
34
|
+
state: z.literal("TRACKING"),
|
|
35
|
+
// The frozen drift baseline: implied beta of the achieved leg split at entry, re-snapshotted after
|
|
36
|
+
// every rebalance.
|
|
37
|
+
impliedEntryBeta: UnsignedDecimalString,
|
|
38
|
+
// Kalman beta of the last candle this config processed — the moving side of the drift comparison.
|
|
39
|
+
lastDerivedBeta: UnsignedDecimalString,
|
|
40
|
+
// Bar time lastDerivedBeta was read at, so a client can judge how fresh that beta is.
|
|
41
|
+
lastProcessedBetaTime: z.iso.datetime(),
|
|
42
|
+
// How far lastDerivedBeta sits from impliedEntryBeta, as a fraction (0.05 = 5%) directly comparable
|
|
43
|
+
// to minimumDriftPct. Derived from the two betas above; absent on a degenerate (zero) baseline.
|
|
44
|
+
driftPct: UnsignedDecimalString.optional()
|
|
45
|
+
})
|
|
46
|
+
]);
|
|
47
|
+
const AutoRebalanceConfig = z.discriminatedUnion("weightSource", [
|
|
48
|
+
AutoRebalanceConfigBase.extend({ weightSource: z.literal("INITIAL_WEIGHT") }),
|
|
49
|
+
AutoRebalanceConfigBase.extend({
|
|
50
|
+
weightSource: z.literal("LIVE_BETA"),
|
|
51
|
+
// Stat-arb bar timeframe selecting which realtime candle feed drives the drift comparison.
|
|
52
|
+
timeframe: AutoRebalanceTimeframe,
|
|
53
|
+
beta: AutoRebalanceBetaState
|
|
54
|
+
})
|
|
55
|
+
]);
|
|
27
56
|
const RebalanceEvent = z.object({
|
|
28
57
|
id: z.uuid(),
|
|
29
58
|
autoRebalanceConfigId: z.uuid(),
|
|
@@ -37,4 +66,4 @@ const RebalanceEvent = z.object({
|
|
|
37
66
|
createdAt: z.iso.datetime()
|
|
38
67
|
});
|
|
39
68
|
|
|
40
|
-
export { AutoRebalanceConfig, AutoRebalancePausedReason, AutoRebalanceStatus, AutoRebalanceTimeframe, AutoRebalanceWeightSource, RebalanceEvent, RebalanceEventStatus, WeightMap };
|
|
69
|
+
export { AutoRebalanceBetaState, AutoRebalanceConfig, AutoRebalancePausedReason, AutoRebalanceStatus, AutoRebalanceTimeframe, AutoRebalanceWeightSource, RebalanceEvent, RebalanceEventStatus, WeightMap };
|
|
@@ -17,7 +17,7 @@ export type RebalanceManualResponse = z.output<typeof RebalanceManualResponse>;
|
|
|
17
17
|
export declare const AutoRebalanceListResponse: z.ZodObject<{
|
|
18
18
|
limit: z.ZodNumber;
|
|
19
19
|
nextCursor: z.ZodOptional<z.ZodString>;
|
|
20
|
-
items: z.ZodArray<z.ZodObject<{
|
|
20
|
+
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
21
21
|
id: z.ZodUUID;
|
|
22
22
|
positionId: z.ZodUUID;
|
|
23
23
|
status: z.ZodEnum<{
|
|
@@ -30,23 +30,49 @@ export declare const AutoRebalanceListResponse: z.ZodObject<{
|
|
|
30
30
|
REPEATED_FAILURES: "REPEATED_FAILURES";
|
|
31
31
|
INVALID_LIVE_BETA_EXPOSURE: "INVALID_LIVE_BETA_EXPOSURE";
|
|
32
32
|
}>>;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
minimumDriftPct: z.ZodString;
|
|
34
|
+
createdAt: z.ZodISODateTime;
|
|
35
|
+
updatedAt: z.ZodISODateTime;
|
|
36
|
+
weightSource: z.ZodLiteral<"INITIAL_WEIGHT">;
|
|
37
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
+
id: z.ZodUUID;
|
|
39
|
+
positionId: z.ZodUUID;
|
|
40
|
+
status: z.ZodEnum<{
|
|
41
|
+
ACTIVE: "ACTIVE";
|
|
42
|
+
PAUSED: "PAUSED";
|
|
36
43
|
}>;
|
|
44
|
+
pausedReason: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
USER: "USER";
|
|
46
|
+
POSITION_CHANGED: "POSITION_CHANGED";
|
|
47
|
+
REPEATED_FAILURES: "REPEATED_FAILURES";
|
|
48
|
+
INVALID_LIVE_BETA_EXPOSURE: "INVALID_LIVE_BETA_EXPOSURE";
|
|
49
|
+
}>>;
|
|
37
50
|
minimumDriftPct: z.ZodString;
|
|
38
|
-
|
|
51
|
+
createdAt: z.ZodISODateTime;
|
|
52
|
+
updatedAt: z.ZodISODateTime;
|
|
53
|
+
weightSource: z.ZodLiteral<"LIVE_BETA">;
|
|
54
|
+
timeframe: z.ZodEnum<{
|
|
39
55
|
"1d": "1d";
|
|
40
56
|
"1h": "1h";
|
|
41
57
|
"4h": "4h";
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
58
|
+
}>;
|
|
59
|
+
beta: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
60
|
+
state: z.ZodLiteral<"PENDING">;
|
|
61
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
62
|
+
state: z.ZodLiteral<"BASELINED">;
|
|
63
|
+
impliedEntryBeta: z.ZodString;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
state: z.ZodLiteral<"TRACKING">;
|
|
66
|
+
impliedEntryBeta: z.ZodString;
|
|
67
|
+
lastDerivedBeta: z.ZodString;
|
|
68
|
+
lastProcessedBetaTime: z.ZodISODateTime;
|
|
69
|
+
driftPct: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, z.core.$strip>], "state">;
|
|
71
|
+
}, z.core.$strip>], "weightSource">>;
|
|
46
72
|
}, z.core.$strip>;
|
|
47
73
|
export type AutoRebalanceListResponse = z.output<typeof AutoRebalanceListResponse>;
|
|
48
74
|
export declare const CreateAutoRebalanceResponse: z.ZodObject<{
|
|
49
|
-
config: z.ZodObject<{
|
|
75
|
+
config: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
50
76
|
id: z.ZodUUID;
|
|
51
77
|
positionId: z.ZodUUID;
|
|
52
78
|
status: z.ZodEnum<{
|
|
@@ -59,19 +85,45 @@ export declare const CreateAutoRebalanceResponse: z.ZodObject<{
|
|
|
59
85
|
REPEATED_FAILURES: "REPEATED_FAILURES";
|
|
60
86
|
INVALID_LIVE_BETA_EXPOSURE: "INVALID_LIVE_BETA_EXPOSURE";
|
|
61
87
|
}>>;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
88
|
+
minimumDriftPct: z.ZodString;
|
|
89
|
+
createdAt: z.ZodISODateTime;
|
|
90
|
+
updatedAt: z.ZodISODateTime;
|
|
91
|
+
weightSource: z.ZodLiteral<"INITIAL_WEIGHT">;
|
|
92
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
93
|
+
id: z.ZodUUID;
|
|
94
|
+
positionId: z.ZodUUID;
|
|
95
|
+
status: z.ZodEnum<{
|
|
96
|
+
ACTIVE: "ACTIVE";
|
|
97
|
+
PAUSED: "PAUSED";
|
|
65
98
|
}>;
|
|
99
|
+
pausedReason: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
USER: "USER";
|
|
101
|
+
POSITION_CHANGED: "POSITION_CHANGED";
|
|
102
|
+
REPEATED_FAILURES: "REPEATED_FAILURES";
|
|
103
|
+
INVALID_LIVE_BETA_EXPOSURE: "INVALID_LIVE_BETA_EXPOSURE";
|
|
104
|
+
}>>;
|
|
66
105
|
minimumDriftPct: z.ZodString;
|
|
67
|
-
|
|
106
|
+
createdAt: z.ZodISODateTime;
|
|
107
|
+
updatedAt: z.ZodISODateTime;
|
|
108
|
+
weightSource: z.ZodLiteral<"LIVE_BETA">;
|
|
109
|
+
timeframe: z.ZodEnum<{
|
|
68
110
|
"1d": "1d";
|
|
69
111
|
"1h": "1h";
|
|
70
112
|
"4h": "4h";
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
113
|
+
}>;
|
|
114
|
+
beta: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
115
|
+
state: z.ZodLiteral<"PENDING">;
|
|
116
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
117
|
+
state: z.ZodLiteral<"BASELINED">;
|
|
118
|
+
impliedEntryBeta: z.ZodString;
|
|
119
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
120
|
+
state: z.ZodLiteral<"TRACKING">;
|
|
121
|
+
impliedEntryBeta: z.ZodString;
|
|
122
|
+
lastDerivedBeta: z.ZodString;
|
|
123
|
+
lastProcessedBetaTime: z.ZodISODateTime;
|
|
124
|
+
driftPct: z.ZodOptional<z.ZodString>;
|
|
125
|
+
}, z.core.$strip>], "state">;
|
|
126
|
+
}, z.core.$strip>], "weightSource">;
|
|
75
127
|
}, z.core.$strip>;
|
|
76
128
|
export type CreateAutoRebalanceResponse = z.output<typeof CreateAutoRebalanceResponse>;
|
|
77
129
|
export declare const RebalanceEventListResponse: z.ZodObject<{
|
|
@@ -14,6 +14,7 @@ export declare const VolumeStatisticsQueryParams: z.ZodObject<{
|
|
|
14
14
|
}>;
|
|
15
15
|
startDate: z.ZodOptional<z.ZodCoercedDate<Date>>;
|
|
16
16
|
endDate: z.ZodDefault<z.ZodCoercedDate<Date>>;
|
|
17
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
17
18
|
}, z.core.$strip>;
|
|
18
19
|
export type VolumeStatisticsQueryParamsInput = z.input<typeof VolumeStatisticsQueryParams>;
|
|
19
20
|
export type VolumeStatisticsQueryParams = z.output<typeof VolumeStatisticsQueryParams>;
|
|
@@ -32,6 +33,7 @@ export declare const OiStatisticsQueryParams: z.ZodObject<{
|
|
|
32
33
|
}>;
|
|
33
34
|
startDate: z.ZodOptional<z.ZodCoercedDate<Date>>;
|
|
34
35
|
endDate: z.ZodDefault<z.ZodCoercedDate<Date>>;
|
|
36
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
35
37
|
}, z.core.$strip>;
|
|
36
38
|
export type OiStatisticsQueryParamsInput = z.input<typeof OiStatisticsQueryParams>;
|
|
37
39
|
export type OiStatisticsQueryParams = z.output<typeof OiStatisticsQueryParams>;
|
|
@@ -47,8 +49,8 @@ export declare const StatisticsTotalsQueryParams: z.ZodObject<{
|
|
|
47
49
|
export type StatisticsTotalsQueryParamsInput = z.input<typeof StatisticsTotalsQueryParams>;
|
|
48
50
|
export type StatisticsTotalsQueryParams = z.output<typeof StatisticsTotalsQueryParams>;
|
|
49
51
|
export declare const LeaderboardSortBy: z.ZodEnum<{
|
|
50
|
-
volume: "volume";
|
|
51
52
|
trades: "trades";
|
|
53
|
+
volume: "volume";
|
|
52
54
|
totalNetPnl: "totalNetPnl";
|
|
53
55
|
}>;
|
|
54
56
|
export type LeaderboardSortBy = z.infer<typeof LeaderboardSortBy>;
|
|
@@ -64,8 +66,8 @@ export declare const LeaderboardQueryParams: z.ZodObject<{
|
|
|
64
66
|
}>>>>;
|
|
65
67
|
asset: z.ZodOptional<z.ZodPipe<z.ZodTransform<string[] | (string[] & any[]) | undefined, string[]>, z.ZodArray<z.ZodString>>>;
|
|
66
68
|
sortBy: z.ZodDefault<z.ZodEnum<{
|
|
67
|
-
volume: "volume";
|
|
68
69
|
trades: "trades";
|
|
70
|
+
volume: "volume";
|
|
69
71
|
totalNetPnl: "totalNetPnl";
|
|
70
72
|
}>>;
|
|
71
73
|
startDate: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<number>, z.ZodTransform<Date, number>>>;
|
|
@@ -6,7 +6,10 @@ const VolumeStatisticsQueryParams = z.object({
|
|
|
6
6
|
connector: Connector,
|
|
7
7
|
resolution: z.enum(["1h", "4h", "24h"]),
|
|
8
8
|
startDate: z.coerce.date().optional(),
|
|
9
|
-
endDate: z.coerce.date().default(() => /* @__PURE__ */ new Date())
|
|
9
|
+
endDate: z.coerce.date().default(() => /* @__PURE__ */ new Date()),
|
|
10
|
+
// Per-client scope; absent serves the global series. The literal 'other'
|
|
11
|
+
// selects the unattributed (NULL) bucket; an unknown code returns an empty series.
|
|
12
|
+
clientId: z.string().trim().min(1).optional()
|
|
10
13
|
}).refine((data) => !data.startDate || data.startDate < data.endDate, {
|
|
11
14
|
message: "startDate must be before endDate"
|
|
12
15
|
});
|
|
@@ -14,7 +17,10 @@ const OiStatisticsQueryParams = z.object({
|
|
|
14
17
|
connector: Connector,
|
|
15
18
|
resolution: z.enum(["1h", "4h", "24h"]),
|
|
16
19
|
startDate: z.coerce.date().optional(),
|
|
17
|
-
endDate: z.coerce.date().default(() => /* @__PURE__ */ new Date())
|
|
20
|
+
endDate: z.coerce.date().default(() => /* @__PURE__ */ new Date()),
|
|
21
|
+
// Per-client scope; absent serves the global series. The literal 'other'
|
|
22
|
+
// selects the unattributed (NULL) bucket; an unknown code returns an empty series.
|
|
23
|
+
clientId: z.string().trim().min(1).optional()
|
|
18
24
|
}).refine((data) => !data.startDate || data.startDate < data.endDate, {
|
|
19
25
|
message: "startDate must be before endDate"
|
|
20
26
|
});
|
package/dist/users/payloads.d.ts
CHANGED
|
@@ -7,3 +7,11 @@ export declare const UpdateUserDisplayName: z.ZodObject<{
|
|
|
7
7
|
displayName: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
|
|
8
8
|
}, z.core.$strip>;
|
|
9
9
|
export type UpdateUserDisplayName = z.infer<typeof UpdateUserDisplayName>;
|
|
10
|
+
export declare const CreateReferralCode: z.ZodObject<{
|
|
11
|
+
referralCode: z.ZodString;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type CreateReferralCode = z.infer<typeof CreateReferralCode>;
|
|
14
|
+
export declare const BindReferralCode: z.ZodObject<{
|
|
15
|
+
referralCode: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type BindReferralCode = z.infer<typeof BindReferralCode>;
|
package/dist/users/payloads.js
CHANGED
|
@@ -22,5 +22,13 @@ const DisplayNameSchema = z.preprocess(
|
|
|
22
22
|
})
|
|
23
23
|
);
|
|
24
24
|
const UpdateUserDisplayName = z.object({ displayName: DisplayNameSchema }).describe("Payload to update user display name");
|
|
25
|
+
const ReferralCodeSpelling = z.string().min(1).max(32).regex(/^[\x20-\x7E]+$/, "Referral code must contain printable ASCII characters only");
|
|
26
|
+
const IssuedReferralCodeSpelling = z.string().trim().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Referral code must contain only letters, digits, hyphens, or underscores");
|
|
27
|
+
const CreateReferralCode = z.object({
|
|
28
|
+
referralCode: IssuedReferralCodeSpelling
|
|
29
|
+
}).describe("Payload to issue a referral code to the authenticated user");
|
|
30
|
+
const BindReferralCode = z.object({
|
|
31
|
+
referralCode: ReferralCodeSpelling
|
|
32
|
+
}).describe("Payload to bind a referral code permanently to the authenticated user");
|
|
25
33
|
|
|
26
|
-
export { UpdateUserDisplayName, UpdateUserPreferences };
|
|
34
|
+
export { BindReferralCode, CreateReferralCode, UpdateUserDisplayName, UpdateUserPreferences };
|
package/dist/users/response.d.ts
CHANGED
|
@@ -26,3 +26,8 @@ export declare const UpdateUserDisplayNameResponse: z.ZodObject<{
|
|
|
26
26
|
displayName: z.ZodString;
|
|
27
27
|
}, z.core.$strip>;
|
|
28
28
|
export type UpdateUserDisplayNameResponse = z.infer<typeof UpdateUserDisplayNameResponse>;
|
|
29
|
+
export declare const ReferralStatusResponse: z.ZodObject<{
|
|
30
|
+
ownedCodes: z.ZodArray<z.ZodString>;
|
|
31
|
+
referrerUserId: z.ZodOptional<z.ZodUUID>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export type ReferralStatusResponse = z.infer<typeof ReferralStatusResponse>;
|
package/dist/users/response.js
CHANGED
|
@@ -11,5 +11,9 @@ const UpdateUserPreferencesResponse = z.object({
|
|
|
11
11
|
const UpdateUserDisplayNameResponse = z.object({
|
|
12
12
|
displayName: z.string().describe("Updated user display name")
|
|
13
13
|
});
|
|
14
|
+
const ReferralStatusResponse = z.object({
|
|
15
|
+
ownedCodes: z.array(z.string()).describe("Exact case-sensitive referral codes owned by the authenticated user"),
|
|
16
|
+
referrerUserId: z.uuid().optional().describe("User that permanently referred the authenticated user")
|
|
17
|
+
});
|
|
14
18
|
|
|
15
|
-
export { ProfileResponse, UpdateUserDisplayNameResponse, UpdateUserPreferencesResponse };
|
|
19
|
+
export { ProfileResponse, ReferralStatusResponse, UpdateUserDisplayNameResponse, UpdateUserPreferencesResponse };
|