@pear-protocol/hyperliquid-sdk 0.0.50 → 0.0.51
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/index.d.ts +3 -0
- package/dist/index.js +1 -3
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -123,6 +123,7 @@ interface TradeHistoryAssetDataDto {
|
|
|
123
123
|
entryWeight: number;
|
|
124
124
|
entryPrice: number;
|
|
125
125
|
limitPrice: number;
|
|
126
|
+
leverage: number;
|
|
126
127
|
size: number;
|
|
127
128
|
externalFeePaid: number;
|
|
128
129
|
builderFeePaid: number;
|
|
@@ -138,6 +139,7 @@ interface TradeHistoryDataDto {
|
|
|
138
139
|
externalFeePaid: number;
|
|
139
140
|
builderFeePaid: number;
|
|
140
141
|
realizedPnl: number;
|
|
142
|
+
realizedPnlPercentage: number;
|
|
141
143
|
totalEntryValue: number;
|
|
142
144
|
totalValue: number;
|
|
143
145
|
entryRatio: number;
|
|
@@ -192,6 +194,7 @@ interface OpenPositionDto {
|
|
|
192
194
|
positionValue: number;
|
|
193
195
|
marginUsed: number;
|
|
194
196
|
unrealizedPnl: number;
|
|
197
|
+
unrealizedPnlPercentage: number;
|
|
195
198
|
longAssets: PositionAssetDetailDto[];
|
|
196
199
|
shortAssets: PositionAssetDetailDto[];
|
|
197
200
|
createdAt: string;
|
package/dist/index.js
CHANGED
|
@@ -6386,17 +6386,15 @@ const buildPositionValue = (rawPositions, clearinghouseState, allMids) => {
|
|
|
6386
6386
|
return mappedPositionAssets;
|
|
6387
6387
|
});
|
|
6388
6388
|
mappedPosition.positionValue = mappedPosition.entryPositionValue + mappedPosition.unrealizedPnl;
|
|
6389
|
-
// If exactly one long and one short asset, include simple price ratios
|
|
6390
6389
|
if (position.longAssets.length === 1 && position.shortAssets.length === 1) {
|
|
6391
6390
|
const long = position.longAssets[0];
|
|
6392
6391
|
const short = position.shortAssets[0];
|
|
6393
6392
|
const longMark = parseFloat(allMids.mids[long.coin]);
|
|
6394
6393
|
const shortMark = parseFloat(allMids.mids[short.coin]);
|
|
6395
|
-
// entryPriceRatio = long entry price / short entry price
|
|
6396
6394
|
mappedPosition.entryPriceRatio = long.entryPrice / short.entryPrice;
|
|
6397
|
-
// markPriceRatio = long current price / short current price
|
|
6398
6395
|
mappedPosition.markPriceRatio = longMark / shortMark;
|
|
6399
6396
|
}
|
|
6397
|
+
mappedPosition.unrealizedPnlPercentage = mappedPosition.unrealizedPnl / mappedPosition.marginUsed;
|
|
6400
6398
|
return mappedPosition;
|
|
6401
6399
|
});
|
|
6402
6400
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -152,6 +152,7 @@ export interface TradeHistoryAssetDataDto {
|
|
|
152
152
|
entryWeight: number;
|
|
153
153
|
entryPrice: number;
|
|
154
154
|
limitPrice: number;
|
|
155
|
+
leverage: number;
|
|
155
156
|
size: number;
|
|
156
157
|
externalFeePaid: number;
|
|
157
158
|
builderFeePaid: number;
|
|
@@ -167,6 +168,7 @@ export interface TradeHistoryDataDto {
|
|
|
167
168
|
externalFeePaid: number;
|
|
168
169
|
builderFeePaid: number;
|
|
169
170
|
realizedPnl: number;
|
|
171
|
+
realizedPnlPercentage: number;
|
|
170
172
|
totalEntryValue: number;
|
|
171
173
|
totalValue: number;
|
|
172
174
|
entryRatio: number;
|
|
@@ -221,6 +223,7 @@ export interface OpenPositionDto {
|
|
|
221
223
|
positionValue: number;
|
|
222
224
|
marginUsed: number;
|
|
223
225
|
unrealizedPnl: number;
|
|
226
|
+
unrealizedPnlPercentage: number;
|
|
224
227
|
longAssets: PositionAssetDetailDto[];
|
|
225
228
|
shortAssets: PositionAssetDetailDto[];
|
|
226
229
|
createdAt: string;
|