protected override void OnOrderDone(SingleOrder order)
        {
            this.atsRuntimeCrossComponent.OnOrderDone(order);
            /*---------------------------------------------------*/
            ATSComponent aTSComponent = this.atsComponents[order.Instrument];

            if (aTSComponent != null)
            {
                aTSComponent.OnOrderDone(order);
            }
            /*---------------------------------------------------*/
            //this.atsComponents[order.Instrument].OnOrderDone(order);
        }
        protected override void OnPortfolioValueChanged(Position position)
        {
            this.atsRuntimeCrossComponent.OnPositionValueChanged(position);
            /*---------------------------------------------------*/
            ATSComponent aTSComponent = this.atsComponents[position.Instrument];

            if (aTSComponent != null)
            {
                aTSComponent.OnPositionValueChanged();
            }
            /*---------------------------------------------------*/
            //this.atsComponents[position.Instrument].OnPositionValueChanged();
        }
        protected override void OnExecutionReport(SingleOrder order, ExecutionReport report)
        {
            this.atsRuntimeCrossComponent.OnExecutionReport(order, report);
            /*---------------------------------------------------*/
            ATSComponent aTSComponent = this.atsComponents[order.Instrument];

            if (aTSComponent != null)
            {
                aTSComponent.OnExecutionReport(order, report);
            }
            /*---------------------------------------------------*/
            //this.atsComponents[order.Instrument].OnExecutionReport(order, report);
        }
        internal void OnStopExecuted(ATSStop stop)
        {
            this.atsRuntimeCrossComponent.OnStopExecuted(stop);
            /*---------------------------------------------------*/
            ATSComponent aTSComponent = this.atsComponents[stop.Instrument];

            if (aTSComponent != null)
            {
                aTSComponent.OnStopExecuted(stop);
            }
            /*---------------------------------------------------*/
            //this.atsComponents[stop.Instrument].OnStopExecuted(stop);
        }
        protected override void OnNewCorporateAction(Instrument instrument, CorporateAction corporateAction)
        {
            this.marketManager.OnCorporateAction(instrument, corporateAction);
            this.atsRuntimeCrossComponent.OnCorporateAction(instrument, corporateAction);
            /*---------------------------------------------------*/
            ATSComponent aTSComponent = this.atsComponents[instrument];

            if (aTSComponent != null)
            {
                aTSComponent.OnCorporateAction(corporateAction);
            }
            /*---------------------------------------------------*/
            //this.atsComponents[instrument].OnCorporateAction(corporateAction);
        }
        protected override void OnNewFundamental(Instrument instrument, Fundamental fundamental)
        {
            this.marketManager.OnFundamental(instrument, fundamental);
            this.atsRuntimeCrossComponent.OnFundamental(instrument, fundamental);
            /*---------------------------------------------------*/
            ATSComponent aTSComponent = this.atsComponents[instrument];

            if (aTSComponent != null)
            {
                aTSComponent.OnFundamental(fundamental);
            }
            /*---------------------------------------------------*/
            //this.atsComponents[instrument].OnFundamental(fundamental);
        }
        protected override void OnNewMarketDepth(Instrument instrument, MarketDepth marketDepth)
        {
            this.marketManager.OnMarketDepth(instrument, marketDepth);
            this.atsRuntimeCrossComponent.OnMarketDepth(instrument, marketDepth);
            /*---------------------------------------------------*/
            ATSComponent aTSComponent = this.atsComponents[instrument];

            if (aTSComponent != null)
            {
                aTSComponent.OnMarketDepth(marketDepth);
            }
            /*---------------------------------------------------*/
            //this.atsComponents[instrument].OnMarketDepth(marketDepth);
        }
 protected override void OnBehaviorInit()
 {
     this.atsComponents.Clear();
     //把持仓中的证券添加到市场中来
     foreach (Position position in this.portfolio.Positions)
     {
         Instrument instrument = position.Instrument;
         this.marketManager.AddInstrument(instrument);
     }
     foreach (Instrument instrument in this.marketManager.Instruments)
     {
         this.activeInstruments.Add(instrument);
         ATSComponent aTSComponent = Activator.CreateInstance(this.atsComponent.GetType()) as ATSComponent;
         aTSComponent.StrategyBase = this;
         aTSComponent.Instrument   = instrument;
         base.SetProxyProperties(aTSComponent, this.atsComponent);
         aTSComponent.Init();
         this.atsComponents.Add(instrument, aTSComponent);
     }
 }
        protected override void OnNewBar(Instrument instrument, Bar bar)
        {
            foreach (ATSStop aTSStop in new ArrayList(this.activeStops[instrument]))
            {
                if (aTSStop.Connected)
                {
                    aTSStop.OnNewBar(bar);
                }
            }
            this.marketManager.OnBar(instrument, bar);
            this.atsRuntimeCrossComponent.OnBar(instrument, bar);
            /*---------------------------------------------------*/
            ATSComponent aTSComponent = this.atsComponents[instrument];

            if (aTSComponent != null)
            {
                aTSComponent.OnBar(bar);
            }
            /*---------------------------------------------------*/
            //this.atsComponents[instrument].OnBar(bar);
        }
        protected override void OnPositionClosed(Position position)
        {
            Instrument instrument = position.Instrument;

            foreach (ATSStop aTSStop in new ArrayList(this.activeStops[instrument]))
            {
                if ((aTSStop.Type == StopType.Time && aTSStop.Status == StopStatus.Active) || aTSStop.Connected)
                {
                    aTSStop.OnPositionClosed(position);
                }
            }
            this.atsRuntimeCrossComponent.OnPositionClosed(position);
            /*---------------------------------------------------*/
            ATSComponent aTSComponent = this.atsComponents[position.Instrument];

            if (aTSComponent != null)
            {
                aTSComponent.OnPositionClosed();
            }
            /*---------------------------------------------------*/
            //this.atsComponents[instrument].OnPositionClosed();
        }