public void ChangeTime(double time)
        {
            if (currentTime == time)
            {
                return;
            }
            //比如 20150531140500
            //1分钟线可以正常显示
            //日线需要将

            int date = DaySplitter.GetTimeDate(time, dataCache_Code.GetOpenDateReader());

            if (currentDate != date)
            {
                //TODO 将以前生成的klineChartBuilder_1Minute cache下来
                this.currentDataCache_CodeDate = dataCache_Code.GetCache_CodeDate(date);
                this.klineChartBuilder_1Minute = new RealTimeDataBuilder_DayData(currentDataCache_CodeDate, time);
                this.currentDate = date;
            }

            int    index = klineData.IndexOfTime(time);
            double t     = klineData.Arr_Time[index];

            IKLineData todayMinuteKLineData = klineChartBuilder_1Minute.MinuteKlineData;
            KLineBar   currentMinuteChart   = klineChartBuilder_1Minute.GetCurrentChart();

            //TODO 这里最多只支持到日线,两日线或以上不支持
            int startIndex;

            if (t == (int)t)
            {
                startIndex = 0;
            }
            else
            {
                startIndex = todayMinuteKLineData.IndexOfTime(t);
            }
            int endIndex = todayMinuteKLineData.IndexOfTime(currentMinuteChart.Time);

            IKLineBar currentChart = todayMinuteKLineData.GetAggrKLineBar(startIndex, endIndex - 1);

            KLineBarMerge.MergeTo((KLineBar)currentChart, currentMinuteChart);
            this.currentChart = currentChart;
            this.currentTime  = time;
        }
Beispiel #2
0
 public int IndexOfTime(double time)
 {
     return(klineData.IndexOfTime(time));
 }