fix get unsettled funding function
This commit is contained in:
parent
256b948207
commit
708ef68b85
|
@ -1092,16 +1092,15 @@ export class PerpPosition {
|
|||
}
|
||||
|
||||
public getUnsettledFunding(perpMarket: PerpMarket): I80F48 {
|
||||
if (this.basePositionLots.gt(new BN(0))) {
|
||||
return perpMarket.longFunding
|
||||
.sub(this.longSettledFunding)
|
||||
.mul(I80F48.fromI64(this.basePositionLots));
|
||||
} else if (this.basePositionLots.lt(new BN(0))) {
|
||||
if (this.basePositionLots.isNeg()) {
|
||||
return perpMarket.shortFunding
|
||||
.sub(this.shortSettledFunding)
|
||||
.mul(I80F48.fromI64(this.basePositionLots));
|
||||
} else {
|
||||
return perpMarket.longFunding
|
||||
.sub(this.longSettledFunding)
|
||||
.mul(I80F48.fromI64(this.basePositionLots));
|
||||
}
|
||||
return ZERO_I80F48();
|
||||
}
|
||||
|
||||
public getEquity(perpMarket: PerpMarket): I80F48 {
|
||||
|
|
Loading…
Reference in New Issue