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


C# StockSerie.ClearBarDurationCache方法代码示例

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


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

示例1: DownloadIntradayData

        public override bool DownloadIntradayData(string rootFolder, StockSerie stockSerie)
        {
            if (stockSerie.StockName.Contains("CAC40") || stockSerie.StockName.Contains("SBF120"))
            {
                StockDataProviderBase.DownloadSerieData(rootFolder, stockDictionary["CAC40"]);
                StockDataProviderBase.DownloadSerieData(rootFolder, stockDictionary["ACCOR"]);
                stockSerie.IsInitialised = false;

                stockSerie.ClearBarDurationCache();

                return stockSerie.Initialise();
            }
            return true;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:14,代码来源:BreadthDataProvider.cs

示例2: ParseIntradayData

        private static bool ParseIntradayData(StockSerie stockSerie, string fileName)
        {
            bool res = false;
             try
             {
            using (StreamReader sr = new StreamReader(fileName))
            {
               while (!sr.EndOfStream)
               {
                  string line = sr.ReadLine();
                  string[] row = line.Split(',');
                  if (row.Length <2) continue;

                  DateTime openDate;
                  if (!DateTime.TryParse(row[0], out openDate)) continue;
                  float value = float.Parse(row[1]);

                  if (!stockSerie.ContainsKey(openDate))
                  {
                     StockDailyValue dailyValue = new StockDailyValue(stockSerie.StockName,
                            value,
                            value,
                            value,
                            value,
                            0,
                            openDate);
                     stockSerie.Add(dailyValue.DATE, dailyValue);
                  }
               }

               stockSerie.ClearBarDurationCache();

               res = true;
            }
             }
             catch (System.Exception e)
             {
            StockLog.Write("Unable to parse intraday data for " + stockSerie.StockName);
            StockLog.Write(e);
             }
             return res;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:42,代码来源:CommerzBankIntradayDataProvider.cs

示例3: ParseIntradayData

        private static void ParseIntradayData(StockSerie stockSerie, string folder, string fileName)
        {
            try
             {
            if (File.Exists(folder + "\\" + fileName))
            {
               using (StreamReader sr = new StreamReader(folder + "\\" + fileName))
               {
                  string line = sr.ReadLine();
                  string[] row = line.Replace("\"", "").Replace(" - ", ",").Split(',');
                  if (row.Length == 7)
                  {
                     try
                     {
                        StockDailyValue dailyValue = new StockDailyValue(stockSerie.StockName,
                            float.Parse(row[2], usCulture),
                            float.Parse(row[4], usCulture),
                            float.Parse(row[3], usCulture),
                            float.Parse(row[5], usCulture),
                            long.Parse(row[6]),
                            DateTime.Parse(row[0] + " " + row[1], usCulture));

                        StockDailyValue lastValue = stockSerie.Values.Last();

                        if (lastValue.DATE.Date == dailyValue.DATE.Date)
                        {
                           if (lastValue.DATE.Hour == 0 && lastValue.DATE.Minute == 0) return;

                           stockSerie.Remove(lastValue.DATE);
                        }
                        stockSerie.Add(dailyValue.DATE, dailyValue);
                        stockSerie.ClearBarDurationCache();
                     }
                     catch (System.Exception e)
                     {
                        StockLog.Write("Unable to parse intraday data for " + stockSerie.StockName);
                        StockLog.Write(line);
                        StockLog.Write(e);
                     }
                  }
               }
            }
             }
             catch (System.Exception e)
             {
            StockLog.Write("Unable to parse intraday data for " + stockSerie.StockName);
            StockLog.Write(e);
             }
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:49,代码来源:YahooDataProvider.cs

示例4: ParseIntradayData

        private static bool ParseIntradayData(StockSerie stockSerie, string fileName)
        {
            bool res = false;
             try
             {
            using (StreamReader sr = new StreamReader(fileName))
            {
               string line;

               while ((line = sr.ReadLine()) != null)
               {
                  if (line.StartsWith("timezone")) break;
               }
               if (sr.EndOfStream) return false;
               string[] row = line.Split(new char[] { ':' });
               string timeZone = row[1];
               double gmtoffset = timeZone == "CEST" ? -32400 : 0;

               while ((line = sr.ReadLine()) != null)
               {
                  if (line.StartsWith("gmtoffset")) break;
               }
               if (sr.EndOfStream) return false;

               row = line.Split(new char[] { ':' });
               gmtoffset += double.Parse(row[1]);

               DateTime now = DateTime.Now;
               DateTime utcNow = now.ToUniversalTime();
               gmtoffset -= (now - utcNow).TotalSeconds;

               while (!(line = sr.ReadLine()).StartsWith("range")) ;

               // First Range, read second offest for date calculation.
               row = line.Split(new char[] { ',', ':' });
               DateTime startDate = new DateTime(int.Parse(row[1].Substring(0, 4)), int.Parse(row[1].Substring(4, 2)), int.Parse(row[1].Substring(6, 2)));

               //  startDate = startDate.AddHours(9);
               long startTimeStamp = long.Parse(row[2]);

               while (!(line = sr.ReadLine()).StartsWith("volume")) ;

               while (!sr.EndOfStream)
               {
                  line = sr.ReadLine();

                  row = line.Split(new char[] { ',' });

                  DateTime openDate = startDate;
                  openDate = startDate.AddSeconds(long.Parse(row[0]) - startTimeStamp);
                  openDate = startDate.AddSeconds(long.Parse(row[0]) - startTimeStamp - gmtoffset);
                  if (!stockSerie.ContainsKey(openDate))
                  {
                     StockDailyValue dailyValue = new StockDailyValue(stockSerie.StockName,
                            float.Parse(row[4], usCulture),
                            float.Parse(row[2], usCulture),
                            float.Parse(row[3], usCulture),
                            float.Parse(row[1], usCulture),
                            long.Parse(row[5]),
                            openDate);
                     stockSerie.Add(dailyValue.DATE, dailyValue);
                  }
               }

               stockSerie.ClearBarDurationCache();

               res = true;
            }
             }
             catch (System.Exception e)
             {
            StockLog.Write("Unable to parse intraday data for " + stockSerie.StockName);
            StockLog.Write(e);
             }
             return res;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:76,代码来源:YahooIntradayDataProvider.cs

示例5: ParseIntradayData

        private static bool ParseIntradayData(StockSerie stockSerie, string fileName)
        {
            bool res = false;
             try
             {
            using (StreamReader sr = new StreamReader(fileName))
            {
               string line = sr.ReadLine();

               while (!(line = sr.ReadLine()).StartsWith("INTERVAL")) ;
               int interval;
               interval = int.Parse(line.Split('=')[1]);

               while (!(line = sr.ReadLine()).StartsWith("TIMEZONE_OFFSET")) ;
               int offset;
               offset = int.Parse(line.Split('=')[1]);

               string[] row;
               DateTime startDate = DateTime.Now;
               while (!sr.EndOfStream)
               {
                  line = sr.ReadLine();
                  DateTime openDate = DateTime.Now;
                  row = line.Split(new char[] { ',' });

                  if (line.StartsWith("a"))
                  {
                     // new day detected
                     string startString = row[0].Replace("a", "");
                     double seconds = double.Parse(startString);

                     startDate = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(seconds).AddMinutes(offset);
                     openDate = startDate;
                  }
                  else if (line.StartsWith("TIMEZONE_OFFSET"))
                  {
                     offset = int.Parse(line.Split('=')[1]);
                     continue;
                  }
                  else
                  {
                     // just a new bar
                     openDate = startDate.AddSeconds(long.Parse(row[0]) * interval);
                  }

                  if (!stockSerie.ContainsKey(openDate))
                  {
                     StockDailyValue dailyValue = new StockDailyValue(stockSerie.StockName,
                            float.Parse(row[4], usCulture),
                            float.Parse(row[2], usCulture),
                            float.Parse(row[3], usCulture),
                            float.Parse(row[1], usCulture),
                            long.Parse(row[5]),
                            openDate);
                     stockSerie.Add(dailyValue.DATE, dailyValue);
                  }
               }

               stockSerie.ClearBarDurationCache();

               res = true;
            }
             }
             catch (System.Exception e)
             {
            StockLog.Write("Unable to parse intraday data for " + stockSerie.StockName);
            StockLog.Write(e);
             }
             return res;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:70,代码来源:GoogleIntradayDataProvider.cs

示例6: ParseABCIntradayFile

        private bool ParseABCIntradayFile(StockSerie stockSerie, string fileName)
        {
            StockLog.Write("ParseABCIntradayFile: " + fileName);

            if (!File.Exists(fileName)) return false;
            using (StreamReader sr = new StreamReader(fileName, true))
            {
                string line = sr.ReadLine();
                while (!sr.EndOfStream)
                {
                    string[] row = line.Split(';');
                    if (row[0] == stockSerie.ISIN)
                    {
                        if (DateTime.Parse(row[1]) == stockSerie.Keys.Last())
                        {
                            return false;
                        }
                        StockDailyValue dailyValue = new StockDailyValue(
                            stockSerie.StockName,
                            float.Parse(row[2], usCulture),
                            float.Parse(row[3], usCulture),
                            float.Parse(row[4], usCulture),
                            float.Parse(row[5], usCulture),
                            long.Parse(row[6]),
                            File.GetLastWriteTime(fileName));
                        stockSerie.Add(dailyValue.DATE, dailyValue);

                        stockSerie.ClearBarDurationCache();
                        return true;
                    }
                    line = sr.ReadLine();
                }
            }
            return false;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:35,代码来源:ABCDataProvider.cs


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