@gainsnetwork/sdk 1.8.8-rc2 → 1.8.8-rc4

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.
@@ -287,6 +287,7 @@ export interface UserTradingVariablesBackend {
287
287
  cumulVolPriceImpactMultiplier: string;
288
288
  fixedSpreadP: string;
289
289
  }>;
290
+ referrer: string;
290
291
  }
291
292
  export type OpenTradeInfo = {
292
293
  tradeId: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="mocha" />
2
1
  import type { GNSMultiCollatDiamond } from "../../../contracts/types/generated";
3
2
  import { BorrowingFeeV2 } from ".";
4
3
  /**
@@ -271,8 +271,11 @@ const getPriceForTargetPnlPercentage = (targetPnlPercent, trade, tradeInfo, cont
271
271
  const totalHoldingFees = fees.fundingFeeCollateral +
272
272
  fees.borrowingFeeCollateral +
273
273
  fees.borrowingFeeCollateral_old;
274
+ const { totalRealizedPnlCollateral } = context.tradeData?.tradeFeesData
275
+ ? (0, exports.getTradeRealizedPnlCollateral)(context.tradeData.tradeFeesData)
276
+ : { totalRealizedPnlCollateral: 0 };
274
277
  const targetPnlInCollateral = (collateralAmount * targetPnlPercent) / 100;
275
- let targetPnlGross = targetPnlInCollateral + totalHoldingFees;
278
+ let targetPnlGross = targetPnlInCollateral + totalHoldingFees - totalRealizedPnlCollateral;
276
279
  if (netPnl) {
277
280
  // Include closing fees
278
281
  const closingFee = (0, trading_1.getTotalTradeFeesCollateral)(trade.collateralIndex, trade.user, trade.pairIndex, positionSizeCollateral, trade.isCounterTrade || false, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gainsnetwork/sdk",
3
- "version": "1.8.8-rc2",
3
+ "version": "1.8.8-rc4",
4
4
  "description": "Gains Network SDK",
5
5
  "main": "./lib/index.js",
6
6
  "files": [