Update account/position and platform summary
This commit is contained in:
@@ -106,7 +106,7 @@ public class PostgreSqlTradingRepository : ITradingRepository
|
||||
public async Task InsertScenarioAsync(Scenario scenario)
|
||||
{
|
||||
var userId = scenario.User?.Id ?? 0;
|
||||
|
||||
|
||||
// Check if scenario already exists for the same user
|
||||
var existingScenario = await _context.Scenarios
|
||||
.AsNoTracking()
|
||||
@@ -271,7 +271,7 @@ public class PostgreSqlTradingRepository : ITradingRepository
|
||||
try
|
||||
{
|
||||
await PostgreSqlConnectionHelper.EnsureConnectionOpenAsync(_context);
|
||||
|
||||
|
||||
var position = await _context.Positions
|
||||
.AsNoTracking()
|
||||
.Include(p => p.User)
|
||||
@@ -395,6 +395,8 @@ public class PostgreSqlTradingRepository : ITradingRepository
|
||||
{
|
||||
entity.Date = position.Date;
|
||||
entity.ProfitAndLoss = position.ProfitAndLoss?.Realized ?? 0;
|
||||
entity.UiFees = position.UiFees;
|
||||
entity.GasFees = position.GasFees;
|
||||
entity.Status = position.Status;
|
||||
entity.SignalIdentifier = position.SignalIdentifier;
|
||||
entity.MoneyManagementJson = position.MoneyManagement != null
|
||||
@@ -440,7 +442,6 @@ public class PostgreSqlTradingRepository : ITradingRepository
|
||||
entity.Status = trade.Status;
|
||||
entity.TradeType = trade.TradeType;
|
||||
entity.Ticker = trade.Ticker;
|
||||
entity.Fee = trade.Fee;
|
||||
entity.Quantity = trade.Quantity;
|
||||
entity.Price = trade.Price;
|
||||
entity.Leverage = trade.Leverage;
|
||||
@@ -468,7 +469,8 @@ public class PostgreSqlTradingRepository : ITradingRepository
|
||||
return PostgreSqlMappers.Map(positions);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Position>> GetPositionsByInitiatorIdentifiersAsync(IEnumerable<Guid> initiatorIdentifiers)
|
||||
public async Task<IEnumerable<Position>> GetPositionsByInitiatorIdentifiersAsync(
|
||||
IEnumerable<Guid> initiatorIdentifiers)
|
||||
{
|
||||
var identifiersList = initiatorIdentifiers.ToList();
|
||||
if (!identifiersList.Any())
|
||||
@@ -510,7 +512,7 @@ public class PostgreSqlTradingRepository : ITradingRepository
|
||||
try
|
||||
{
|
||||
await PostgreSqlConnectionHelper.EnsureConnectionOpenAsync(_context);
|
||||
|
||||
|
||||
// Calculate total PnL from all finished positions (closed positions)
|
||||
// Only include positions that are Finished or Flipped (closed positions)
|
||||
var totalPnL = await _context.Positions
|
||||
|
||||
Reference in New Issue
Block a user