/// <summary> /// Creates a new Strategy Instance object /// </summary> /// <param name="parameters">Parameter list to be used by the instance for execution</param> /// <param name="description">Instance description</param> public StrategyInstance CreateInstance(Dictionary <string, ParameterDetail> parameters, string description) { // Get new Instance Key string instanceKey = StrategyIdGenerator.GetInstanceKey(_key); // Create new Strategy Instance Object var strategyInstance = new StrategyInstance(instanceKey, parameters, _strategyType) { Description = description }; // Add to local MAP _strategyInstances.Add(instanceKey, strategyInstance); // Return Instance return(strategyInstance); }
/// <summary> /// Argument Constructor /// </summary> /// <param name="name">Strategy Name</param> /// <param name="strategyType">Strategy Assembly Type</param> /// <param name="fileName">Name of the file from which the Straegy is loaded</param> public Strategy(string name, Type strategyType, string fileName) { // Get new strategy ID _key = StrategyIdGenerator.GetStrategyKey(); // Save information _name = name; _fileName = fileName; _strategyType = strategyType; // Initialize fields _parameterDetails = new Dictionary <string, ParameterDetail>(); _strategyInstances = new Dictionary <string, StrategyInstance>(); _strategyStatistics = new ObservableCollection <StrategyStatistics>(); // Subscribe Domain Events EventSystem.Subscribe <StrategyStatistics>(UpdateStrategyStatistics); }