当前位置: 首页>>代码示例>>C#>>正文


C# StockSerie.ReadFromCSVFile方法代码示例

本文整理汇总了C#中StockSerie.ReadFromCSVFile方法的典型用法代码示例。如果您正苦于以下问题:C# StockSerie.ReadFromCSVFile方法的具体用法?C# StockSerie.ReadFromCSVFile怎么用?C# StockSerie.ReadFromCSVFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StockSerie的用法示例。


在下文中一共展示了StockSerie.ReadFromCSVFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadData

        public override bool LoadData(string rootFolder, StockSerie stockSerie)
        {
            string archiveFileName = rootFolder + ARCHIVE_FOLDER + "\\" + stockSerie.ShortName.Replace(':', '_') + "_" + stockSerie.StockName + "_" + stockSerie.StockGroup.ToString() + ".txt";
             if (File.Exists(archiveFileName))
             {
            stockSerie.ReadFromCSVFile(archiveFileName);
             }

             string fileName = rootFolder + INTRADAY_FOLDER + "\\" + stockSerie.ShortName.Replace(':', '_') + "_" + stockSerie.StockName + "_" + stockSerie.StockGroup.ToString() + ".txt";

             if (File.Exists(fileName))
             {
            if (ParseIntradayData(stockSerie, fileName))
            {
               stockSerie.Values.Last().IsComplete = false;
               var lastDate = stockSerie.Keys.Last();

               DateTime firstArchiveDate = lastDate.AddMonths(-2).AddDays(-lastDate.Day + 1).Date;

               stockSerie.SaveToCSVFromDateToDate(archiveFileName, firstArchiveDate, lastDate.AddDays(-5).Date);

               // Archive other time frames
               string durationFileName;
               StockSerie.StockBarDuration previousDuration = stockSerie.BarDuration;
               foreach (StockSerie.StockBarDuration duration in cacheDurations)
               {
                  durationFileName = rootFolder + ARCHIVE_FOLDER + "\\" + duration + "\\" + stockSerie.ShortName.Replace(':', '_') + "_" + stockSerie.StockName + "_" + stockSerie.StockGroup.ToString() + ".txt";

                  if (File.Exists(durationFileName) &&
                      File.GetLastWriteTime(durationFileName).Date == DateTime.Today.Date) break; // Only cache once a day.
                  stockSerie.BarDuration = duration;
                  stockSerie.SaveToCSVFromDateToDate(durationFileName, stockSerie.Keys.First(), lastDate.AddDays(-1).Date);
               }

               // Set back to previous duration.
                if (previousDuration != stockSerie.BarDuration)
                {
                    stockSerie.BarDuration = previousDuration;
                }
            }
            else
            {
               return false;
            }
             }
             return true;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:47,代码来源:CommerzBankIntradayDataProvider.cs

示例2: LoadIntradayDurationArchiveData

        public override bool LoadIntradayDurationArchiveData(string rootFolder, StockSerie serie, StockSerie.StockBarDuration duration)
        {
            StockLog.Write("LoadIntradayDurationArchiveData Name:" + serie.StockName + " duration:" + duration);
             string durationFileName = rootFolder + ARCHIVE_FOLDER + "\\" + duration + "\\" + serie.ShortName.Replace(':', '_') + "_" + serie.StockName + "_" + serie.StockGroup.ToString() + ".txt";
             if (File.Exists(durationFileName))
             {
            var values = serie.GetValues(duration);
            if (values == null)
               StockLog.Write("LoadIntradayDurationArchiveData Cache File Found, current size is: 0");
            else  StockLog.Write("LoadIntradayDurationArchiveData Cache File Found, current size is: " + values.Count);
            serie.ReadFromCSVFile(durationFileName, duration);

            StockLog.Write("LoadIntradayDurationArchiveData New serie size is: " + serie.GetValues(duration).Count);
            if (serie.GetValues(duration).Count > 0)
            {
               StockLog.Write("LoadIntradayDurationArchiveData First bar: " +
                              serie.GetValues(duration).First().ToString());
               StockLog.Write("LoadIntradayDurationArchiveData Last bar: " + serie.GetValues(duration).Last().ToString());
            }
            else
            {
               return false;
            }
             }
             else
             {
            return false;
             }
             return true;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:30,代码来源:CommerzBankIntradayDataProvider.cs

示例3: LoadIntradayDurationArchiveData

 public override bool LoadIntradayDurationArchiveData(string rootFolder, StockSerie serie,
  StockSerie.StockBarDuration duration)
 {
     string durationFileName = rootFolder + ARCHIVE_FOLDER + "\\" + duration + "\\" +
                            serie.ShortName.Replace(':', '_') + "_" + serie.StockName + "_" +
                            serie.StockGroup.ToString() + ".txt";
      if (File.Exists(durationFileName))
      {
     serie.ReadFromCSVFile(durationFileName, duration);
      }
      else
      {
     return false;
      }
      return true;
 }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:16,代码来源:YahooIntradayDataProvider.cs


注:本文中的StockSerie.ReadFromCSVFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。