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;
        }
        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;
        }
        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);
             }
        }
        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;
        }
        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;
        }
        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;
        }