private void DataForward_OnTick(object sender, IForwardOnTickArgument argument)
        {
            double time = argument.Time;
            //if (time < 20170601.205900)
            //    return;
            int tradingDay = argument.TickInfo.TickData.TradingDay;

            if (prevTime == time)
            {
                return;
            }
            this.prevTime = time;
            ITickData_Extend tickData = GetTickData(tradingDay);

            //Console.WriteLine(tickData);
            DataNavigate_ChangeTime.ChangeTime_TickData(tickData, time);
            Assert.AreEqual(argument.TickInfo.TickBar.ToString(), tickData.ToString());

            IRealTimeData_Code realTimeData = ((IRealTimeData_Code)sender);

            DataNavigate_ChangeTime.ChangeTime_KLineData(klineData_1Minute, tradingDay, time, tickData);
            Assert.AreEqual(realTimeData.GetKLineData(KLinePeriod.KLinePeriod_1Minute).ToString(), klineData_1Minute.ToString());
            DataNavigate_ChangeTime.ChangeTime_KLineData(klineData_5Minute, tradingDay, time, tickData);
            Assert.AreEqual(realTimeData.GetKLineData(KLinePeriod.KLinePeriod_5Minute).ToString(), klineData_5Minute.ToString());
            DataNavigate_ChangeTime.ChangeTime_KLineData(klineData_15Minute, tradingDay, time, tickData);
            Assert.AreEqual(realTimeData.GetKLineData(KLinePeriod.KLinePeriod_15Minute).ToString(), klineData_15Minute.ToString());
            DataNavigate_ChangeTime.ChangeTime_KLineData(klineData_1Day, tradingDay, time, tickData);
            Assert.AreEqual(realTimeData.GetKLineData(KLinePeriod.KLinePeriod_1Day).ToString(), klineData_1Day.ToString());

            ITimeLineData_RealTime timeLineData = GetTimeLineData(tradingDay);

            DataNavigate_ChangeTime.ChangeTime_TimeLineData(timeLineData, time, tickData);
            Assert.AreEqual(realTimeData.GetTimeLineData().ToString(), timeLineData.ToString());
        }
Example #2
0
 /// <summary>
 /// 得到今日的TICK数据
 /// </summary>
 /// <returns></returns>
 public ITickData_Extend GetTickData()
 {
     if (currentTickData == null || currentTickData.TradingDay != tradingDay)
     {
         currentTickData = dataPackage.GetTickData(tradingDay);
     }
     DataNavigate_ChangeTime.ChangeTime_TickData(currentTickData, time);
     return(currentTickData);
 }