void updateTimer_Tick(object sender, EventArgs e) { //Fetching all the stocks at once in XDocument file //XDocument doc = Stock_quotes.FetchQuote(this.getAllSymbolsFromTable(data_table) + ConfigurationManager.AppSettings["DefinedStocks"]); //This will update the data_table this.addValuesToTheTable(data_table, StockItem.FetchAllStocks("")); }
/// <summary> /// Adds a stock symbol to the table or throws an ArgumentException /// </summary> /// <param name="symbol">symbol(s) to the added. Multiple entries are allowed that are separated by " " or ","</param> /// <param name="table"></param> public void addStockSymbolToTheTable(string symbol, DataTable table) { //if (symbol != null && symbol.Length > 0) //{ List <StockItem> list = StockItem.FetchAllStocks(symbol); foreach (StockItem stock in list) { table.Rows.Add(stock.Symbol, stock.CompanyName, stock.CurrentPrice, stock.PercentageOfChangeFromLastDay, stock.FiftyTwoWeekHigh, stock.FiftyTwoWeekLow); } //} //else //{ // throw new ArgumentException("Added symbol is not accepted as a valid input"); //} }