@drift-labs/sdk-browser 2.108.0-beta.17 → 2.108.0-beta.18
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/VERSION +1 -1
- package/lib/browser/user.js +1 -1
- package/lib/node/user.js +1 -1
- package/package.json +1 -1
- package/src/user.ts +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.108.0-beta.
|
|
1
|
+
2.108.0-beta.18
|
package/lib/browser/user.js
CHANGED
|
@@ -528,7 +528,7 @@ class User {
|
|
|
528
528
|
.mul((0, _1.calculateUnrealizedAssetWeight)(market, quoteSpotMarket, positionUnrealizedPnl, withWeightMarginCategory, oraclePriceData))
|
|
529
529
|
.div(new _1.BN(numericConstants_1.SPOT_MARKET_WEIGHT_PRECISION));
|
|
530
530
|
}
|
|
531
|
-
if (positionUnrealizedPnl.lt(numericConstants_1.ZERO)) {
|
|
531
|
+
if (liquidationBuffer && positionUnrealizedPnl.lt(numericConstants_1.ZERO)) {
|
|
532
532
|
positionUnrealizedPnl = positionUnrealizedPnl.add(positionUnrealizedPnl.mul(liquidationBuffer).div(numericConstants_1.MARGIN_PRECISION));
|
|
533
533
|
}
|
|
534
534
|
}
|
package/lib/node/user.js
CHANGED
|
@@ -528,7 +528,7 @@ class User {
|
|
|
528
528
|
.mul((0, _1.calculateUnrealizedAssetWeight)(market, quoteSpotMarket, positionUnrealizedPnl, withWeightMarginCategory, oraclePriceData))
|
|
529
529
|
.div(new _1.BN(numericConstants_1.SPOT_MARKET_WEIGHT_PRECISION));
|
|
530
530
|
}
|
|
531
|
-
if (positionUnrealizedPnl.lt(numericConstants_1.ZERO)) {
|
|
531
|
+
if (liquidationBuffer && positionUnrealizedPnl.lt(numericConstants_1.ZERO)) {
|
|
532
532
|
positionUnrealizedPnl = positionUnrealizedPnl.add(positionUnrealizedPnl.mul(liquidationBuffer).div(numericConstants_1.MARGIN_PRECISION));
|
|
533
533
|
}
|
|
534
534
|
}
|
package/package.json
CHANGED
package/src/user.ts
CHANGED
|
@@ -876,7 +876,7 @@ export class User {
|
|
|
876
876
|
.div(new BN(SPOT_MARKET_WEIGHT_PRECISION));
|
|
877
877
|
}
|
|
878
878
|
|
|
879
|
-
if (positionUnrealizedPnl.lt(ZERO)) {
|
|
879
|
+
if (liquidationBuffer && positionUnrealizedPnl.lt(ZERO)) {
|
|
880
880
|
positionUnrealizedPnl = positionUnrealizedPnl.add(
|
|
881
881
|
positionUnrealizedPnl.mul(liquidationBuffer).div(MARGIN_PRECISION)
|
|
882
882
|
);
|