@@ -153,7 +153,7 @@ namespace Managing.Application.Backtesting
|
||||
}
|
||||
|
||||
bot.Candles = new HashSet<Candle>(candles);
|
||||
// bot.UpdateStrategiesValues();
|
||||
bot.UpdateStrategiesValues();
|
||||
|
||||
var strategies = _scenarioService.GetStrategies();
|
||||
var strategiesValues = GetStrategiesValues(strategies, candles);
|
||||
@@ -176,12 +176,36 @@ namespace Managing.Application.Backtesting
|
||||
Statistics = stats,
|
||||
OptimizedMoneyManagement = optimizedMoneyManagement,
|
||||
MoneyManagement = moneyManagement,
|
||||
StrategiesValues = strategiesValues
|
||||
StrategiesValues = AggregateValues(strategiesValues, bot.StrategiesValues)
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private Dictionary<StrategyType, StrategiesResultBase> AggregateValues(
|
||||
Dictionary<StrategyType, StrategiesResultBase> strategiesValues,
|
||||
Dictionary<StrategyType, StrategiesResultBase> botStrategiesValues)
|
||||
{
|
||||
// Foreach strategy type, only retrieve the values where the strategy is not present already in the bot
|
||||
// Then, add the values to the bot values
|
||||
|
||||
var result = new Dictionary<StrategyType, StrategiesResultBase>();
|
||||
foreach (var strategy in strategiesValues)
|
||||
{
|
||||
// if (!botStrategiesValues.ContainsKey(strategy.Key))
|
||||
// {
|
||||
// result[strategy.Key] = strategy.Value;
|
||||
// }else
|
||||
// {
|
||||
// result[strategy.Key] = botStrategiesValues[strategy.Key];
|
||||
// }
|
||||
|
||||
result[strategy.Key] = strategy.Value;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private Dictionary<StrategyType, StrategiesResultBase> GetStrategiesValues(IEnumerable<Strategy> strategies,
|
||||
List<Candle> candles)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user