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()); }
/// <summary> /// 得到当前的分时线 /// </summary> /// <returns></returns> public ITimeLineData GetTimeLineData() { if (currentTimeLineData == null || currentTimeLineData.Date != tradingDay) { currentTimeLineData = dataPackage.CreateTimeLineData_RealTime(tradingDay); } DataNavigate_ChangeTime.ChangeTime_TimeLineData(currentTimeLineData, time, GetTickData()); return(currentTimeLineData); }