Ejemplo n.º 1
0
        private void tickerlookupbutton_Click(object sender, EventArgs e)
        {
            Quotes = new ObservableCollection <Quote>();
            if (lookuptextbox.Text != "")
            {
                //Some example tickers
                Quotes.Add(new Quote(lookuptextbox.Text.ToUpper()));
                //get the data
                YahooStockEngine.Fetch(Quotes);

                lookuphistory.Rows.Add(lookuptextbox.Text, Quotes[0].LastUpdate, Quotes[0].DividendShare, Quotes[0].Name, Quotes[0].ChangeInPercent, Quotes[0].LastTradePrice, Quotes[0].DailyHigh, Quotes[0].DailyLow);
                labeldailyhigh.Text    = Quotes[0].DailyHigh.ToString();
                labeldailylow.Text     = Quotes[0].DailyLow.ToString();
                labelyearlyhigh.Text   = Quotes[0].YearlyHigh.ToString();
                labeldividendrate.Text = Quotes[0].DividendShare.ToString();
                labelPEratio.Text      = Quotes[0].PeRatio.ToString();
                labellastupdate.Text   = Quotes[0].LastUpdate.ToString();
                labelcurrentprice.Text = Quotes[0].LastTradePrice.ToString() + " ( " + Quotes[0].ChangeInPercent.ToString() + " )";
                labeltickersymbol.Text = Quotes[0].Name.ToString() + " ( " + Quotes[0].StockExchange.ToString() + " : " + lookuptextbox.Text.ToUpper() + " )";

                lookupview.DataSource = lookuphistory;

                panel3.Refresh();
            }
            else
            {
                label30.Visible = true;
            }
        }
Ejemplo n.º 2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            Quotes = new ObservableCollection <Quote>();
            db     = new DBAccess();
            //Some example tickers
            Quotes.Add(new Quote(textBox1.Text.ToUpper()));
            //get the data
            YahooStockEngine.Fetch(Quotes);
            try
            {
                db.insert_stock(textBox1.Text.ToUpper(), Quotes[0].LastUpdate, Quotes[0].DividendShare, Quotes[0].Name, Quotes[0].StockExchange, Quotes[0].ChangeInPercent,
                                Quotes[0].LastTradePrice, Quotes[0].Volume, Quotes[0].YearlyHigh, Quotes[0].YearlyLow, Quotes[0].DailyHigh, Quotes[0].DailyLow, Quotes[0].PeRatio);

                db.insert_stockhistory(DateTime.Now, "SELL", decimal.Parse(textBox2.Text), acct, db.select_stock(textBox1.Text.ToUpper()));
            }
            catch
            {
                Console.WriteLine("error");
            }

            this.Close();
        }