Add position count property map

This commit is contained in:
2025-11-19 14:16:30 +07:00
parent 9b25201def
commit 096fb500e4
5 changed files with 8 additions and 9 deletions

View File

@@ -24,7 +24,7 @@
}
},
"Kaigen": {
"BaseUrl": "https://srv-captain--kaigen-back:3000"
"BaseUrl": "http://srv-captain--kaigen-back:3000"
},
"N8n": {
"WebhookUrl": "https://n8n.kai.managing.live/webhook/fa9308b6-983b-42ec-b085-71599d655951",

View File

@@ -399,7 +399,6 @@ public class BacktestExecutor
GrowthPercentage = growthPercentage,
HodlPercentage = hodlPercentage,
Fees = fees,
WalletBalances = tradingBot.WalletBalances.ToList(),
Statistics = stats,
Score = scoringResult.Score,
ScoreMessage = scoringResult.GenerateSummaryMessage(),

View File

@@ -171,7 +171,6 @@ public class BacktestTradingBotGrain : Grain, IBacktestTradingBotGrain
GrowthPercentage = growthPercentage,
HodlPercentage = hodlPercentage,
Fees = fees,
WalletBalances = tradingBot.WalletBalances.ToList(),
Statistics = stats,
Score = scoringResult.Score,
ScoreMessage = scoringResult.GenerateSummaryMessage(),

View File

@@ -18,7 +18,6 @@ public class Backtest
Config = config;
Positions = positions;
Signals = signals;
WalletBalances = new List<KeyValuePair<DateTime, decimal>>();
}
[Required] public string Id { get; set; }
@@ -33,7 +32,6 @@ public class Backtest
[Required] public DateTime EndDate { get; set; }
[Required] public PerformanceMetrics Statistics { get; set; }
[Required] public decimal Fees { get; set; }
[Required] public List<KeyValuePair<DateTime, decimal>> WalletBalances { get; set; }
[Required] public User User { get; set; }
[Required] public double Score { get; set; }
public Guid RequestId { get; set; }

View File

@@ -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
};
}
@@ -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)
};
}