@pear-protocol/types 1.33.0 → 2.1.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/auth/api-keys.d.ts +1 -0
- package/dist/auth/api-keys.js +2 -1
- package/dist/auth/entities.d.ts +1 -0
- package/dist/auth/entities.js +2 -1
- package/dist/auth/response.d.ts +2 -0
- package/dist/bundle.d.ts +1 -0
- package/dist/bundle.js +1 -0
- package/dist/fee/entities.d.ts +1 -0
- package/dist/fee/entities.js +2 -1
- package/dist/margin/index.d.ts +2 -0
- package/dist/margin/index.js +2 -0
- package/dist/margin/payloads.d.ts +7 -0
- package/dist/margin/payloads.js +20 -0
- package/dist/margin/response.d.ts +5 -0
- package/dist/margin/response.js +11 -0
- package/dist/portfolio/entities.d.ts +107 -150
- package/dist/portfolio/entities.js +51 -83
- package/dist/portfolio/queries.d.ts +0 -1
- package/dist/portfolio/queries.js +4 -5
- package/dist/portfolio/responses.d.ts +158 -149
- package/dist/portfolio/responses.js +20 -7
- package/dist/position/entities.d.ts +148 -13
- package/dist/position/entities.js +161 -12
- package/dist/position/queries.d.ts +17 -1
- package/dist/position/queries.js +42 -2
- package/dist/position/responses.d.ts +107 -3
- package/dist/position/responses.js +6 -3
- package/dist/statistics/queries.d.ts +8 -8
- package/dist/statistics/queries.js +3 -3
- package/dist/trade/entities.d.ts +284 -0
- package/dist/trade/entities.js +101 -0
- package/dist/trade/index.d.ts +2 -0
- package/dist/trade/index.js +2 -0
- package/dist/trade/queries.d.ts +8 -0
- package/dist/trade/queries.js +9 -0
- package/dist/trade/responses.d.ts +116 -0
- package/dist/trade/responses.js +6 -1
- package/dist/trade-accounts/entities.d.ts +4 -0
- package/dist/trade-accounts/entities.js +4 -0
- package/dist/trade-accounts/payloads.d.ts +12 -0
- package/dist/trade-accounts/payloads.js +10 -1
- package/dist/trade-accounts/response.d.ts +101 -0
- package/dist/trade-accounts/response.js +14 -1
- package/dist/users/entities.d.ts +1 -0
- package/dist/users/entities.js +2 -1
- package/dist/users/response.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,176 +1,185 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const PortfolioResponse: z.ZodObject<{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
3
|
+
realizedCashflow: z.ZodObject<{
|
|
4
|
+
grossPnl: z.ZodNumber;
|
|
5
|
+
tradeFees: z.ZodNumber;
|
|
6
|
+
pearFees: z.ZodNumber;
|
|
7
|
+
netCashflow: z.ZodNumber;
|
|
8
|
+
funding: z.ZodNumber;
|
|
9
|
+
netCashflowWithFunding: z.ZodNumber;
|
|
10
|
+
undeterminedQuantityByAsset: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
11
|
+
fundingSynced: z.ZodBoolean;
|
|
12
|
+
intervals: z.ZodOptional<z.ZodObject<{
|
|
13
|
+
oneDay: z.ZodArray<z.ZodObject<{
|
|
14
|
+
grossPnl: z.ZodNumber;
|
|
15
|
+
tradeFees: z.ZodNumber;
|
|
16
|
+
pearFees: z.ZodNumber;
|
|
17
|
+
netCashflow: z.ZodNumber;
|
|
18
|
+
funding: z.ZodNumber;
|
|
19
|
+
netCashflowWithFunding: z.ZodNumber;
|
|
20
|
+
undeterminedQuantityByAsset: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
21
|
+
periodStart: z.ZodString;
|
|
22
|
+
periodEnd: z.ZodString;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
oneWeek: z.ZodArray<z.ZodObject<{
|
|
25
|
+
grossPnl: z.ZodNumber;
|
|
26
|
+
tradeFees: z.ZodNumber;
|
|
27
|
+
pearFees: z.ZodNumber;
|
|
28
|
+
netCashflow: z.ZodNumber;
|
|
29
|
+
funding: z.ZodNumber;
|
|
30
|
+
netCashflowWithFunding: z.ZodNumber;
|
|
31
|
+
undeterminedQuantityByAsset: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
32
|
+
periodStart: z.ZodString;
|
|
33
|
+
periodEnd: z.ZodString;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
oneMonth: z.ZodArray<z.ZodObject<{
|
|
36
|
+
grossPnl: z.ZodNumber;
|
|
37
|
+
tradeFees: z.ZodNumber;
|
|
38
|
+
pearFees: z.ZodNumber;
|
|
39
|
+
netCashflow: z.ZodNumber;
|
|
40
|
+
funding: z.ZodNumber;
|
|
41
|
+
netCashflowWithFunding: z.ZodNumber;
|
|
42
|
+
undeterminedQuantityByAsset: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
43
|
+
periodStart: z.ZodString;
|
|
44
|
+
periodEnd: z.ZodString;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
oneYear: z.ZodArray<z.ZodObject<{
|
|
47
|
+
grossPnl: z.ZodNumber;
|
|
48
|
+
tradeFees: z.ZodNumber;
|
|
49
|
+
pearFees: z.ZodNumber;
|
|
50
|
+
netCashflow: z.ZodNumber;
|
|
51
|
+
funding: z.ZodNumber;
|
|
52
|
+
netCashflowWithFunding: z.ZodNumber;
|
|
53
|
+
undeterminedQuantityByAsset: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
54
|
+
periodStart: z.ZodString;
|
|
55
|
+
periodEnd: z.ZodString;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
all: z.ZodArray<z.ZodObject<{
|
|
58
|
+
grossPnl: z.ZodNumber;
|
|
59
|
+
tradeFees: z.ZodNumber;
|
|
60
|
+
pearFees: z.ZodNumber;
|
|
61
|
+
netCashflow: z.ZodNumber;
|
|
62
|
+
funding: z.ZodNumber;
|
|
63
|
+
netCashflowWithFunding: z.ZodNumber;
|
|
64
|
+
undeterminedQuantityByAsset: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
65
|
+
periodStart: z.ZodString;
|
|
66
|
+
periodEnd: z.ZodString;
|
|
67
|
+
}, z.core.$strip>>;
|
|
53
68
|
}, z.core.$strip>>;
|
|
54
|
-
}, z.core.$strip
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
closedPositionStats: z.ZodObject<{
|
|
71
|
+
totalPositions: z.ZodNumber;
|
|
72
|
+
wins: z.ZodNumber;
|
|
73
|
+
losses: z.ZodNumber;
|
|
74
|
+
hitRate: z.ZodNullable<z.ZodNumber>;
|
|
75
|
+
profitFactor: z.ZodNullable<z.ZodNumber>;
|
|
76
|
+
avgWinSize: z.ZodNullable<z.ZodNumber>;
|
|
77
|
+
avgLossSize: z.ZodNullable<z.ZodNumber>;
|
|
78
|
+
netPnl: z.ZodNumber;
|
|
79
|
+
positionPnls: z.ZodArray<z.ZodNumber>;
|
|
80
|
+
positionReturns: z.ZodArray<z.ZodNumber>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
openSnapshot: z.ZodObject<{
|
|
83
|
+
openInterest: z.ZodNumber;
|
|
62
84
|
unrealizedPnl: z.ZodNumber;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
volume: z.ZodObject<{
|
|
87
|
+
total: z.ZodNumber;
|
|
88
|
+
intervals: z.ZodOptional<z.ZodObject<{
|
|
89
|
+
oneDay: z.ZodArray<z.ZodObject<{
|
|
90
|
+
periodStart: z.ZodString;
|
|
91
|
+
periodEnd: z.ZodString;
|
|
92
|
+
volume: z.ZodNumber;
|
|
93
|
+
}, z.core.$strip>>;
|
|
94
|
+
oneWeek: z.ZodArray<z.ZodObject<{
|
|
95
|
+
periodStart: z.ZodString;
|
|
96
|
+
periodEnd: z.ZodString;
|
|
97
|
+
volume: z.ZodNumber;
|
|
98
|
+
}, z.core.$strip>>;
|
|
99
|
+
oneMonth: z.ZodArray<z.ZodObject<{
|
|
100
|
+
periodStart: z.ZodString;
|
|
101
|
+
periodEnd: z.ZodString;
|
|
102
|
+
volume: z.ZodNumber;
|
|
103
|
+
}, z.core.$strip>>;
|
|
104
|
+
oneYear: z.ZodArray<z.ZodObject<{
|
|
105
|
+
periodStart: z.ZodString;
|
|
106
|
+
periodEnd: z.ZodString;
|
|
107
|
+
volume: z.ZodNumber;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
all: z.ZodArray<z.ZodObject<{
|
|
110
|
+
periodStart: z.ZodString;
|
|
111
|
+
periodEnd: z.ZodString;
|
|
112
|
+
volume: z.ZodNumber;
|
|
113
|
+
}, z.core.$strip>>;
|
|
114
|
+
}, z.core.$strip>>;
|
|
66
115
|
}, z.core.$strip>;
|
|
67
116
|
}, z.core.$strip>;
|
|
68
117
|
export type PortfolioResponse = z.output<typeof PortfolioResponse>;
|
|
69
118
|
export declare const PortfolioAnalyticsResponse: z.ZodObject<{
|
|
70
119
|
config: z.ZodObject<{
|
|
71
|
-
rollingWindowDays: z.ZodNumber;
|
|
72
120
|
startDate: z.ZodString;
|
|
73
121
|
endDate: z.ZodString;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
realizedCashflow: z.ZodObject<{
|
|
124
|
+
grossPnl: z.ZodNumber;
|
|
125
|
+
tradeFees: z.ZodNumber;
|
|
126
|
+
pearFees: z.ZodNumber;
|
|
127
|
+
netCashflow: z.ZodNumber;
|
|
128
|
+
funding: z.ZodNumber;
|
|
129
|
+
netCashflowWithFunding: z.ZodNumber;
|
|
130
|
+
undeterminedQuantityByAsset: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
74
131
|
fundingSynced: z.ZodBoolean;
|
|
132
|
+
series: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
133
|
+
grossPnl: z.ZodNumber;
|
|
134
|
+
tradeFees: z.ZodNumber;
|
|
135
|
+
pearFees: z.ZodNumber;
|
|
136
|
+
netCashflow: z.ZodNumber;
|
|
137
|
+
funding: z.ZodNumber;
|
|
138
|
+
netCashflowWithFunding: z.ZodNumber;
|
|
139
|
+
undeterminedQuantityByAsset: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
140
|
+
periodStart: z.ZodString;
|
|
141
|
+
periodEnd: z.ZodString;
|
|
142
|
+
}, z.core.$strip>>>;
|
|
75
143
|
}, z.core.$strip>;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
profitFactor: z.ZodNullable<z.ZodNumber>;
|
|
82
|
-
avgWinSize: z.ZodNullable<z.ZodNumber>;
|
|
83
|
-
avgLossSize: z.ZodNullable<z.ZodNumber>;
|
|
84
|
-
avgReturnPerWin: z.ZodNullable<z.ZodNumber>;
|
|
85
|
-
avgReturnPerLoss: z.ZodNullable<z.ZodNumber>;
|
|
86
|
-
maxDrawdown: z.ZodNullable<z.ZodNumber>;
|
|
87
|
-
sharpeRatio: z.ZodNullable<z.ZodNumber>;
|
|
88
|
-
sortinoRatio: z.ZodNullable<z.ZodNumber>;
|
|
89
|
-
}, z.core.$strip>;
|
|
90
|
-
realizedPlusUnrealized: z.ZodObject<{
|
|
91
|
-
pnlAbsolute: z.ZodNumber;
|
|
92
|
-
pnlPercent: z.ZodNullable<z.ZodNumber>;
|
|
93
|
-
hitRate: z.ZodNullable<z.ZodNumber>;
|
|
94
|
-
profitFactor: z.ZodNullable<z.ZodNumber>;
|
|
95
|
-
avgWinSize: z.ZodNullable<z.ZodNumber>;
|
|
96
|
-
avgLossSize: z.ZodNullable<z.ZodNumber>;
|
|
97
|
-
avgReturnPerWin: z.ZodNullable<z.ZodNumber>;
|
|
98
|
-
avgReturnPerLoss: z.ZodNullable<z.ZodNumber>;
|
|
99
|
-
maxDrawdown: z.ZodNullable<z.ZodNumber>;
|
|
100
|
-
sharpeRatio: z.ZodNullable<z.ZodNumber>;
|
|
101
|
-
sortinoRatio: z.ZodNullable<z.ZodNumber>;
|
|
102
|
-
}, z.core.$strip>;
|
|
103
|
-
realizedHitRate: z.ZodNullable<z.ZodNumber>;
|
|
144
|
+
closedPositionStats: z.ZodObject<{
|
|
145
|
+
totalPositions: z.ZodNumber;
|
|
146
|
+
wins: z.ZodNumber;
|
|
147
|
+
losses: z.ZodNumber;
|
|
148
|
+
hitRate: z.ZodNullable<z.ZodNumber>;
|
|
104
149
|
profitFactor: z.ZodNullable<z.ZodNumber>;
|
|
105
150
|
avgWinSize: z.ZodNullable<z.ZodNumber>;
|
|
106
151
|
avgLossSize: z.ZodNullable<z.ZodNumber>;
|
|
107
|
-
|
|
108
|
-
|
|
152
|
+
netPnl: z.ZodNumber;
|
|
153
|
+
positionPnls: z.ZodArray<z.ZodNumber>;
|
|
154
|
+
positionReturns: z.ZodArray<z.ZodNumber>;
|
|
109
155
|
}, z.core.$strip>;
|
|
110
|
-
|
|
111
|
-
asset: z.ZodString;
|
|
112
|
-
realizedOnly: z.ZodObject<{
|
|
113
|
-
pnlAbsolute: z.ZodNumber;
|
|
114
|
-
pnlPercent: z.ZodNullable<z.ZodNumber>;
|
|
115
|
-
hitRate: z.ZodNullable<z.ZodNumber>;
|
|
116
|
-
profitFactor: z.ZodNullable<z.ZodNumber>;
|
|
117
|
-
avgWinSize: z.ZodNullable<z.ZodNumber>;
|
|
118
|
-
avgLossSize: z.ZodNullable<z.ZodNumber>;
|
|
119
|
-
avgReturnPerWin: z.ZodNullable<z.ZodNumber>;
|
|
120
|
-
avgReturnPerLoss: z.ZodNullable<z.ZodNumber>;
|
|
121
|
-
maxDrawdown: z.ZodNullable<z.ZodNumber>;
|
|
122
|
-
sharpeRatio: z.ZodNullable<z.ZodNumber>;
|
|
123
|
-
sortinoRatio: z.ZodNullable<z.ZodNumber>;
|
|
124
|
-
}, z.core.$strip>;
|
|
125
|
-
realizedPlusUnrealized: z.ZodObject<{
|
|
126
|
-
pnlAbsolute: z.ZodNumber;
|
|
127
|
-
pnlPercent: z.ZodNullable<z.ZodNumber>;
|
|
128
|
-
hitRate: z.ZodNullable<z.ZodNumber>;
|
|
129
|
-
profitFactor: z.ZodNullable<z.ZodNumber>;
|
|
130
|
-
avgWinSize: z.ZodNullable<z.ZodNumber>;
|
|
131
|
-
avgLossSize: z.ZodNullable<z.ZodNumber>;
|
|
132
|
-
avgReturnPerWin: z.ZodNullable<z.ZodNumber>;
|
|
133
|
-
avgReturnPerLoss: z.ZodNullable<z.ZodNumber>;
|
|
134
|
-
maxDrawdown: z.ZodNullable<z.ZodNumber>;
|
|
135
|
-
sharpeRatio: z.ZodNullable<z.ZodNumber>;
|
|
136
|
-
sortinoRatio: z.ZodNullable<z.ZodNumber>;
|
|
137
|
-
}, z.core.$strip>;
|
|
138
|
-
unrealizedReturnPerDay: z.ZodNullable<z.ZodNumber>;
|
|
139
|
-
}, z.core.$strip>>;
|
|
140
|
-
pairs: z.ZodArray<z.ZodObject<{
|
|
156
|
+
pairBreakdown: z.ZodArray<z.ZodObject<{
|
|
141
157
|
key: z.ZodString;
|
|
142
158
|
longAssets: z.ZodArray<z.ZodString>;
|
|
143
159
|
shortAssets: z.ZodArray<z.ZodString>;
|
|
144
|
-
|
|
160
|
+
positions: z.ZodNumber;
|
|
145
161
|
wins: z.ZodNumber;
|
|
146
162
|
losses: z.ZodNumber;
|
|
147
163
|
hitRate: z.ZodNullable<z.ZodNumber>;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
164
|
+
profitFactor: z.ZodNullable<z.ZodNumber>;
|
|
165
|
+
expectancy: z.ZodNumber;
|
|
166
|
+
grossPnl: z.ZodNumber;
|
|
167
|
+
tradeFees: z.ZodNumber;
|
|
168
|
+
pearFees: z.ZodNumber;
|
|
169
|
+
netPnl: z.ZodNumber;
|
|
152
170
|
bookPercent: z.ZodNullable<z.ZodNumber>;
|
|
153
171
|
}, z.core.$strip>>;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
rollingWinLossRatio: z.ZodNullable<z.ZodNumber>;
|
|
167
|
-
dailyReturn: z.ZodNullable<z.ZodNumber>;
|
|
168
|
-
cumulativeReturn: z.ZodNumber;
|
|
169
|
-
equity: z.ZodNumber;
|
|
170
|
-
drawdown: z.ZodNumber;
|
|
171
|
-
rollingSharpe: z.ZodNullable<z.ZodNumber>;
|
|
172
|
-
rollingSortino: z.ZodNullable<z.ZodNumber>;
|
|
173
|
-
rollingVolatility: z.ZodNullable<z.ZodNumber>;
|
|
174
|
-
}, z.core.$strip>>>;
|
|
172
|
+
openSnapshot: z.ZodObject<{
|
|
173
|
+
openInterest: z.ZodNumber;
|
|
174
|
+
unrealizedPnl: z.ZodNumber;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
volume: z.ZodObject<{
|
|
177
|
+
total: z.ZodNumber;
|
|
178
|
+
series: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
179
|
+
periodStart: z.ZodString;
|
|
180
|
+
periodEnd: z.ZodString;
|
|
181
|
+
volume: z.ZodNumber;
|
|
182
|
+
}, z.core.$strip>>>;
|
|
183
|
+
}, z.core.$strip>;
|
|
175
184
|
}, z.core.$strip>;
|
|
176
185
|
export type PortfolioAnalyticsResponse = z.output<typeof PortfolioAnalyticsResponse>;
|
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { PortfolioOpenSnapshot, PortfolioClosedPositionStats, PortfolioVolumeAmounts, PortfolioVolumeIntervals, PortfolioCashflowAmounts, PortfolioCashflowIntervals, PortfolioAnalyticsConfig, PortfolioVolumeSeriesPoint, PortfolioPairBreakdown, PortfolioCashflowSeriesPoint } from './entities';
|
|
3
3
|
|
|
4
4
|
const PortfolioResponse = z.object({
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
realizedCashflow: PortfolioCashflowAmounts.extend({
|
|
6
|
+
fundingSynced: z.boolean(),
|
|
7
|
+
intervals: PortfolioCashflowIntervals.optional()
|
|
8
|
+
}),
|
|
9
|
+
closedPositionStats: PortfolioClosedPositionStats,
|
|
10
|
+
openSnapshot: PortfolioOpenSnapshot,
|
|
11
|
+
volume: PortfolioVolumeAmounts.extend({
|
|
12
|
+
intervals: PortfolioVolumeIntervals.optional()
|
|
13
|
+
})
|
|
7
14
|
});
|
|
8
15
|
const PortfolioAnalyticsResponse = z.object({
|
|
9
16
|
config: PortfolioAnalyticsConfig,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
realizedCashflow: PortfolioCashflowAmounts.extend({
|
|
18
|
+
fundingSynced: z.boolean(),
|
|
19
|
+
series: z.array(PortfolioCashflowSeriesPoint).optional()
|
|
20
|
+
}),
|
|
21
|
+
closedPositionStats: PortfolioClosedPositionStats,
|
|
22
|
+
pairBreakdown: z.array(PortfolioPairBreakdown),
|
|
23
|
+
openSnapshot: PortfolioOpenSnapshot,
|
|
24
|
+
volume: PortfolioVolumeAmounts.extend({
|
|
25
|
+
series: z.array(PortfolioVolumeSeriesPoint).optional()
|
|
26
|
+
})
|
|
14
27
|
});
|
|
15
28
|
|
|
16
29
|
export { PortfolioAnalyticsResponse, PortfolioResponse };
|
|
@@ -43,7 +43,8 @@ export type PositionInitialExposureUSD = z.infer<typeof PositionInitialExposureU
|
|
|
43
43
|
* negative = net paid). Derived by walking the position's exposure snapshots and
|
|
44
44
|
* summing each in-window funding event as `exposure × fundingPerUnit`. Across a
|
|
45
45
|
* fully-tracked account the per-position shares sum to the account funding (up to
|
|
46
|
-
* 20-dp rounding of the coefficient)
|
|
46
|
+
* 20-dp rounding of the coefficient); untracked or external exposure sharing the
|
|
47
|
+
* account under-attributes the shares, so the account-level total stays authoritative.
|
|
47
48
|
*
|
|
48
49
|
* @example { '0': '-1.25' } means 1.25 USD of BTC funding paid over the position's life
|
|
49
50
|
*/
|
|
@@ -92,11 +93,11 @@ export declare const Position: z.ZodObject<{
|
|
|
92
93
|
}, z.core.$strip>;
|
|
93
94
|
export type Position = z.output<typeof Position>;
|
|
94
95
|
/** Which way a closed basket's leg was held. */
|
|
95
|
-
export declare const
|
|
96
|
+
export declare const ClosedPositionLegSide: z.ZodEnum<{
|
|
96
97
|
LONG: "LONG";
|
|
97
98
|
SHORT: "SHORT";
|
|
98
99
|
}>;
|
|
99
|
-
export type
|
|
100
|
+
export type ClosedPositionLegSide = z.output<typeof ClosedPositionLegSide>;
|
|
100
101
|
/**
|
|
101
102
|
* What one asset did inside one step.
|
|
102
103
|
*
|
|
@@ -107,7 +108,7 @@ export type ClosedTradeLegSide = z.output<typeof ClosedTradeLegSide>;
|
|
|
107
108
|
* value it. Collapsing it into REDUCE would invent a basis; collapsing it into
|
|
108
109
|
* INCREASE would report a close as an add.
|
|
109
110
|
*/
|
|
110
|
-
export declare const
|
|
111
|
+
export declare const PositionStepLeg: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
111
112
|
kind: z.ZodLiteral<"INCREASE">;
|
|
112
113
|
asset: z.ZodString;
|
|
113
114
|
side: z.ZodEnum<{
|
|
@@ -142,7 +143,7 @@ export declare const ClosedTradeStepLeg: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
142
143
|
tradeFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
143
144
|
pearFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
144
145
|
}, z.core.$strip>], "kind">;
|
|
145
|
-
export type
|
|
146
|
+
export type PositionStepLeg = z.output<typeof PositionStepLeg>;
|
|
146
147
|
/**
|
|
147
148
|
* One action taken on the position, in the order it happened: the open, each add, each
|
|
148
149
|
* reduction, and the close.
|
|
@@ -153,7 +154,7 @@ export type ClosedTradeStepLeg = z.output<typeof ClosedTradeStepLeg>;
|
|
|
153
154
|
* genuinely separate actions sharing an instant therefore merge into one step; the
|
|
154
155
|
* `executionId` being absent is the signal that a step was grouped this way.
|
|
155
156
|
*/
|
|
156
|
-
export declare const
|
|
157
|
+
export declare const PositionStep: z.ZodObject<{
|
|
157
158
|
executionId: z.ZodOptional<z.ZodString>;
|
|
158
159
|
at: z.ZodString;
|
|
159
160
|
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
@@ -193,15 +194,15 @@ export declare const ClosedTradeStep: z.ZodObject<{
|
|
|
193
194
|
pearFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
194
195
|
}, z.core.$strip>], "kind">>;
|
|
195
196
|
}, z.core.$strip>;
|
|
196
|
-
export type
|
|
197
|
+
export type PositionStep = z.output<typeof PositionStep>;
|
|
197
198
|
/**
|
|
198
|
-
* One leg of a closed
|
|
199
|
+
* One leg of a closed position, with its own entry and exit economics.
|
|
199
200
|
*
|
|
200
201
|
* Both optional prices are absent rather than "0" whenever they cannot be derived:
|
|
201
202
|
* "0" is a real price, and claiming one the ledger never recorded would be a lie.
|
|
202
203
|
* Absence is the honest answer.
|
|
203
204
|
*/
|
|
204
|
-
export declare const
|
|
205
|
+
export declare const ClosedPositionLeg: z.ZodObject<{
|
|
205
206
|
asset: z.ZodString;
|
|
206
207
|
side: z.ZodEnum<{
|
|
207
208
|
LONG: "LONG";
|
|
@@ -219,12 +220,12 @@ export declare const ClosedTradeLeg: z.ZodObject<{
|
|
|
219
220
|
exitQuantity: z.ZodString;
|
|
220
221
|
undeterminedSize: z.ZodString;
|
|
221
222
|
}, z.core.$strip>;
|
|
222
|
-
export type
|
|
223
|
+
export type ClosedPositionLeg = z.output<typeof ClosedPositionLeg>;
|
|
223
224
|
/**
|
|
224
|
-
* One closed position, composed server-side into the
|
|
225
|
+
* One closed position, composed server-side into the history row a trader recognises:
|
|
225
226
|
* what it earned, what it cost, and what each leg did.
|
|
226
227
|
*/
|
|
227
|
-
export declare const
|
|
228
|
+
export declare const ClosedPosition: z.ZodObject<{
|
|
228
229
|
positionId: z.ZodUUID;
|
|
229
230
|
connector: z.ZodEnum<{
|
|
230
231
|
hyperliquid: "hyperliquid";
|
|
@@ -233,6 +234,7 @@ export declare const ClosedTrade: z.ZodObject<{
|
|
|
233
234
|
okx: "okx";
|
|
234
235
|
lighter: "lighter";
|
|
235
236
|
}>;
|
|
237
|
+
status: z.ZodLiteral<"CLOSED">;
|
|
236
238
|
openedAt: z.ZodString;
|
|
237
239
|
closedAt: z.ZodString;
|
|
238
240
|
closedReason: z.ZodOptional<z.ZodEnum<{
|
|
@@ -317,4 +319,137 @@ export declare const ClosedTrade: z.ZodObject<{
|
|
|
317
319
|
}, z.core.$strip>], "kind">>;
|
|
318
320
|
}, z.core.$strip>>>;
|
|
319
321
|
}, z.core.$strip>;
|
|
320
|
-
export type
|
|
322
|
+
export type ClosedPosition = z.output<typeof ClosedPosition>;
|
|
323
|
+
/**
|
|
324
|
+
* What one leg of an open basket has booked, and what it still holds.
|
|
325
|
+
*
|
|
326
|
+
* Split on the only axis that exists here: `realized` describes quantity the ledger has
|
|
327
|
+
* already closed, `remaining` the quantity it still carries. Fees and funding stay flat
|
|
328
|
+
* because they are neither — both are charged across the leg's whole life, on entry fills
|
|
329
|
+
* as well as exit ones, so nesting them under `realized` would misreport what they cover.
|
|
330
|
+
*
|
|
331
|
+
* `remaining` holds no PnL — which is why it is not named `unrealized`. This endpoint
|
|
332
|
+
* reads no mark price by design, so it reports the inputs an unrealized figure is
|
|
333
|
+
* computed from — size and basis — and leaves the marking to a caller that has a price.
|
|
334
|
+
*/
|
|
335
|
+
export declare const OpenPositionLeg: z.ZodObject<{
|
|
336
|
+
asset: z.ZodString;
|
|
337
|
+
side: z.ZodEnum<{
|
|
338
|
+
LONG: "LONG";
|
|
339
|
+
SHORT: "SHORT";
|
|
340
|
+
}>;
|
|
341
|
+
realized: z.ZodObject<{
|
|
342
|
+
quantity: z.ZodString;
|
|
343
|
+
unpricedQuantity: z.ZodString;
|
|
344
|
+
exitVwap: z.ZodOptional<z.ZodString>;
|
|
345
|
+
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
346
|
+
netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
347
|
+
}, z.core.$strip>;
|
|
348
|
+
remaining: z.ZodObject<{
|
|
349
|
+
quantity: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
350
|
+
entryVwap: z.ZodOptional<z.ZodString>;
|
|
351
|
+
}, z.core.$strip>;
|
|
352
|
+
totalFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
353
|
+
tradeFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
354
|
+
pearFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
355
|
+
funding: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
356
|
+
}, z.core.$strip>;
|
|
357
|
+
export type OpenPositionLeg = z.output<typeof OpenPositionLeg>;
|
|
358
|
+
/**
|
|
359
|
+
* The realized view of one open position: the part of it that has already been booked,
|
|
360
|
+
* composed server-side from the same math /positions/closed uses.
|
|
361
|
+
*
|
|
362
|
+
* A pure ledger read — no mark price and therefore no unrealized PnL, which
|
|
363
|
+
* /positions and /portfolio's openSnapshot already carry.
|
|
364
|
+
*/
|
|
365
|
+
export declare const OpenPosition: z.ZodObject<{
|
|
366
|
+
positionId: z.ZodUUID;
|
|
367
|
+
connector: z.ZodEnum<{
|
|
368
|
+
hyperliquid: "hyperliquid";
|
|
369
|
+
binance: "binance";
|
|
370
|
+
bybit: "bybit";
|
|
371
|
+
okx: "okx";
|
|
372
|
+
lighter: "lighter";
|
|
373
|
+
}>;
|
|
374
|
+
status: z.ZodLiteral<"OPEN">;
|
|
375
|
+
openedAt: z.ZodString;
|
|
376
|
+
updatedAt: z.ZodString;
|
|
377
|
+
origin: z.ZodEnum<{
|
|
378
|
+
PARTIAL: "PARTIAL";
|
|
379
|
+
PEAR: "PEAR";
|
|
380
|
+
EXTERNAL: "EXTERNAL";
|
|
381
|
+
}>;
|
|
382
|
+
realizedGrossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
383
|
+
netCashflow: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
384
|
+
totalFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
385
|
+
tradeFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
386
|
+
pearFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
387
|
+
totalFunding: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
388
|
+
initialExposureUSD: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>;
|
|
389
|
+
hasSyntheticFills: z.ZodBoolean;
|
|
390
|
+
hasProvisionalFills: z.ZodBoolean;
|
|
391
|
+
unstableHistoricalData: z.ZodBoolean;
|
|
392
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
393
|
+
asset: z.ZodString;
|
|
394
|
+
side: z.ZodEnum<{
|
|
395
|
+
LONG: "LONG";
|
|
396
|
+
SHORT: "SHORT";
|
|
397
|
+
}>;
|
|
398
|
+
realized: z.ZodObject<{
|
|
399
|
+
quantity: z.ZodString;
|
|
400
|
+
unpricedQuantity: z.ZodString;
|
|
401
|
+
exitVwap: z.ZodOptional<z.ZodString>;
|
|
402
|
+
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
403
|
+
netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
404
|
+
}, z.core.$strip>;
|
|
405
|
+
remaining: z.ZodObject<{
|
|
406
|
+
quantity: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
407
|
+
entryVwap: z.ZodOptional<z.ZodString>;
|
|
408
|
+
}, z.core.$strip>;
|
|
409
|
+
totalFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
410
|
+
tradeFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
411
|
+
pearFees: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
412
|
+
funding: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
413
|
+
}, z.core.$strip>>;
|
|
414
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
415
|
+
executionId: z.ZodOptional<z.ZodString>;
|
|
416
|
+
at: z.ZodString;
|
|
417
|
+
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
418
|
+
legs: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
419
|
+
kind: z.ZodLiteral<"INCREASE">;
|
|
420
|
+
asset: z.ZodString;
|
|
421
|
+
side: z.ZodEnum<{
|
|
422
|
+
BUY: "BUY";
|
|
423
|
+
SELL: "SELL";
|
|
424
|
+
}>;
|
|
425
|
+
quantity: z.ZodString;
|
|
426
|
+
price: z.ZodString;
|
|
427
|
+
tradeFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
428
|
+
pearFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
429
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
430
|
+
kind: z.ZodLiteral<"REDUCE">;
|
|
431
|
+
asset: z.ZodString;
|
|
432
|
+
side: z.ZodEnum<{
|
|
433
|
+
BUY: "BUY";
|
|
434
|
+
SELL: "SELL";
|
|
435
|
+
}>;
|
|
436
|
+
quantity: z.ZodString;
|
|
437
|
+
price: z.ZodString;
|
|
438
|
+
entryBasis: z.ZodString;
|
|
439
|
+
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
440
|
+
tradeFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
441
|
+
pearFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
442
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
443
|
+
kind: z.ZodLiteral<"REDUCE_UNPRICED">;
|
|
444
|
+
asset: z.ZodString;
|
|
445
|
+
side: z.ZodEnum<{
|
|
446
|
+
BUY: "BUY";
|
|
447
|
+
SELL: "SELL";
|
|
448
|
+
}>;
|
|
449
|
+
quantity: z.ZodString;
|
|
450
|
+
tradeFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
451
|
+
pearFee: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
452
|
+
}, z.core.$strip>], "kind">>;
|
|
453
|
+
}, z.core.$strip>>>;
|
|
454
|
+
}, z.core.$strip>;
|
|
455
|
+
export type OpenPosition = z.output<typeof OpenPosition>;
|