Add netPnl in db for position

This commit is contained in:
2025-10-03 03:11:17 +07:00
parent 5bd4fd7b52
commit 58b07a1a13
9 changed files with 1674 additions and 5 deletions

View File

@@ -570,7 +570,7 @@ public static class PostgreSqlMappers
};
// Set ProfitAndLoss with proper type
position.ProfitAndLoss = new ProfitAndLoss { Realized = entity.ProfitAndLoss, Net = entity.ProfitAndLoss - entity.UiFees - entity.GasFees };
position.ProfitAndLoss = new ProfitAndLoss { Realized = entity.ProfitAndLoss, Net = entity.NetPnL };
// Set fee properties
position.UiFees = entity.UiFees;
@@ -610,7 +610,8 @@ public static class PostgreSqlMappers
InitiatorIdentifier = position.InitiatorIdentifier,
MoneyManagementJson = position.MoneyManagement != null
? JsonConvert.SerializeObject(position.MoneyManagement)
: null
: null,
NetPnL = position.ProfitAndLoss?.Net ?? (position.ProfitAndLoss?.Realized - position.UiFees - position.GasFees ?? 0)
};
}