diff --git a/common-ts/src/common-ui-utils/user.ts b/common-ts/src/common-ui-utils/user.ts index eb17cbdf..fc57f1cf 100644 --- a/common-ts/src/common-ui-utils/user.ts +++ b/common-ts/src/common-ui-utils/user.ts @@ -14,6 +14,7 @@ import { calculateClaimablePnl, calculateCostBasis, calculateEntryPrice, + calculateFeesAndFundingPnl, calculatePositionFundingPNL, calculatePositionPNL, isOracleValid, @@ -151,6 +152,11 @@ const getOpenPositionData = ( perpMarket, perpPositionWithLpSettle ), + // Includes both settled and unsettled funding as well as fees + feesAndFundingPnl: calculateFeesAndFundingPnl( + perpMarket, + perpPositionWithLpSettle + ), totalUnrealizedPnl: calculatePositionPNL( perpMarket, perpPositionWithLpSettle, diff --git a/common-ts/src/types/index.ts b/common-ts/src/types/index.ts index d5fd6313..0caadfb6 100644 --- a/common-ts/src/types/index.ts +++ b/common-ts/src/types/index.ts @@ -226,6 +226,7 @@ export type OpenPosition = { quoteEntryAmount: BN; quoteBreakEvenAmount: BN; unrealizedFundingPnl: BN; + feesAndFundingPnl: BN; lastCumulativeFundingRate: BN; openOrders: number; unsettledPnl: BN;