Skip to content

Commit 56be2fa

Browse files
authored
sdk: only count taker fee in calculateEntriesEffectOnFreeCollateral for maintenance (#1694)
1 parent 988aa51 commit 56be2fa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sdk/src/user.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2356,7 +2356,11 @@ export class User {
23562356
let freeCollateralChange = ZERO;
23572357

23582358
// update free collateral to account for change in pnl from new position
2359-
if (!estimatedEntryPrice.eq(ZERO) && !positionBaseSizeChange.eq(ZERO)) {
2359+
if (
2360+
!estimatedEntryPrice.eq(ZERO) &&
2361+
!positionBaseSizeChange.eq(ZERO) &&
2362+
marginCategory === 'Maintenance'
2363+
) {
23602364
const costBasis = oraclePrice
23612365
.mul(positionBaseSizeChange.abs())
23622366
.div(BASE_PRECISION);

0 commit comments

Comments
 (0)