private void RefreshLoad() { foreach (var series in VolumeChart.Series) { series.Points.Clear(); } CustomerInfobox.Text = "Welcome " + cust.Name + " to MarchGains, Happy Investing"; Stock currentStock = new Stock(); API_CALL call = new API_CALL(); currentStock = call.stocklist(tickerlist); Thread.Sleep(1000); chartest(currentStock.Symbol); if (currentStock.Name == null) { StockofDay_Box.Text = "\n\n***API is busy try refreshing in a second***"; } else { StockofDay_Box.Text = "Name: " + currentStock.Name + "\r\nTicker: " + currentStock.Symbol + "\r\nCurrent Price: " + currentStock.LastPrice.ToString() + " USD" + "\r\nRecord High : " + currentStock.High.ToString() + " USD" + "\r\nRecord Low : " + currentStock.Low.ToString() + " USD" + "\r\nTime Stamp : " + currentStock.TimeStamp; } }
private void LookupButton_Click(object sender, EventArgs e) { string ticker = tickerBox.Text.ToUpper(); API_CALL call = new API_CALL(); currentStock = call.getspecificStock(ticker); StockInfoBox.Text = "Name: " + currentStock.Name + "\r\nTicker: " + currentStock.Symbol + "\r\nCurrent Price: " + currentStock.LastPrice.ToString() + " USD" + "\r\nRecord High : " + currentStock.High.ToString() + " USD" + "\r\nRecord Low : " + currentStock.Low.ToString() + " USD" + "\r\nTime Stamp : " + currentStock.TimeStamp; foreach (var series in chart1.Series) { series.Points.Clear(); } //Thread.Sleep(5000); Stockhist currentStockhist = new Stockhist(); currentStockhist = call.getstockhist(ticker, 365, "Day", "price"); if (currentStockhist.Dates != null) { for (int i = 0; i < currentStockhist.Positions.Length; i++) { chart1.Series["Close Price"].Points.AddXY(currentStockhist.Dates[i], currentStockhist.Elements[0].DataSeries.close.values[i]); } } }
public void chartest(string ticker) { //VolumeChart API_CALL call = new API_CALL(); Stockhist currentStock = new Stockhist(); currentStock = call.getstockhist(ticker, 365, "Day", "price"); if (currentStock.Dates != null) { for (int i = 0; i < currentStock.Positions.Length; i++) { VolumeChart.Series["Close Price"].Points.AddXY(currentStock.Dates[i], currentStock.Elements[0].DataSeries.close.values[i]); } } }