Exemplo n.º 1
0
        private static async Task <IEnumerable <CurrencyTradeOffer> > GetTradeOffersAngleSharp(Currency offeredCurrency,
                                                                                               Currency requestedCurrency)
        {
            var url = GeneratePoeTradeUrl(offeredCurrency.Id, requestedCurrency.Id);


            var document = await htmlParser.ParseAsync(await MyHttpClient.GetStreamAsync(url));

            return(document.QuerySelector("#content")
                   .QuerySelectorAll(".displayoffer-middle")
                   .Select(node => {
                var index = node.TextContent.IndexOf(" ");
                return new CurrencyTradeOffer(offeredCurrency,
                                              double.Parse(node.TextContent.Substring(0, index)),
                                              requestedCurrency,
                                              double.Parse(node.TextContent.Substring(index + 3)));
            }));
        }