private async Task PrintEventDifferentials(string symbol) { var dailyTimeSeries = await _dailyTimeSeriesApiService.Get(symbol); var event1Change = _statisticsService.Difference(dailyTimeSeries, firstEventStartDate, secondEventStartDate.AddDays(-1)); var event2Change = _statisticsService.Difference(dailyTimeSeries, secondEventStartDate, DateTime.Now.Date); WriteLine($"Event 1 Change: {event1Change}", ConsoleColor.Green); WriteLine($"Event 2 Change: {event2Change}", ConsoleColor.Green); WriteLine($"E2/E1 Change ratio: {event2Change/event1Change}", ConsoleColor.Green); }
private async Task <StockReport> CreateStockReportModel( string symbol, string companyName, string category, DateTime event1Start, DateTime event2Start) { var stockReport = new StockReport { CompanyName = companyName, Symbol = symbol, Category = category }; stockReport.CurrentPrice = (await _quoteApiService.Get(symbol)).Quote.Price; var dailyTimeSeries = await _dailyTimeSeriesApiService.Get(symbol); stockReport.ChangeFromEvent1ToEvent2 = _statisticsService.Difference(dailyTimeSeries, event1Start, event2Start.AddDays(-1)); stockReport.ChangeFromEvent2ToReportDate = _statisticsService.Difference(dailyTimeSeries, event2Start, DateTime.Now.Date); var yearlyStats = await _yearlyStatsService.GetMinAndAvg( symbol, event1Start, new List <int> { 1, 2, 3, 4, 5 }); stockReport.YearlyStats = yearlyStats.Select(y => new StockReportYearlyStats { NumberOfYearsPriorToEvent1 = y.NumberOfYears, Min = y.Min, Avg = y.Avg }).ToList(); return(stockReport); }