Skip to content

Commit

Permalink
sdk: account for settle lp in accoutnt breakdown (#828)
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney authored Jan 19, 2024
1 parent 2fe9ae6 commit 807c037
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sdk/src/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3293,6 +3293,10 @@ export class User {
};

for (const perpPosition of this.getActivePerpPositions()) {
const settledLpPosition = this.getPerpPositionWithLPSettle(
perpPosition.marketIndex,
perpPosition
)[0];
const perpMarket = this.driftClient.getPerpMarketAccount(
perpPosition.marketIndex
);
Expand All @@ -3301,7 +3305,7 @@ export class User {
).data;
const oraclePrice = oraclePriceData.price;
const worstCaseBaseAmount =
calculateWorstCaseBaseAssetAmount(perpPosition);
calculateWorstCaseBaseAssetAmount(settledLpPosition);

const marginRatio = new BN(
calculateMarketMarginRatio(
Expand Down

0 comments on commit 807c037

Please sign in to comment.