Ejemplo n.º 1
0
        private void addQuotes(YahooFinance api, Stocks market)
        {
            Console.WriteLine("Which QUOTE(s) would you like to ADD?\n" + market.showCommonQuotes());
            string addQuotes = Console.ReadLine().ToUpper().Replace(" ", "").Replace(",", "");

            api.YahooUrl       = api.YahooUrl + addQuotes;
            market.StockQuotes = market.StockQuotes + addQuotes;
        }
Ejemplo n.º 2
0
        public void displayOptions(YahooFinance api, Stocks market)
        {
            bool options = true;

            while (options)
            {
                printOptionString();
                options = userChooses(api, market);
            }
        }
Ejemplo n.º 3
0
        private void setPriceAlert(Stocks market)
        {
            Console.WriteLine("For which stock would you like an alert?");
            string alertStock = Console.ReadLine().ToUpper();

            market.alert.AlertStock = alertStock;
            Console.WriteLine("At what price (or lower) would you like an alert for {0}?", alertStock);
            string priceAlert = Console.ReadLine();

            market.alert.AskPriceAlert = priceAlert;
        }
Ejemplo n.º 4
0
 public string buildURL(Stocks market, YahooFinance api)
 {
     baseUrl = api.YahooUrl;
     Console.Write("\nWhich STOCKS would you like to view?\nSeparate your stock symbols with commas." + market.showCommonStocks());
     stocks = Console.ReadLine().ToUpper().Replace(" ", "");
     setStockList(stocks);
     Console.WriteLine("Add the stock info you would like to see.\n" + market.showCommonQuotes());
     stockCharacters    = Console.ReadLine().ToUpper().Replace(" ", "").Replace(",", "");
     market.StockQuotes = "NS" + stockCharacters;
     fullUrl            = baseUrl + stocks + "&f=NS" + stockCharacters;
     return(fullUrl);
 }
Ejemplo n.º 5
0
        private void replaceQuotes(YahooFinance api, Stocks market)
        {
            Console.WriteLine("Which QUOTE(s) would you like to REPLACE or REMOVE?");
            string replacementQuote = Console.ReadLine().ToUpper().Replace(" ", "").Replace(",", "");

            Console.WriteLine("Which Quote(s) would you like to replace it with?\nPress ENTER to REMOVE your input quotes.");
            string newQuote = Console.ReadLine().ToUpper().Replace(" ", "").Replace(",", "");

            api.YahooUrl       = api.YahooUrl.Remove(api.YahooUrl.IndexOf(market.StockQuotes));
            market.StockQuotes = market.StockQuotes.Replace(replacementQuote, newQuote);
            api.YahooUrl       = api.YahooUrl + market.StockQuotes;
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            User         user   = new User();
            YahooFinance api    = new YahooFinance();
            Stocks       market = new Stocks();

            if (user.Validated)
            {
                Console.WriteLine("\nWelcome to StockTrk, your personalized tech-stock tracker.");
                api.setURL(user, market, api);
                user.displayOptions(api, market);
                Console.WriteLine("Thanks for using StockTrk!");
                Console.ReadKey();
            }
            else
            {
                Main(args);
            }
        }
Ejemplo n.º 7
0
        private void changeQuotes(YahooFinance api, Stocks market)
        {
            Console.WriteLine("Enter 1 to REPLACE quote(s).\nEnter 2 to ADD quotes.");
            string response = Console.ReadLine();

            switch (response)
            {
            case "1":
                replaceQuotes(api, market);
                break;

            case "2":
                addQuotes(api, market);
                break;

            default:
                break;
            }
        }
Ejemplo n.º 8
0
        private bool userChooses(YahooFinance api, Stocks market)
        {
            string response = Console.ReadLine().ToLower().Replace(" ", "");

            switch (response)
            {
            case "1":
                changeStocks(api);
                return(true);

            case "2":
                changeQuotes(api, market);
                return(true);

            case "3":
                viewStocks(api, market);
                return(true);

            case "4":
                api.downloadCsv();
                Console.WriteLine("\nA .csv file was DOWNLOADED to your Downloads folder.\n");
                return(true);

            case "5":
                showRedditOptions();
                return(true);

            case "6":
                setPriceAlert(market);
                return(true);

            case "q":
                return(false);

            default:
                return(true);
            }
        }
Ejemplo n.º 9
0
 public void setURL(User user, Stocks market, YahooFinance api)
 {
     yahooUrl = user.buildURL(market, api);
     showData(yahooUrl, market);
 }
Ejemplo n.º 10
0
 private void viewStocks(YahooFinance api, Stocks market)
 {
     api.showData(api.YahooUrl, market);
 }