public override void SetComponent(ComponentType type, IComponentBase component) { if (type <= ComponentType.ReportManager) { if (type == ComponentType.MarketManager) { base.MarketManager = (component as MarketManager); return; } if (type == ComponentType.ReportManager) { base.ReportManager = (component as ReportManager); return; } } else { if (type == ComponentType.ATSComponent) { this.ATSComponent = (component as ATSComponent); return; } if (type == ComponentType.ATSCrossComponent) { this.ATSCrossComponent = (component as ATSCrossComponent); return; } } throw new InvalidOperationException("Invalid strategy1 component type"); }
public ATSStrategy(string name, string description) : base(name, description) { this.ATSCrossComponent = (StrategyComponentManager.GetComponent("{E70A6417-E7FA-4ec1-BC16-B03DE53C6E85}", this) as ATSCrossComponent); this.ATSComponent = (StrategyComponentManager.GetComponent("{AC3C53E2-6C94-4718-A5D8-8A475D8B4EB7}", this) as ATSComponent); this.atsComponents = new Dictionary <Instrument, ATSComponent>(); this.componentTypeList.Add(ComponentType.ATSComponent); this.componentTypeList.Add(ComponentType.ATSCrossComponent); }
/*------------------自已添加----------------------------*/ protected override void OnInit() { this.atsRuntimeCrossComponent = (Activator.CreateInstance(this.atsCrossComponent.GetType()) as ATSCrossComponent); this.atsRuntimeCrossComponent.StrategyBase = this; base.SetProxyProperties(this.atsRuntimeCrossComponent, this.atsCrossComponent); }