public override void InitDictionary(string rootFolder, StockDictionary stockDictionary, bool download) { SortedDictionary<string, string> cotIncludeList = new SortedDictionary<string, string>(); string[] fields; string fileName = Settings.Default.RootFolder + @"\COT.cfg"; if (File.Exists(fileName)) { using (StreamReader sr = new StreamReader(fileName)) { while (!sr.EndOfStream) { fields = sr.ReadLine().Split(';'); if (!stockDictionary.CotDictionary.ContainsKey(fields[0])) { stockDictionary.CotDictionary.Add(fields[0], new CotSerie(fields[0])); if (fields.Length > 1) { cotIncludeList.Add(fields[0], fields[1]); if (stockDictionary.ContainsKey(fields[1])) { stockDictionary[fields[1]].CotSerie = stockDictionary.CotDictionary[fields[0]]; } } } } } // Check if download Needed CotSerie SP500CotSerie = stockDictionary["SP500"].CotSerie; if (SP500CotSerie != null) { if (SP500CotSerie.Initialise()) { DateTime lastDate = DateTime.Today.AddMonths(-2); lastDate = SP500CotSerie.Keys.Last(); if ((DateTime.Today - lastDate) > new TimeSpan(10, 0, 0, 0, 0)) { // Need to download new COT StockWebHelper swh = new StockWebHelper(); bool upToDate = false; NotifyProgress("Downloading commitment of traders data..."); if (swh.DownloadCOT(Settings.Default.RootFolder, ref upToDate)) { NotifyProgress("Parsing commitment of traders data..."); ParseFullCotSeries(cotIncludeList, stockDictionary); } } } } } }