diff --git a/ts/client/src/accounts/mangoAccount.ts b/ts/client/src/accounts/mangoAccount.ts index 119edb4a3..f7ebe07b8 100644 --- a/ts/client/src/accounts/mangoAccount.ts +++ b/ts/client/src/accounts/mangoAccount.ts @@ -1133,6 +1133,24 @@ export class PerpPosition { !this.takerQuoteLots.eq(zero) ); } + + public getEntryPrice(perpMarket: PerpMarket): BN { + if (this.basePositionLots.eq(new BN(0))) { + return new BN(0); + } + return this.quoteEntryNative + .div(this.basePositionLots.mul(perpMarket.baseLotSize)) + .abs(); + } + + public getBreakEvenPrice(perpMarket: PerpMarket): BN { + if (this.basePositionLots.eq(new BN(0))) { + return new BN(0); + } + return this.quoteRunningNative + .div(this.basePositionLots.mul(perpMarket.baseLotSize)) + .abs(); + } } export class PerpPositionDto {