Add position count property map
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Kaigen": {
|
"Kaigen": {
|
||||||
"BaseUrl": "https://srv-captain--kaigen-back:3000"
|
"BaseUrl": "http://srv-captain--kaigen-back:3000"
|
||||||
},
|
},
|
||||||
"N8n": {
|
"N8n": {
|
||||||
"WebhookUrl": "https://n8n.kai.managing.live/webhook/fa9308b6-983b-42ec-b085-71599d655951",
|
"WebhookUrl": "https://n8n.kai.managing.live/webhook/fa9308b6-983b-42ec-b085-71599d655951",
|
||||||
|
|||||||
@@ -399,7 +399,6 @@ public class BacktestExecutor
|
|||||||
GrowthPercentage = growthPercentage,
|
GrowthPercentage = growthPercentage,
|
||||||
HodlPercentage = hodlPercentage,
|
HodlPercentage = hodlPercentage,
|
||||||
Fees = fees,
|
Fees = fees,
|
||||||
WalletBalances = tradingBot.WalletBalances.ToList(),
|
|
||||||
Statistics = stats,
|
Statistics = stats,
|
||||||
Score = scoringResult.Score,
|
Score = scoringResult.Score,
|
||||||
ScoreMessage = scoringResult.GenerateSummaryMessage(),
|
ScoreMessage = scoringResult.GenerateSummaryMessage(),
|
||||||
|
|||||||
@@ -171,7 +171,6 @@ public class BacktestTradingBotGrain : Grain, IBacktestTradingBotGrain
|
|||||||
GrowthPercentage = growthPercentage,
|
GrowthPercentage = growthPercentage,
|
||||||
HodlPercentage = hodlPercentage,
|
HodlPercentage = hodlPercentage,
|
||||||
Fees = fees,
|
Fees = fees,
|
||||||
WalletBalances = tradingBot.WalletBalances.ToList(),
|
|
||||||
Statistics = stats,
|
Statistics = stats,
|
||||||
Score = scoringResult.Score,
|
Score = scoringResult.Score,
|
||||||
ScoreMessage = scoringResult.GenerateSummaryMessage(),
|
ScoreMessage = scoringResult.GenerateSummaryMessage(),
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ public class Backtest
|
|||||||
Config = config;
|
Config = config;
|
||||||
Positions = positions;
|
Positions = positions;
|
||||||
Signals = signals;
|
Signals = signals;
|
||||||
WalletBalances = new List<KeyValuePair<DateTime, decimal>>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Required] public string Id { get; set; }
|
[Required] public string Id { get; set; }
|
||||||
@@ -33,7 +32,6 @@ public class Backtest
|
|||||||
[Required] public DateTime EndDate { get; set; }
|
[Required] public DateTime EndDate { get; set; }
|
||||||
[Required] public PerformanceMetrics Statistics { get; set; }
|
[Required] public PerformanceMetrics Statistics { get; set; }
|
||||||
[Required] public decimal Fees { 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 User User { get; set; }
|
||||||
[Required] public double Score { get; set; }
|
[Required] public double Score { get; set; }
|
||||||
public Guid RequestId { get; set; }
|
public Guid RequestId { get; set; }
|
||||||
|
|||||||
@@ -320,7 +320,8 @@ public static class PostgreSqlMappers
|
|||||||
RequestId = entity.RequestId,
|
RequestId = entity.RequestId,
|
||||||
Metadata = entity.Metadata,
|
Metadata = entity.Metadata,
|
||||||
InitialBalance = entity.InitialBalance,
|
InitialBalance = entity.InitialBalance,
|
||||||
NetPnl = entity.NetPnl
|
NetPnl = entity.NetPnl,
|
||||||
|
PositionCount = entity.PositionCount
|
||||||
};
|
};
|
||||||
|
|
||||||
return backtest;
|
return backtest;
|
||||||
@@ -362,7 +363,8 @@ public static class PostgreSqlMappers
|
|||||||
CreatedAt = DateTime.UtcNow,
|
CreatedAt = DateTime.UtcNow,
|
||||||
UpdatedAt = DateTime.UtcNow,
|
UpdatedAt = DateTime.UtcNow,
|
||||||
InitialBalance = backtest.InitialBalance,
|
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
|
// Set ProfitAndLoss with proper type
|
||||||
position.ProfitAndLoss = new ProfitAndLoss { Realized = entity.ProfitAndLoss, Net = entity.NetPnL };
|
position.ProfitAndLoss = new ProfitAndLoss { Realized = entity.ProfitAndLoss, Net = entity.NetPnL };
|
||||||
|
|
||||||
// Set fee properties
|
// Set fee properties
|
||||||
position.UiFees = entity.UiFees;
|
position.UiFees = entity.UiFees;
|
||||||
position.GasFees = entity.GasFees;
|
position.GasFees = entity.GasFees;
|
||||||
@@ -658,7 +660,8 @@ public static class PostgreSqlMappers
|
|||||||
MoneyManagementJson = position.MoneyManagement != null
|
MoneyManagementJson = position.MoneyManagement != null
|
||||||
? JsonConvert.SerializeObject(position.MoneyManagement)
|
? JsonConvert.SerializeObject(position.MoneyManagement)
|
||||||
: null,
|
: 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