本文整理汇总了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;
}
示例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;
}
示例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;
}