public TimeSeriesCollection<InterestRate> GetInterestRateData(string currencyName)
 {
     if (!_currencyNameInterestRateTable.Keys.Contains(currencyName))
     {
         TimeSeriesCollection<InterestRate> inRateCollection = new TimeSeriesCollection<InterestRate>();
         inRateCollection.AddTimeSeriesData(
             _inRateAdapter.GetInterestRates(currencyName)
             .Select(c => new InterestRate()
             {
                 CurrencyName = currencyName,
                 Time = c.Date,
                 Value = c.Value
             })
             );
         _currencyNameInterestRateTable[currencyName] = inRateCollection;
     }
     return _currencyNameInterestRateTable[currencyName];
 }
        public CurrencyPairData GetCurrencyPairData(string baseCurrencyName, string variableCurrencyName)
        {
            if (!_currencyPairDataTable.Keys.Contains(new Tuple<string, string>(baseCurrencyName, variableCurrencyName)))
            {
                CurrencyPairData currencyData = new CurrencyPairData(baseCurrencyName, variableCurrencyName);

                TimeSeriesCollection<ExchangeRateBid> exRateCollection = new TimeSeriesCollection<ExchangeRateBid>();
                exRateCollection.AddTimeSeriesData(
                    _exRateAdapter.GetExchangeRates(baseCurrencyName, variableCurrencyName).
                        Select(a => new ExchangeRateBid()
                        {
                            BaseCurrencyName = baseCurrencyName,
                            VariableCurrencyName = variableCurrencyName,
                            Time = a.Date,
                            Value = a.BidPrice
                        }));
                currencyData.ExchangeRates = exRateCollection;

                TimeSeriesCollection<ExchangeRateAsk> exAskRateCollection = new TimeSeriesCollection<ExchangeRateAsk>();
                exAskRateCollection.AddTimeSeriesData(
                    _exRateAdapter.GetExchangeRates(baseCurrencyName, variableCurrencyName).
                        Select(a => new ExchangeRateAsk()
                        {
                            BaseCurrencyName = baseCurrencyName,
                            VariableCurrencyName = variableCurrencyName,
                            Time = a.Date,
                            Value = a.AskPrice
                        }));
                currencyData.AskExchangeRates = exAskRateCollection;

                currencyData.VariableCurrencyInterestRates = GetInterestRateData(variableCurrencyName);
                currencyData.BaseCurrencyInterestRates = GetInterestRateData(baseCurrencyName);

                //_currencyDataTable[variableCurrencyName] = currencyData;
                _currencyPairDataTable[new Tuple<string, string>(baseCurrencyName, variableCurrencyName)] = currencyData;
               
            }
            return _currencyPairDataTable[new Tuple<string, string>(baseCurrencyName, variableCurrencyName)];
        }
        public CurrencyData GetCurrencyData(Currency variableCurrency)
        {
            if (!_currencyDataTable.Keys.Contains(variableCurrency))
            {

                CurrencyAdapter currrencyAdapter = null;// = new CurrencyAdapter();
                var currencyList = currrencyAdapter.GetCurrencies();

              
                CurrencyData currencyData = new CurrencyData(_baseCurrency,variableCurrency);

                //TimeSeriesCollection<InterestRate> baseInRateCollection = new TimeSeriesCollection<InterestRate>();
                //baseInRateCollection.AddTimeSeriesData(
                //        inRateAdapter.GetInterestRates(BaseCurrency.Name)
                //        .Select(c => new InterestRate()
                //        {
                //            Currency = BaseCurrency,
                //            Time = c.Date,
                //            Value = c.Value
                //        })
                //        );

                currencyData.BaseCurrencyInterestRates = _baseInRateCollection;

                TimeSeriesCollection<ExchangeRate> exRateCollection = new TimeSeriesCollection<ExchangeRate>();
                exRateCollection.AddTimeSeriesData(
                    _exRateAdapter.GetExchangeRates(BaseCurrency.Name, variableCurrency.Name).
                        Select(a => new ExchangeRate()
                        {
                            BaseCurrency = BaseCurrency,
                            VariableCurrency = variableCurrency,
                            Time = a.Date,
                            Value = a.AskPrice // TODO
                        }));
                currencyData.ExchangeRates = exRateCollection;
                
                TimeSeriesCollection<InterestRate> varInRateCollection = new TimeSeriesCollection<InterestRate>();
                varInRateCollection.AddTimeSeriesData(
                        _inRateAdapter.GetInterestRates(variableCurrency.Name)
                        .Select(c => new InterestRate()
                        {
                            Currency = variableCurrency,
                            Time = c.Date,
                            Value = c.Value
                        })
                        );
                currencyData.VariableCurrencyInterestRates = varInRateCollection;

                _currencyDataTable[variableCurrency] = currencyData;
                return currencyData;


            }
            else
            {
                return _currencyDataTable[variableCurrency];
            }
        }