示例#1
0
        public List <ITimeLineData> GetData(String code, int startDate, int endDate)
        {
            if (startDate > endDate)
            {
                return(new List <ITimeLineData>());
            }
            CodeInfo codeInfo = dataReader.CodeReader.GetCodeInfo(code);

            if (codeInfo == null)
            {
                return(new List <ITimeLineData>());
            }
            if ((codeInfo.End != 0 && codeInfo.End < startDate) || (codeInfo.Start != 0 && codeInfo.Start > endDate))
            {
                return(new List <ITimeLineData>());
            }

            int        lastTradingDay = dataReader.TradingDayReader.GetPrevTradingDay(startDate);
            IKLineData klineData_Day  = dataReader.KLineDataReader.GetData(code, lastTradingDay, lastTradingDay, KLinePeriod.KLinePeriod_1Day);
            IKLineData klineData_1Min = dataReader.KLineDataReader.GetData(code, startDate, endDate, KLinePeriod.KLinePeriod_1Minute);

            ITradingTimeReader_Code tradingSessionReader = dataReader.CreateTradingTimeReader(code);
            float lastEndPrice = klineData_Day == null ? -1 : klineData_Day.Arr_End[0];

            return(DataTransfer_KLine2TimeLine.ConvertTimeLineDataList(klineData_1Min, lastEndPrice, tradingSessionReader));
        }
示例#2
0
 public ITimeLineData GetRealData()
 {
     if (realData == null)
     {
         lock (lockObj_Real)
         {
             if (realData == null)
             {
                 realData = DataTransfer_KLine2TimeLine.ConvertTimeLineData(minuteKLineData, lastEndPrice);
             }
         }
     }
     //TODO realdata是可以被修改的,所以此处线程不安全
     //应该给IRealData提供两个实现,一个是静态的,一个是动态的,缓存静态的实现,给外部生成时提供动态实现。
     return(realData);
 }