Esempio n. 1
0
        public IEnumerable <IPODto> GetIPOs(IPOQueryParameters iPOQueryParameters)
        {
            IEnumerable <IPODto> allIPOs = ScrapIPOs(SetUrl(iPOQueryParameters.Day));

            //_allIPOs = (from p in _allIPOs where iPOQueryParameters.Actions.Contains(p.Actions) select p);
            if (allIPOs == null)
            {
                return(null);
            }
            allIPOs = allIPOs.Select(x => x)
                      .Where(x => (iPOQueryParameters.Actions != null) ? iPOQueryParameters.Actions.Contains(x.Actions) : true)
                      .Where(x => (iPOQueryParameters.Exchanges != null) ? iPOQueryParameters.Exchanges.Contains(x.Exchange) : true);

            return(allIPOs);
        }
Esempio n. 2
0
        public static async Task RunAsync()
        {
            _iPOQueryParameters = new IPOQueryParameters()
            {
                Actions   = Startup.Configuration["YahooFinance:YahooIPO:BackgroudServiceQueryParameters:Actions"].Split(",").ToList <string>(),
                Exchanges = Startup.Configuration["YahooFinance:YahooIPO:BackgroudServiceQueryParameters:Exchanges"].Split(",").ToList <string>(),
            };
            _iPOScraperService = new IPOScraperService();
            var iPOResult = _iPOScraperService.GetIPOs(_iPOQueryParameters);

            if (iPOResult == null)
            {
                _logger.Warn($"{nameof(IPOBackgroundService)} job done with {nameof(iPOResult)} = null");
                return;
            }

            if (iPOResult.Any())
            {
                await IPOSenderService.PostIPO(iPOResult);
            }
            _logger.Info($"{nameof(IPOBackgroundService)} job done, IPO count: {iPOResult.Count()}");
        }