예제 #1
0
        /// <summary>
        /// 得到单日的K线数据
        /// </summary>
        /// <param name="code"></param>
        /// <param name="date"></param>
        /// <param name="period"></param>
        /// <returns></returns>
        public virtual IKLineData GetKLineData(string code, int date, KLinePeriod period)
        {
            string path = CsvHistoryData_PathUtils.GetKLineDataPath(GetCsvDataPath(), code, date, period);

            if (!File.Exists(path))
            {
                return(null);
            }
            return(CsvUtils_KLineData.Load(path));
        }
예제 #2
0
        /// <summary>
        /// 得到现有的K线所有数据
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public IList <int> GetKLineDataDays(string code)
        {
            string klinePath = CsvHistoryData_PathUtils.GetKLineDataPath(GetCsvDataPath(), code, KLinePeriod.KLinePeriod_1Minute);

            string[]   files     = Directory.GetFiles(klinePath);
            List <int> klineDays = new List <int>(files.Length);

            for (int i = 0; i < files.Length; i++)
            {
                string file       = files[i];
                int    startIndex = file.LastIndexOf('_') + 1;
                klineDays.Add(int.Parse(file.Substring(startIndex, 8)));
            }
            return(klineDays);
        }
예제 #3
0
        private bool Exist(string code, int date, KLinePeriod period)
        {
            string path = CsvHistoryData_PathUtils.GetKLineDataPath(GetCsvDataPath(), code, date, period);

            return(File.Exists(path));
        }