コード例 #1
0
        private CurrencyRateHistoryContainer RetrieveData(string currencyName)
        {
            var now      = DateTime.Now;
            var fromDate = now.AddYears(-1);
            var toDate   = now;
            var service  = new CurrencyRateProviderYahoo();

            return(service.RetriveData(currencyName, fromDate, toDate));
        }
コード例 #2
0
        internal CurrencyHistoryData RetriveCurrencyHistoryFromWeb(string currencyName, DateTime startDate, DateTime endDate)
        {
            Log.Info(string.Format("Retrieve historical price data started for Currency {0}...", currencyName));
            var data = new CurrencyHistoryData(currencyName);

            if (currencyName.Equals(CurrencyRateProviderYahoo.GbpLabel, StringComparison.InvariantCultureIgnoreCase))
            {
                data.History.Add(new CurrencyHistoryItemData(startDate, 1));
                return(data);
            }

            var yahooService = new CurrencyRateProviderYahoo();
            var yahooData    = yahooService.RetriveData(currencyName, startDate, endDate);

            data.AddHistory(new CurrencyRateHistoryContainer(yahooData));

            Log.Info(string.Format("Retrieve historical price data successfully completed for Currency {0}!", currencyName));
            return(data);
        }