public async Task CanGetStringFromExternalSite()
        {
            var requestor = new WebRequestor(this.httpClient);
            var res       = await requestor.GetString(new Uri("http://yandex.ru")).ConfigureAwait(false);

            Assert.IsNotEmpty(res);
        }
        public async Task CanGetStringFromFinamResource()
        {
            var requestor = new WebRequestor(this.httpClient);
            var res       = await requestor.GetString(new Uri("https://www.finam.ru/cache/icharts/icharts.js")).ConfigureAwait(false);

#if DEBUG
            Console.WriteLine(res);
#endif
            Assert.IsNotEmpty(res);
        }
Example #3
0
        public async Task <string> LoadData(Symbol symbol, Period period, DateTime fromDate, DateTime toDate)
        {
            var requestUrl = new QueryBuilder()
                             .WithDateRange(fromDate, toDate, period)
                             .WithSymbol(symbol)
                             .GetUrl(this.config.ExportDataUrl);

            using (var client = new HttpClient())
            {
                var requestor = new WebRequestor(client);
                return(await requestor.GetString(requestUrl).ConfigureAwait(false));
            }
        }
Example #4
0
        public async Task CanDownloadDataFromFinam()
        {
            // TODO: Refactor this: Load from Metadata Repo
            var sber = new Symbol()
            {
                MarketId = 8,
                Id       = 81075,
                Code     = "SBER"
            };

            var request = new QueryBuilder()
                          .WithDateRange(new DateTime(2016, 01, 01), new DateTime(2016, 08, 31), Period.H1)
                          .WithSymbol(sber)
                          .GetUrl(CONST_FinamExportHost);

            using (var client = new HttpClient())
            {
                var requestor = new WebRequestor(client);
                var data      = await requestor.GetString(request).ConfigureAwait(false);

                Console.WriteLine(data);
            }
        }