Esempio n. 1
0
        /// <summary>
        /// 得到一天内K线的每一根柱子的时间
        /// </summary>
        /// <param name="openDateReader"></param>
        /// <param name="openTimes"></param>
        /// <param name="targetPeriod"></param>
        /// <returns></returns>
        public static List <double> GetKLineTimeList(int date, ITradingDayReader openDateReader, List <double[]> openTimes, KLinePeriod targetPeriod)
        {
            if (!openDateReader.IsTrade(date))
            {
                throw new ArgumentException(date + "不开盘");
            }

            int lastOpenDate = openDateReader.GetPrevTradingDay(date);

            return(GetKLineTimeList(date, lastOpenDate, openTimes, targetPeriod));
        }
Esempio n. 2
0
 /// <summary>
 /// 得到本次更新的所有K线数据
 /// </summary>
 /// <returns></returns>
 public ITradingDayReader GetAllTradingDayReader()
 {
     if (allTradingDayReader == null)
     {
         ITradingDayReader updatedTradingDayReader = GetUpdatedTradingDayReader();
         List <int>        allTradingDays          = new List <int>();
         IList <int>       tradingDays             = updatedTradingDayReader.GetAllTradingDays();
         allTradingDays.AddRange(tradingDays);
         List <int> newTradingDays = GetNewTradingDays();
         RemoveTradingDays(allTradingDays, newTradingDays[newTradingDays.Count - 1]);
         for (int i = 0; i < newTradingDays.Count; i++)
         {
             int newTradingDay = newTradingDays[i];
             if (!updatedTradingDayReader.IsTrade(newTradingDay))
             {
                 allTradingDays.Add(newTradingDay);
             }
         }
         allTradingDayReader = new CacheUtils_TradingDay(allTradingDays);
     }
     return(allTradingDayReader);
 }