public static string[][] YahooHistoricalStockQuote(string name, string fromDateYear, string toDateYear, HistInterval interval) { return YahooHistoricalStockQuote(name, "1", "0", fromDateYear, "1", "0", toDateYear, interval); }
//Functions //Historical Stock Quote - (Month - 1) public static string[][] YahooHistoricalStockQuote(string name, string fromDateDay, string fromDateMonth, string fromDateYear, string toDateDay, string toDateMonth, string toDateYear, HistInterval interval) { var table = new List<string[]>(); using (WebClient web = new WebClient()) { var yahooIntervals = new string[] { "d", "w", "m" }; var yInterval = yahooIntervals[((int)interval)]; var tempPath = Environment.CurrentDirectory + @"\_tempCSV.csv"; var URL = string.Format(@"http://ichart.finance.yahoo.com/table.csv?s={0}&a={1}&b={2}&c={3}&d={4}&e={5}&f={6}&g={7}&ignore=.csv", name, fromDateMonth, fromDateDay, fromDateYear, toDateMonth, toDateDay, toDateYear, yInterval); //Delete old Temporary File if (File.Exists(tempPath)) File.Delete(tempPath); //Download Stock Info web.DownloadFile(URL, tempPath); var rawTextArray = Management.GetTextFromFile(tempPath); for (int i = 0; i < rawTextArray.Length; i++) table.Add(rawTextArray[i].Split(',')); } return table.ToArray<string[]>(); }