Exemplo n.º 1
0
        /// <summary>
        /// 得到指定周期的K线
        /// </summary>
        /// <param name="period"></param>
        /// <returns></returns>
        public IKLineData GetKLineData(KLinePeriod klinePeriod)
        {
            if (klinePeriod.PeriodType == KLineTimeType.SECOND)
            {
                IKLineData_RealTime klineData_Second = dataPackage.CreateKLineData_RealTime_Second(tradingDay, klinePeriod);
                DataNavigate_ChangeTime.ChangeTime_KLineData(klineData_Second, tradingDay, time, GetTickData());
                return(klineData_Second);
            }

            IKLineData_RealTime klineData;

            if (this.dic_Period_KLineData.ContainsKey(klinePeriod))
            {
                klineData = this.dic_Period_KLineData[klinePeriod];
            }
            else
            {
                klineData = dataPackage.CreateKLineData_RealTime(klinePeriod);
                this.dic_Period_KLineData.Add(klinePeriod, klineData);
            }
            DataNavigate_ChangeTime.ChangeTime_KLineData(klineData, tradingDay, time, GetTickData());
            return(klineData);
        }