コード例 #1
0
ファイル: User.cs プロジェクト: tjgrist/StockTrk
        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;
        }
コード例 #2
0
ファイル: User.cs プロジェクト: tjgrist/StockTrk
        public void displayOptions(YahooFinance api, Stocks market)
        {
            bool options = true;

            while (options)
            {
                printOptionString();
                options = userChooses(api, market);
            }
        }
コード例 #3
0
ファイル: User.cs プロジェクト: tjgrist/StockTrk
        private void changeStocks(YahooFinance api)
        {
            Console.WriteLine("Which stock would you like to REPLACE or REMOVE?");
            string replacableStock = Console.ReadLine().ToUpper();

            Console.WriteLine("Press ENTER to remove this stock: {0}.\nOR, type the stock(s) with which you'd like to REPLACE {0}.", replacableStock);
            string newStock = Console.ReadLine().ToUpper();

            api.YahooUrl = api.YahooUrl.Replace(replacableStock, newStock);
            setStockList(newStock);
        }
コード例 #4
0
ファイル: User.cs プロジェクト: tjgrist/StockTrk
 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);
 }
コード例 #5
0
ファイル: User.cs プロジェクト: tjgrist/StockTrk
        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;
        }
コード例 #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);
            }
        }
コード例 #7
0
ファイル: User.cs プロジェクト: tjgrist/StockTrk
        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;
            }
        }
コード例 #8
0
ファイル: User.cs プロジェクト: tjgrist/StockTrk
        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);
            }
        }
コード例 #9
0
 public void setURL(User user, Stocks market, YahooFinance api)
 {
     yahooUrl = user.buildURL(market, api);
     showData(yahooUrl, market);
 }
コード例 #10
0
ファイル: User.cs プロジェクト: tjgrist/StockTrk
 private void viewStocks(YahooFinance api, Stocks market)
 {
     api.showData(api.YahooUrl, market);
 }