public ProductController(StockDataRepository <Products> dataRepository) { _dataRepository = dataRepository; IEnumerable <Products> products = _dataRepository.GetAll(); bool hasElements = products.Any(); if (!hasElements) { var product1 = new Products { //Id = 1, Model = "Mazda 3", Description = "New Model", Year = 2018, Brand = "Mazda", Kilometers = 100, Price = 320689 }; var product2 = new Products { //Id = 2, Model = "KIA Forte", Description = "Innovation", Year = 2019, Brand = "KIA", Kilometers = 68, Price = 378569 }; _dataRepository.Add(product1); _dataRepository.Add(product2); } }
public void StockDataList() { var rep = new StockDataRepository(); var items = rep.GetStockDataListByDebtor("000504"); items.Should().NotBeNull(); }
public void RetrieveHTMLTest() { //Arrange var stockData = new StockDataRepository(); //Act var retrieved = stockData.RetrieveHTML("September17"); //Assert Assert.AreEqual("ABMD", retrieved[0].Symbol); }
public void GetMonthsTest() { //Arrange var stockData = new StockDataRepository(); //Act var months = stockData.GetMonths(); bool gathered = months.Contains("October17"); //Assert Assert.AreEqual(gathered, true); }
public void RetrieveFundamentalsTest() { //Arrange var stockData = new StockDataRepository(); //Act stockData.RetrieveHTML("September17"); var retrieved = stockData.RetrieveFundamentals("September17"); var notSet = retrieved.FindAll(symbol => symbol.ADX == 0); //Assert Assert.AreEqual(notSet.Count, 0); }
private void PredictGetHTML(object sender, RoutedEventArgs e) { if (predictionMonth != null && Ready) { Ready = false; stockRepo = new StockDataRepository(); var stockData = stockRepo.RetrieveFutureHTML(predictionMonth); PredictionData.ItemsSource = null; PredictionData.ItemsSource = stockData; SizeToContent = SizeToContent.Width; predictHTMLGathered = true; Ready = true; } }
public void SubsetsTest() { var fundamentals = new FundamentalChooser(); var stock = new StockDataRepository(); var set = new List <string> { "ADX", "BBANDS", "BOP", "MACD", "MOM", "RSI" }; var result = fundamentals.SubSetsOf(set); var stockData = stock.RetrieveHTML("October17"); stockData = stock.RetrieveFundamentals("October17"); var stockTest = new StockData { Symbol = "TEST", Price = 10, EarningsGrowth = 1, ADX = 30, BBANDS = .5, BOP = -.03, MACD = -2, MOM = -.03, RSI = 40, Gain = 1.07, ForwardPE = 4 }; foreach (var symbol in stockData) { foreach (var list in result) { fundamentals.BuildComparison((StockData)symbol, list.Distinct().ToList()); } } }
private async Task SetSingleQuoteData(UpsertSingleQuoteData data) { var repo = new StockDataRepository(AppTestSettings.Instance.GetDbOptionsMonitor()); await repo.UpsertSingleQuoteData(data); }
public StockDataController() { stockDataRepository = new StockDataRepository(); userRepository = new UserRepository(); logger = new SystemLogger(); }
public static void Main(string[] args) { IStockDataRepository stockDataRepository = new StockDataRepository(); IParseRawStockData parseRawData = new ParseRawStockData(stockDataRepository); //Specify stock symbol and time frame string[] ticker = new string[] { "COF", "GOOGL", "MSFT" }; string startDate = "2017-01-01"; string endDate = "2017-06-30"; string apiKey = "PUT YOUR OWN API KEY"; //Quandl api url for the specified time and tickers string quandlUrl = "https://www.quandl.com/api/v3/datatables/WIKI/PRICES.json?" + "date.gte=" + startDate + "&" + "date.lte=" + endDate + "&" + "ticker=" + string.Join(",", ticker) + "&" + "api_key=" + apiKey; string errorMessage = "Please, select from the available choices. To continue, press the -Enter- key"; string continueMessage = "Please press the -Enter- key to continue"; int selection = 0; bool validSelection = false; while (selection != 3) { //Display options for the user Console.WriteLine($"Please select from the following options for stock data analysis.\n" + $" \n" + $"[1] - Monthly Average Open and Close Prices\n" + $"[2] - Max profit date if bought at low and sold at highest price of the day\n" + $"[3] - QUIT"); //Display stock analysis based on the user's option validSelection = int.TryParse(Console.ReadLine(), out selection); if (validSelection) { DataAnalysis dataAnalysis = new DataAnalysis(parseRawData); switch (selection) { case 1: Console.WriteLine(dataAnalysis.AverageMontlyOpenClosePrice(quandlUrl)); Console.WriteLine(continueMessage); break; case 2: Console.WriteLine(dataAnalysis.MaxDailyProfit(quandlUrl)); Console.WriteLine(continueMessage); break; case 3: Console.WriteLine("Quiting app . . . Press -Enter- to Quit."); break; default: Console.WriteLine(errorMessage); break; } } else { Console.WriteLine(errorMessage); } Console.ReadKey(); } }