Beispiel #1
0
        /****
        *
        ****/
        public IActionResult StockStat(string symbol)
        {
            //Set ViewBag variable first
            ViewBag.dbSuccessChart = 0;
            CompaniesStatistics companiesEquities = getCompaniesStatisticsModel(symbol);

            return(View(companiesEquities));
        }
Beispiel #2
0
        /****
        * Returns the ViewModel CompaniesStatistics based on the data provided.
        ****/
        public CompaniesStatistics getCompaniesStatisticsModel(String symbol)
        {
            List <Gainers> gainers = dbContext.Gainers.ToList();

            if (symbol == null)
            {
                return(new CompaniesStatistics(gainers, null, 0, null, null));
            }
            IEXHandler          webHandler = new IEXHandler();
            CompaniesStatistics stat       = new CompaniesStatistics();

            stat.Companies = gainers;
            stat.symbol    = symbol;
            return(stat);
        }
Beispiel #3
0
        public IActionResult Quotes(string symbol)
        {
            PopulateGainers();
            CompaniesStatistics stat = new CompaniesStatistics();

            stat.Companies = dbContext.Gainers.ToList();
            if (symbol != null)
            {
                stat.symbol = symbol;
                IEXHandler webHandler = new IEXHandler();
                stat.quote = webHandler.getQuotes(symbol);
                dbContext.Quotes.Add(stat.quote);
            }
            dbContext.SaveChanges();
            return(View(stat));
        }
Beispiel #4
0
        public IActionResult Financials(string symbol)
        {
            PopulateGainers();
            CompaniesStatistics stat = new CompaniesStatistics();

            stat.Companies = dbContext.Gainers.ToList();
            if (symbol != null)
            {
                stat.symbol = symbol;
                IEXHandler webHandler = new IEXHandler();
                stat.financials = webHandler.getFinancials(symbol);
                foreach (FinancialsData data in stat.financials.financials)
                {
                    data.symbol = symbol;
                    dbContext.FinancialData.Add(data);
                }
            }
            dbContext.SaveChanges();
            return(View(stat));
        }