@pear-protocol/hyperliquid-sdk 0.0.70 → 0.0.71
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.js +12 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6701,8 +6701,18 @@ const buildPositionValue = (rawPositions, clearinghouseState, allMids) => {
|
|
|
6701
6701
|
const short = position.shortAssets[0];
|
|
6702
6702
|
const longMark = parseFloat(allMids.mids[long.coin]);
|
|
6703
6703
|
const shortMark = parseFloat(allMids.mids[short.coin]);
|
|
6704
|
-
|
|
6705
|
-
|
|
6704
|
+
if (long.size > 0 && short.size > 0) {
|
|
6705
|
+
mappedPosition.entryPriceRatio = long.entryPrice / short.entryPrice;
|
|
6706
|
+
mappedPosition.markPriceRatio = longMark / shortMark;
|
|
6707
|
+
}
|
|
6708
|
+
else if (long.size > 0) {
|
|
6709
|
+
mappedPosition.entryPriceRatio = long.entryPrice;
|
|
6710
|
+
mappedPosition.markPriceRatio = longMark;
|
|
6711
|
+
}
|
|
6712
|
+
else if (short.size > 0) {
|
|
6713
|
+
mappedPosition.entryPriceRatio = short.entryPrice;
|
|
6714
|
+
mappedPosition.markPriceRatio = shortMark;
|
|
6715
|
+
}
|
|
6706
6716
|
}
|
|
6707
6717
|
if (position.longAssets.length === 1 && position.shortAssets.length === 0) {
|
|
6708
6718
|
const long = position.longAssets[0];
|