17 using System.Collections.Generic;
32 private readonly List<IRiskManagementModel> _riskManagementModels =
new List<IRiskManagementModel>();
40 if (riskManagementModels.IsNullOrEmpty())
42 throw new ArgumentException(
"Must specify at least 1 risk management model for the CompositeRiskManagementModel");
45 _riskManagementModels.AddRange(riskManagementModels);
54 foreach (var riskManagementModel
in riskManagementModels)
59 if (_riskManagementModels.IsNullOrEmpty())
61 throw new ArgumentException(
"Must specify at least 1 risk management model for the CompositeRiskManagementModel");
71 if (riskManagementModels.IsNullOrEmpty())
73 throw new ArgumentException(
"Must specify at least 1 risk management model for the CompositeRiskManagementModel");
76 foreach (var pyRiskManagementModel
in riskManagementModels)
87 : this(new[] { riskManagementModel} )
101 foreach (var model
in _riskManagementModels)
104 var riskAdjusted = model.ManageRisk(algorithm, targets);
107 targets = riskAdjusted.Concat(targets).DistinctBy(t => t.Symbol).ToArray();
121 foreach (var model
in _riskManagementModels)
123 model.OnSecuritiesChanged(algorithm, changes);
133 _riskManagementModels.Add(riskManagementModel);
143 if (!pyRiskManagementModel.TryConvert(out riskManagementModel))
147 _riskManagementModels.Add(riskManagementModel);