Add position count property map
This commit is contained in:
@@ -320,7 +320,8 @@ public static class PostgreSqlMappers
|
||||
RequestId = entity.RequestId,
|
||||
Metadata = entity.Metadata,
|
||||
InitialBalance = entity.InitialBalance,
|
||||
NetPnl = entity.NetPnl
|
||||
NetPnl = entity.NetPnl,
|
||||
PositionCount = entity.PositionCount
|
||||
};
|
||||
|
||||
return backtest;
|
||||
@@ -362,7 +363,8 @@ public static class PostgreSqlMappers
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
UpdatedAt = DateTime.UtcNow,
|
||||
InitialBalance = backtest.InitialBalance,
|
||||
NetPnl = backtest.NetPnl
|
||||
NetPnl = backtest.NetPnl,
|
||||
PositionCount = backtest.Positions.Count
|
||||
};
|
||||
}
|
||||
|
||||
@@ -618,7 +620,7 @@ public static class PostgreSqlMappers
|
||||
|
||||
// Set ProfitAndLoss with proper type
|
||||
position.ProfitAndLoss = new ProfitAndLoss { Realized = entity.ProfitAndLoss, Net = entity.NetPnL };
|
||||
|
||||
|
||||
// Set fee properties
|
||||
position.UiFees = entity.UiFees;
|
||||
position.GasFees = entity.GasFees;
|
||||
@@ -658,7 +660,8 @@ public static class PostgreSqlMappers
|
||||
MoneyManagementJson = position.MoneyManagement != null
|
||||
? JsonConvert.SerializeObject(position.MoneyManagement)
|
||||
: null,
|
||||
NetPnL = position.ProfitAndLoss?.Net ?? (position.ProfitAndLoss?.Realized - position.UiFees - position.GasFees ?? 0)
|
||||
NetPnL = position.ProfitAndLoss?.Net ??
|
||||
(position.ProfitAndLoss?.Realized - position.UiFees - position.GasFees ?? 0)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user