Пример #1
0
        public void TickDataReceived(object sender, ITickData tickData)
        {
            string code = tickData.Code;

            RealTimeDataReceiver_Code realTimeDataReceiver;

            if (dic_Code_RealTimeData.ContainsKey(code))
            {
                realTimeDataReceiver = dic_Code_RealTimeData[code];
                realTimeDataReceiver.Receive(tickData);
            }
            else
            {
                IMarketData     marketData = ((IMarketData)sender);
                List <double[]> openTime   = marketData.GetTradingSession(code, currentTradingDay);
                if (openTime == null)
                {
                    throw new ApplicationException(code + "-" + currentTradingDay + "没有配置开盘时间");
                }
                realTimeDataReceiver = new RealTimeDataReceiver_Code(code, currentTradingDay, dataReader, klinePeriods, openTime);
                dic_Code_RealTimeData.Add(code, realTimeDataReceiver);
            }
            if (RealTimeDataChanged != null)
            {
                RealTimeDataChanged(this, realTimeDataReceiver);
            }
        }