Esempio n. 1
0
        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);
                }
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
            }
        }