本文整理汇总了C#中StockSerie.SaveToCSVFromDateToDate方法的典型用法代码示例。如果您正苦于以下问题:C# StockSerie.SaveToCSVFromDateToDate方法的具体用法?C# StockSerie.SaveToCSVFromDateToDate怎么用?C# StockSerie.SaveToCSVFromDateToDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StockSerie
的用法示例。
在下文中一共展示了StockSerie.SaveToCSVFromDateToDate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}