@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.
- 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/users/entities.d.ts +2 -0
- package/dist/users/entities.js +3 -1
- package/dist/users/response.d.ts +2 -0
- package/dist/users/response.js +2 -0
- package/package.json +1 -1
|
@@ -1,203 +1,160 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const NullableNumber: z.ZodNullable<z.ZodNumber>;
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
export declare const PortfolioCashflowAmounts: 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
|
+
}, z.core.$strip>;
|
|
12
|
+
export type PortfolioCashflowAmounts = z.output<typeof PortfolioCashflowAmounts>;
|
|
13
|
+
export declare const PortfolioCashflowSeriesPoint: 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
|
+
export type PortfolioCashflowSeriesPoint = z.output<typeof PortfolioCashflowSeriesPoint>;
|
|
25
|
+
export declare const PortfolioCashflowIntervals: z.ZodObject<{
|
|
26
|
+
oneDay: z.ZodArray<z.ZodObject<{
|
|
27
|
+
grossPnl: z.ZodNumber;
|
|
28
|
+
tradeFees: z.ZodNumber;
|
|
29
|
+
pearFees: z.ZodNumber;
|
|
30
|
+
netCashflow: z.ZodNumber;
|
|
31
|
+
funding: z.ZodNumber;
|
|
32
|
+
netCashflowWithFunding: z.ZodNumber;
|
|
33
|
+
undeterminedQuantityByAsset: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
34
|
+
periodStart: z.ZodString;
|
|
35
|
+
periodEnd: z.ZodString;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
oneWeek: z.ZodArray<z.ZodObject<{
|
|
38
|
+
grossPnl: z.ZodNumber;
|
|
39
|
+
tradeFees: z.ZodNumber;
|
|
40
|
+
pearFees: z.ZodNumber;
|
|
41
|
+
netCashflow: z.ZodNumber;
|
|
42
|
+
funding: z.ZodNumber;
|
|
43
|
+
netCashflowWithFunding: z.ZodNumber;
|
|
44
|
+
undeterminedQuantityByAsset: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
45
|
+
periodStart: z.ZodString;
|
|
46
|
+
periodEnd: z.ZodString;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
oneMonth: z.ZodArray<z.ZodObject<{
|
|
49
|
+
grossPnl: z.ZodNumber;
|
|
50
|
+
tradeFees: z.ZodNumber;
|
|
51
|
+
pearFees: z.ZodNumber;
|
|
52
|
+
netCashflow: z.ZodNumber;
|
|
53
|
+
funding: z.ZodNumber;
|
|
54
|
+
netCashflowWithFunding: z.ZodNumber;
|
|
55
|
+
undeterminedQuantityByAsset: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
56
|
+
periodStart: z.ZodString;
|
|
57
|
+
periodEnd: z.ZodString;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
oneYear: z.ZodArray<z.ZodObject<{
|
|
60
|
+
grossPnl: z.ZodNumber;
|
|
61
|
+
tradeFees: z.ZodNumber;
|
|
62
|
+
pearFees: z.ZodNumber;
|
|
63
|
+
netCashflow: z.ZodNumber;
|
|
64
|
+
funding: z.ZodNumber;
|
|
65
|
+
netCashflowWithFunding: z.ZodNumber;
|
|
66
|
+
undeterminedQuantityByAsset: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
67
|
+
periodStart: z.ZodString;
|
|
68
|
+
periodEnd: z.ZodString;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
all: z.ZodArray<z.ZodObject<{
|
|
71
|
+
grossPnl: z.ZodNumber;
|
|
72
|
+
tradeFees: z.ZodNumber;
|
|
73
|
+
pearFees: z.ZodNumber;
|
|
74
|
+
netCashflow: z.ZodNumber;
|
|
75
|
+
funding: z.ZodNumber;
|
|
76
|
+
netCashflowWithFunding: z.ZodNumber;
|
|
77
|
+
undeterminedQuantityByAsset: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
78
|
+
periodStart: z.ZodString;
|
|
79
|
+
periodEnd: z.ZodString;
|
|
80
|
+
}, z.core.$strip>>;
|
|
15
81
|
}, z.core.$strip>;
|
|
16
|
-
export type
|
|
17
|
-
export declare const
|
|
82
|
+
export type PortfolioCashflowIntervals = z.output<typeof PortfolioCashflowIntervals>;
|
|
83
|
+
export declare const PortfolioVolumeAmounts: z.ZodObject<{
|
|
84
|
+
total: z.ZodNumber;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
export type PortfolioVolumeAmounts = z.output<typeof PortfolioVolumeAmounts>;
|
|
87
|
+
export declare const PortfolioVolumeSeriesPoint: z.ZodObject<{
|
|
18
88
|
periodStart: z.ZodString;
|
|
19
89
|
periodEnd: z.ZodString;
|
|
20
90
|
volume: z.ZodNumber;
|
|
21
|
-
openInterest: z.ZodNumber;
|
|
22
|
-
winningTradesCount: z.ZodNumber;
|
|
23
|
-
winningTradesUsd: z.ZodNumber;
|
|
24
|
-
losingTradesCount: z.ZodNumber;
|
|
25
|
-
losingTradesUsd: z.ZodNumber;
|
|
26
91
|
}, z.core.$strip>;
|
|
27
|
-
export type
|
|
28
|
-
export declare const
|
|
92
|
+
export type PortfolioVolumeSeriesPoint = z.output<typeof PortfolioVolumeSeriesPoint>;
|
|
93
|
+
export declare const PortfolioVolumeIntervals: z.ZodObject<{
|
|
29
94
|
oneDay: z.ZodArray<z.ZodObject<{
|
|
30
95
|
periodStart: z.ZodString;
|
|
31
96
|
periodEnd: z.ZodString;
|
|
32
97
|
volume: z.ZodNumber;
|
|
33
|
-
openInterest: z.ZodNumber;
|
|
34
|
-
winningTradesCount: z.ZodNumber;
|
|
35
|
-
winningTradesUsd: z.ZodNumber;
|
|
36
|
-
losingTradesCount: z.ZodNumber;
|
|
37
|
-
losingTradesUsd: z.ZodNumber;
|
|
38
98
|
}, z.core.$strip>>;
|
|
39
99
|
oneWeek: z.ZodArray<z.ZodObject<{
|
|
40
100
|
periodStart: z.ZodString;
|
|
41
101
|
periodEnd: z.ZodString;
|
|
42
102
|
volume: z.ZodNumber;
|
|
43
|
-
openInterest: z.ZodNumber;
|
|
44
|
-
winningTradesCount: z.ZodNumber;
|
|
45
|
-
winningTradesUsd: z.ZodNumber;
|
|
46
|
-
losingTradesCount: z.ZodNumber;
|
|
47
|
-
losingTradesUsd: z.ZodNumber;
|
|
48
103
|
}, z.core.$strip>>;
|
|
49
104
|
oneMonth: z.ZodArray<z.ZodObject<{
|
|
50
105
|
periodStart: z.ZodString;
|
|
51
106
|
periodEnd: z.ZodString;
|
|
52
107
|
volume: z.ZodNumber;
|
|
53
|
-
openInterest: z.ZodNumber;
|
|
54
|
-
winningTradesCount: z.ZodNumber;
|
|
55
|
-
winningTradesUsd: z.ZodNumber;
|
|
56
|
-
losingTradesCount: z.ZodNumber;
|
|
57
|
-
losingTradesUsd: z.ZodNumber;
|
|
58
108
|
}, z.core.$strip>>;
|
|
59
109
|
oneYear: z.ZodArray<z.ZodObject<{
|
|
60
110
|
periodStart: z.ZodString;
|
|
61
111
|
periodEnd: z.ZodString;
|
|
62
112
|
volume: z.ZodNumber;
|
|
63
|
-
openInterest: z.ZodNumber;
|
|
64
|
-
winningTradesCount: z.ZodNumber;
|
|
65
|
-
winningTradesUsd: z.ZodNumber;
|
|
66
|
-
losingTradesCount: z.ZodNumber;
|
|
67
|
-
losingTradesUsd: z.ZodNumber;
|
|
68
113
|
}, z.core.$strip>>;
|
|
69
114
|
all: z.ZodArray<z.ZodObject<{
|
|
70
115
|
periodStart: z.ZodString;
|
|
71
116
|
periodEnd: z.ZodString;
|
|
72
117
|
volume: z.ZodNumber;
|
|
73
|
-
openInterest: z.ZodNumber;
|
|
74
|
-
winningTradesCount: z.ZodNumber;
|
|
75
|
-
winningTradesUsd: z.ZodNumber;
|
|
76
|
-
losingTradesCount: z.ZodNumber;
|
|
77
|
-
losingTradesUsd: z.ZodNumber;
|
|
78
118
|
}, z.core.$strip>>;
|
|
79
119
|
}, z.core.$strip>;
|
|
80
|
-
export type
|
|
81
|
-
export declare const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
currentOpenInterest: z.ZodNumber;
|
|
87
|
-
currentTotalVolume: z.ZodNumber;
|
|
88
|
-
unrealizedPnl: z.ZodNumber;
|
|
89
|
-
realizedPnl: z.ZodNumber;
|
|
90
|
-
totalFees: z.ZodNumber;
|
|
91
|
-
totalTrades: z.ZodNumber;
|
|
92
|
-
}, z.core.$strip>;
|
|
93
|
-
export type PortfolioOverall = z.output<typeof PortfolioOverall>;
|
|
94
|
-
export declare const PortfolioMetrics: z.ZodObject<{
|
|
95
|
-
realizedOnly: z.ZodObject<{
|
|
96
|
-
pnlAbsolute: z.ZodNumber;
|
|
97
|
-
pnlPercent: z.ZodNullable<z.ZodNumber>;
|
|
98
|
-
hitRate: z.ZodNullable<z.ZodNumber>;
|
|
99
|
-
profitFactor: z.ZodNullable<z.ZodNumber>;
|
|
100
|
-
avgWinSize: z.ZodNullable<z.ZodNumber>;
|
|
101
|
-
avgLossSize: z.ZodNullable<z.ZodNumber>;
|
|
102
|
-
avgReturnPerWin: z.ZodNullable<z.ZodNumber>;
|
|
103
|
-
avgReturnPerLoss: z.ZodNullable<z.ZodNumber>;
|
|
104
|
-
maxDrawdown: z.ZodNullable<z.ZodNumber>;
|
|
105
|
-
sharpeRatio: z.ZodNullable<z.ZodNumber>;
|
|
106
|
-
sortinoRatio: z.ZodNullable<z.ZodNumber>;
|
|
107
|
-
}, z.core.$strip>;
|
|
108
|
-
realizedPlusUnrealized: z.ZodObject<{
|
|
109
|
-
pnlAbsolute: z.ZodNumber;
|
|
110
|
-
pnlPercent: z.ZodNullable<z.ZodNumber>;
|
|
111
|
-
hitRate: z.ZodNullable<z.ZodNumber>;
|
|
112
|
-
profitFactor: z.ZodNullable<z.ZodNumber>;
|
|
113
|
-
avgWinSize: z.ZodNullable<z.ZodNumber>;
|
|
114
|
-
avgLossSize: z.ZodNullable<z.ZodNumber>;
|
|
115
|
-
avgReturnPerWin: z.ZodNullable<z.ZodNumber>;
|
|
116
|
-
avgReturnPerLoss: z.ZodNullable<z.ZodNumber>;
|
|
117
|
-
maxDrawdown: z.ZodNullable<z.ZodNumber>;
|
|
118
|
-
sharpeRatio: z.ZodNullable<z.ZodNumber>;
|
|
119
|
-
sortinoRatio: z.ZodNullable<z.ZodNumber>;
|
|
120
|
-
}, z.core.$strip>;
|
|
121
|
-
realizedHitRate: z.ZodNullable<z.ZodNumber>;
|
|
120
|
+
export type PortfolioVolumeIntervals = z.output<typeof PortfolioVolumeIntervals>;
|
|
121
|
+
export declare const PortfolioClosedPositionStats: z.ZodObject<{
|
|
122
|
+
totalPositions: z.ZodNumber;
|
|
123
|
+
wins: z.ZodNumber;
|
|
124
|
+
losses: z.ZodNumber;
|
|
125
|
+
hitRate: z.ZodNullable<z.ZodNumber>;
|
|
122
126
|
profitFactor: z.ZodNullable<z.ZodNumber>;
|
|
123
127
|
avgWinSize: z.ZodNullable<z.ZodNumber>;
|
|
124
128
|
avgLossSize: z.ZodNullable<z.ZodNumber>;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
export type PortfolioMetrics = z.output<typeof PortfolioMetrics>;
|
|
129
|
-
export declare const PortfolioAssetAnalytics: z.ZodObject<{
|
|
130
|
-
asset: z.ZodString;
|
|
131
|
-
realizedOnly: z.ZodObject<{
|
|
132
|
-
pnlAbsolute: z.ZodNumber;
|
|
133
|
-
pnlPercent: z.ZodNullable<z.ZodNumber>;
|
|
134
|
-
hitRate: z.ZodNullable<z.ZodNumber>;
|
|
135
|
-
profitFactor: z.ZodNullable<z.ZodNumber>;
|
|
136
|
-
avgWinSize: z.ZodNullable<z.ZodNumber>;
|
|
137
|
-
avgLossSize: z.ZodNullable<z.ZodNumber>;
|
|
138
|
-
avgReturnPerWin: z.ZodNullable<z.ZodNumber>;
|
|
139
|
-
avgReturnPerLoss: z.ZodNullable<z.ZodNumber>;
|
|
140
|
-
maxDrawdown: z.ZodNullable<z.ZodNumber>;
|
|
141
|
-
sharpeRatio: z.ZodNullable<z.ZodNumber>;
|
|
142
|
-
sortinoRatio: z.ZodNullable<z.ZodNumber>;
|
|
143
|
-
}, z.core.$strip>;
|
|
144
|
-
realizedPlusUnrealized: z.ZodObject<{
|
|
145
|
-
pnlAbsolute: z.ZodNumber;
|
|
146
|
-
pnlPercent: z.ZodNullable<z.ZodNumber>;
|
|
147
|
-
hitRate: z.ZodNullable<z.ZodNumber>;
|
|
148
|
-
profitFactor: z.ZodNullable<z.ZodNumber>;
|
|
149
|
-
avgWinSize: z.ZodNullable<z.ZodNumber>;
|
|
150
|
-
avgLossSize: z.ZodNullable<z.ZodNumber>;
|
|
151
|
-
avgReturnPerWin: z.ZodNullable<z.ZodNumber>;
|
|
152
|
-
avgReturnPerLoss: z.ZodNullable<z.ZodNumber>;
|
|
153
|
-
maxDrawdown: z.ZodNullable<z.ZodNumber>;
|
|
154
|
-
sharpeRatio: z.ZodNullable<z.ZodNumber>;
|
|
155
|
-
sortinoRatio: z.ZodNullable<z.ZodNumber>;
|
|
156
|
-
}, z.core.$strip>;
|
|
157
|
-
unrealizedReturnPerDay: z.ZodNullable<z.ZodNumber>;
|
|
129
|
+
netPnl: z.ZodNumber;
|
|
130
|
+
positionPnls: z.ZodArray<z.ZodNumber>;
|
|
131
|
+
positionReturns: z.ZodArray<z.ZodNumber>;
|
|
158
132
|
}, z.core.$strip>;
|
|
159
|
-
export type
|
|
133
|
+
export type PortfolioClosedPositionStats = z.output<typeof PortfolioClosedPositionStats>;
|
|
160
134
|
export declare const PortfolioPairBreakdown: z.ZodObject<{
|
|
161
135
|
key: z.ZodString;
|
|
162
136
|
longAssets: z.ZodArray<z.ZodString>;
|
|
163
137
|
shortAssets: z.ZodArray<z.ZodString>;
|
|
164
|
-
|
|
138
|
+
positions: z.ZodNumber;
|
|
165
139
|
wins: z.ZodNumber;
|
|
166
140
|
losses: z.ZodNumber;
|
|
167
141
|
hitRate: z.ZodNullable<z.ZodNumber>;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
142
|
+
profitFactor: z.ZodNullable<z.ZodNumber>;
|
|
143
|
+
expectancy: z.ZodNumber;
|
|
144
|
+
grossPnl: z.ZodNumber;
|
|
145
|
+
tradeFees: z.ZodNumber;
|
|
146
|
+
pearFees: z.ZodNumber;
|
|
147
|
+
netPnl: z.ZodNumber;
|
|
172
148
|
bookPercent: z.ZodNullable<z.ZodNumber>;
|
|
173
149
|
}, z.core.$strip>;
|
|
174
150
|
export type PortfolioPairBreakdown = z.output<typeof PortfolioPairBreakdown>;
|
|
175
|
-
export declare const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
wins: z.ZodNumber;
|
|
179
|
-
losses: z.ZodNumber;
|
|
180
|
-
dayPnl: z.ZodNumber;
|
|
181
|
-
dayVolume: z.ZodNumber;
|
|
182
|
-
dayFunding: z.ZodNumber;
|
|
183
|
-
dayNetPnl: z.ZodNumber;
|
|
184
|
-
hitRate: z.ZodNullable<z.ZodNumber>;
|
|
185
|
-
winLossRatio: z.ZodNullable<z.ZodNumber>;
|
|
186
|
-
rollingHitRate: z.ZodNullable<z.ZodNumber>;
|
|
187
|
-
rollingWinLossRatio: z.ZodNullable<z.ZodNumber>;
|
|
188
|
-
dailyReturn: z.ZodNullable<z.ZodNumber>;
|
|
189
|
-
cumulativeReturn: z.ZodNumber;
|
|
190
|
-
equity: z.ZodNumber;
|
|
191
|
-
drawdown: z.ZodNumber;
|
|
192
|
-
rollingSharpe: z.ZodNullable<z.ZodNumber>;
|
|
193
|
-
rollingSortino: z.ZodNullable<z.ZodNumber>;
|
|
194
|
-
rollingVolatility: z.ZodNullable<z.ZodNumber>;
|
|
151
|
+
export declare const PortfolioOpenSnapshot: z.ZodObject<{
|
|
152
|
+
openInterest: z.ZodNumber;
|
|
153
|
+
unrealizedPnl: z.ZodNumber;
|
|
195
154
|
}, z.core.$strip>;
|
|
196
|
-
export type
|
|
155
|
+
export type PortfolioOpenSnapshot = z.output<typeof PortfolioOpenSnapshot>;
|
|
197
156
|
export declare const PortfolioAnalyticsConfig: z.ZodObject<{
|
|
198
|
-
rollingWindowDays: z.ZodNumber;
|
|
199
157
|
startDate: z.ZodString;
|
|
200
158
|
endDate: z.ZodString;
|
|
201
|
-
fundingSynced: z.ZodBoolean;
|
|
202
159
|
}, z.core.$strip>;
|
|
203
160
|
export type PortfolioAnalyticsConfig = z.output<typeof PortfolioAnalyticsConfig>;
|
|
@@ -1,109 +1,77 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
const NullableNumber = z.number().nullable();
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
avgReturnPerLoss: NullableNumber,
|
|
13
|
-
maxDrawdown: NullableNumber,
|
|
14
|
-
sharpeRatio: NullableNumber,
|
|
15
|
-
sortinoRatio: NullableNumber
|
|
4
|
+
const PortfolioCashflowAmounts = z.object({
|
|
5
|
+
grossPnl: z.number(),
|
|
6
|
+
tradeFees: z.number(),
|
|
7
|
+
pearFees: z.number(),
|
|
8
|
+
netCashflow: z.number(),
|
|
9
|
+
funding: z.number(),
|
|
10
|
+
netCashflowWithFunding: z.number(),
|
|
11
|
+
undeterminedQuantityByAsset: z.record(z.string(), z.number())
|
|
16
12
|
});
|
|
17
|
-
const
|
|
13
|
+
const PortfolioCashflowSeriesPoint = PortfolioCashflowAmounts.extend({
|
|
18
14
|
periodStart: z.string(),
|
|
19
|
-
periodEnd: z.string()
|
|
20
|
-
volume: z.number(),
|
|
21
|
-
openInterest: z.number(),
|
|
22
|
-
winningTradesCount: z.number(),
|
|
23
|
-
winningTradesUsd: z.number(),
|
|
24
|
-
losingTradesCount: z.number(),
|
|
25
|
-
losingTradesUsd: z.number()
|
|
15
|
+
periodEnd: z.string()
|
|
26
16
|
});
|
|
27
|
-
const
|
|
28
|
-
oneDay: z.array(
|
|
29
|
-
oneWeek: z.array(
|
|
30
|
-
oneMonth: z.array(
|
|
31
|
-
oneYear: z.array(
|
|
32
|
-
all: z.array(
|
|
17
|
+
const PortfolioCashflowIntervals = z.object({
|
|
18
|
+
oneDay: z.array(PortfolioCashflowSeriesPoint),
|
|
19
|
+
oneWeek: z.array(PortfolioCashflowSeriesPoint),
|
|
20
|
+
oneMonth: z.array(PortfolioCashflowSeriesPoint),
|
|
21
|
+
oneYear: z.array(PortfolioCashflowSeriesPoint),
|
|
22
|
+
all: z.array(PortfolioCashflowSeriesPoint)
|
|
33
23
|
});
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
totalLosingTradesCount: z.number(),
|
|
37
|
-
totalWinningUsd: z.number(),
|
|
38
|
-
totalLosingUsd: z.number(),
|
|
39
|
-
currentOpenInterest: z.number(),
|
|
40
|
-
currentTotalVolume: z.number(),
|
|
41
|
-
unrealizedPnl: z.number(),
|
|
42
|
-
realizedPnl: z.number(),
|
|
43
|
-
totalFees: z.number(),
|
|
44
|
-
totalTrades: z.number()
|
|
24
|
+
const PortfolioVolumeAmounts = z.object({
|
|
25
|
+
total: z.number()
|
|
45
26
|
});
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
27
|
+
const PortfolioVolumeSeriesPoint = z.object({
|
|
28
|
+
periodStart: z.string(),
|
|
29
|
+
periodEnd: z.string(),
|
|
30
|
+
volume: z.number()
|
|
31
|
+
});
|
|
32
|
+
const PortfolioVolumeIntervals = z.object({
|
|
33
|
+
oneDay: z.array(PortfolioVolumeSeriesPoint),
|
|
34
|
+
oneWeek: z.array(PortfolioVolumeSeriesPoint),
|
|
35
|
+
oneMonth: z.array(PortfolioVolumeSeriesPoint),
|
|
36
|
+
oneYear: z.array(PortfolioVolumeSeriesPoint),
|
|
37
|
+
all: z.array(PortfolioVolumeSeriesPoint)
|
|
38
|
+
});
|
|
39
|
+
const PortfolioClosedPositionStats = z.object({
|
|
40
|
+
totalPositions: z.number(),
|
|
41
|
+
wins: z.number(),
|
|
42
|
+
losses: z.number(),
|
|
43
|
+
hitRate: NullableNumber,
|
|
50
44
|
profitFactor: NullableNumber,
|
|
51
45
|
avgWinSize: NullableNumber,
|
|
52
46
|
avgLossSize: NullableNumber,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const PortfolioAssetAnalytics = z.object({
|
|
57
|
-
asset: z.string(),
|
|
58
|
-
realizedOnly: PortfolioMetricVariant,
|
|
59
|
-
realizedPlusUnrealized: PortfolioMetricVariant,
|
|
60
|
-
unrealizedReturnPerDay: NullableNumber
|
|
47
|
+
netPnl: z.number(),
|
|
48
|
+
positionPnls: z.array(z.number()),
|
|
49
|
+
positionReturns: z.array(z.number())
|
|
61
50
|
});
|
|
62
51
|
const PortfolioPairBreakdown = z.object({
|
|
63
52
|
key: z.string(),
|
|
64
53
|
longAssets: z.array(z.string()),
|
|
65
54
|
shortAssets: z.array(z.string()),
|
|
66
|
-
|
|
55
|
+
positions: z.number(),
|
|
67
56
|
wins: z.number(),
|
|
68
57
|
losses: z.number(),
|
|
69
58
|
hitRate: NullableNumber,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
profitFactor: NullableNumber,
|
|
60
|
+
expectancy: z.number(),
|
|
61
|
+
grossPnl: z.number(),
|
|
62
|
+
tradeFees: z.number(),
|
|
63
|
+
pearFees: z.number(),
|
|
64
|
+
netPnl: z.number(),
|
|
65
|
+
// Signed share of closed-position net PnL; null when the closed book is zero.
|
|
74
66
|
bookPercent: NullableNumber
|
|
75
67
|
});
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
wins: z.number(),
|
|
80
|
-
losses: z.number(),
|
|
81
|
-
dayPnl: z.number(),
|
|
82
|
-
// Fill notional traded that UTC day; honours the query's `source` filter.
|
|
83
|
-
dayVolume: z.number(),
|
|
84
|
-
// Account-level funding accrued that UTC day (signed; negative when the trader paid).
|
|
85
|
-
dayFunding: z.number(),
|
|
86
|
-
// dayPnl plus dayFunding — the figure that reconciles with the trader's exchange statement.
|
|
87
|
-
dayNetPnl: z.number(),
|
|
88
|
-
hitRate: NullableNumber,
|
|
89
|
-
winLossRatio: NullableNumber,
|
|
90
|
-
rollingHitRate: NullableNumber,
|
|
91
|
-
rollingWinLossRatio: NullableNumber,
|
|
92
|
-
dailyReturn: NullableNumber,
|
|
93
|
-
cumulativeReturn: z.number(),
|
|
94
|
-
equity: z.number(),
|
|
95
|
-
drawdown: z.number(),
|
|
96
|
-
rollingSharpe: NullableNumber,
|
|
97
|
-
rollingSortino: NullableNumber,
|
|
98
|
-
rollingVolatility: NullableNumber
|
|
68
|
+
const PortfolioOpenSnapshot = z.object({
|
|
69
|
+
openInterest: z.number(),
|
|
70
|
+
unrealizedPnl: z.number()
|
|
99
71
|
});
|
|
100
72
|
const PortfolioAnalyticsConfig = z.object({
|
|
101
|
-
rollingWindowDays: z.number(),
|
|
102
73
|
startDate: z.string(),
|
|
103
|
-
endDate: z.string()
|
|
104
|
-
// Whether funding history has ever reached the backend for this account. When false, every
|
|
105
|
-
// `dayFunding` is unknown rather than zero. Carries no claim about how recent the sync was.
|
|
106
|
-
fundingSynced: z.boolean()
|
|
74
|
+
endDate: z.string()
|
|
107
75
|
});
|
|
108
76
|
|
|
109
|
-
export { NullableNumber, PortfolioAnalyticsConfig,
|
|
77
|
+
export { NullableNumber, PortfolioAnalyticsConfig, PortfolioCashflowAmounts, PortfolioCashflowIntervals, PortfolioCashflowSeriesPoint, PortfolioClosedPositionStats, PortfolioOpenSnapshot, PortfolioPairBreakdown, PortfolioVolumeAmounts, PortfolioVolumeIntervals, PortfolioVolumeSeriesPoint };
|
|
@@ -32,7 +32,6 @@ export declare const PortfolioAnalyticsQuery: z.ZodObject<{
|
|
|
32
32
|
"1m": "1m";
|
|
33
33
|
"1y": "1y";
|
|
34
34
|
}>>;
|
|
35
|
-
rollingWindowDays: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
36
35
|
includeSeries: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodPipe<z.ZodEnum<{
|
|
37
36
|
false: "false";
|
|
38
37
|
true: "true";
|
|
@@ -5,8 +5,8 @@ const PortfolioSource = z.enum([
|
|
|
5
5
|
"pear"
|
|
6
6
|
]);
|
|
7
7
|
const PortfolioQuery = z.object({
|
|
8
|
-
startDate: z.string().optional(),
|
|
9
|
-
endDate: z.string().optional(),
|
|
8
|
+
startDate: z.string().optional().describe("Inclusive portfolio range start."),
|
|
9
|
+
endDate: z.string().optional().describe("Exclusive portfolio range end."),
|
|
10
10
|
// "pear" excludes external imported fills from volume calculations.
|
|
11
11
|
source: PortfolioSource.optional().default("all")
|
|
12
12
|
});
|
|
@@ -18,10 +18,9 @@ const PortfolioAnalyticsInterval = z.enum([
|
|
|
18
18
|
"all"
|
|
19
19
|
]);
|
|
20
20
|
const PortfolioAnalyticsQuery = z.object({
|
|
21
|
-
startDate: z.string().optional(),
|
|
22
|
-
endDate: z.string().optional(),
|
|
21
|
+
startDate: z.string().optional().describe("Inclusive analytics range start."),
|
|
22
|
+
endDate: z.string().optional().describe("Exclusive analytics range end."),
|
|
23
23
|
interval: PortfolioAnalyticsInterval.optional(),
|
|
24
|
-
rollingWindowDays: z.coerce.number().int().optional(),
|
|
25
24
|
includeSeries: z.union([
|
|
26
25
|
z.boolean(),
|
|
27
26
|
z.enum([
|