public StrategyExecutor_Multi(IStrategyCenter strategyCenter, StrategyArguments_CodePeriodList arguments) { this.strategyCenter = strategyCenter; this.arguments = arguments; IList <ICodePeriod> codePeriods = this.arguments.CodePeriodPackage.CodePeriods; for (int i = 0; i < codePeriods.Count; i++) { ICodePeriod codePeriod = codePeriods[i]; StrategyArguments_CodePeriod strategyCodePeriod = new StrategyArguments_CodePeriod(codePeriod, arguments.ReferedPeriods, arguments.ForwardPeriod); IStrategyExecutor_Single executor = strategyCenter.GetStrategyExecutorFactory().CreateExecutor_History(strategyCodePeriod); this.executors.Add(executor); } }
private void InitByCodePeriod(IStrategyCenter strategyCenter, StrategyArguments_CodePeriod strategyArguments) { ICodePeriod codePeriod = strategyArguments.CodePeriod; if (codePeriod.IsFromContracts) { this.strategyExecutor = new StrategyExecutor_CodePeriod_MainContract(strategyCenter, strategyArguments); } else { IDataPackage_Code dataPackage = strategyCenter.BelongDataCenter.DataPackageFactory.CreateDataPackage_Code(codePeriod.Code, codePeriod.StartDate, codePeriod.EndDate); StrategyArguments_DataPackage strategyDataPackage = new StrategyArguments_DataPackage(dataPackage, strategyArguments.ReferedPeriods, strategyArguments.ForwardPeriod); this.strategyExecutor = strategyCenter.GetStrategyExecutorFactory().CreateExecutor_History(strategyDataPackage); } this.strategyExecutor.OnStart += StrategyExecutor_OnStart;; this.strategyExecutor.OnBarFinished += StrategyExecutor_OnBarFinished; this.strategyExecutor.OnDayFinished += StrategyExecutor_OnDayFinished; this.strategyExecutor.OnCanceled += StrategyExecutor_OnCanceled; this.strategyExecutor.OnFinished += StrategyExecutor_OnFinished; }