示例#1
0
            public async Task <OptionDetailsViewModel> Handle(Query request, CancellationToken cancellationToken)
            {
                var price = await _stocks.GetPrice(request.Ticker);

                if (!price.IsOk || price.Success.NotFound)
                {
                    return(null);
                }

                var dates = await _options.GetOptions(request.Ticker);

                var upToFour = dates.Take(4);

                var options = new List <OptionDetail>();

                foreach (var d in upToFour)
                {
                    var details = await _options.GetOptionDetails(request.Ticker, d);

                    options.AddRange(details);
                }

                return(MapOptionDetails(price.Success.Amount, options));
            }