Skip to content

Commit 6c30152

Browse files
committed
fix oversettling positive pnl
1 parent 31747b1 commit 6c30152

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/bots/userPnlSettler.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export class UserPnlSettlerBot implements Bot {
205205
// Initial settlement
206206
await this.trySettleNegativePnl();
207207
await this.trySettleUsersWithNoPositions();
208-
await this.trySettlePositivePnlForLowMargin();
208+
//await this.trySettlePositivePnlForLowMargin();
209209

210210
// Set up intervals
211211
this.intervalIds.push(
@@ -521,15 +521,7 @@ export class UserPnlSettlerBot implements Bot {
521521

522522
// For negative PnL, check if user can be settled
523523
if (userUnsettledPnl.gt(ZERO)) {
524-
const canSettlePositivePnl = await this.canSettlePositivePnl(
525-
user,
526-
userUnsettledPnl,
527-
perpMarketIdx,
528-
spotMarketIdx
529-
);
530-
if (!canSettlePositivePnl) {
531-
return { shouldSettle: false };
532-
}
524+
return { shouldSettle: false };
533525
} else {
534526
// only settle negative pnl if unsettled pnl is material
535527
if (!userUnsettledPnl.abs().gte(this.minPnlToSettle.abs())) {
@@ -781,7 +773,9 @@ export class UserPnlSettlerBot implements Bot {
781773
logger.info(
782774
`${logPrefix} Settling ${sortedParams.length} users in ${Math.ceil(
783775
sortedParams.length / SETTLE_USER_CHUNKS
784-
)} chunks for market ${marketIndex}`
776+
)} chunks for market ${marketIndex} with respective PnLs: ${sortedParams
777+
.map((p) => p.pnl)
778+
.join(', ')}`
785779
);
786780

787781
await this.executeSettlementForMarket(

0 commit comments

Comments
 (0)