Add netPnl in db for position
This commit is contained in:
@@ -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)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user