public async Task GetNasdaqEarningForcast() { var setting = new NasdaqEarningForecastSetting("NUAN"); var downloader = new NasdaqEarningForecastDownloader(setting); var result = await downloader.BatchDownloadObjectsStreamTaskAsync(setting.GetUrls(tickers)).ConfigureAwait(false); var orderResult = result.OrderByDescending(item => { if (item.YearlyEarningForecasts.Length == 0) { return(double.NaN); } return(item.YearlyEarningForecasts.Last().ConsensusEpsForecast); }); var repo = new EarningForecastRepository(DataBaseNames.DbEarnings); foreach (var item in orderResult) { try { repo.Save(item.QuarterlyEarningForecasts); repo.Save(item.YearlyEarningForecasts); Console.WriteLine(item.ToString()); } catch (Exception ex) { Console.WriteLine(item.Ticker + " " + ex.Message); } } }
private async Task <NasdaqEarningForecastAggregate> GetNasdaqEarningForecast(string ticker) { var setting = new NasdaqEarningForecastSetting(ticker); var downloader = new NasdaqEarningForecastDownloader(setting); var result = await downloader.DownloadObjectStreamTaskAsync().ConfigureAwait(false); return(result); }
public async Task PopulateNasdaqValuationDataPoint(string ticker) { var setting = new NasdaqEarningForecastSetting(ticker); var downloader = new NasdaqEarningForecastDownloader(setting); _nasdaqEarningForecast = await downloader.DownloadObjectTaskAsync().ConfigureAwait(false); if (!_nasdaq.ContainsKey(ticker)) { _nasdaq.Add(ticker, _nasdaqEarningForecast); } }