Yahoo Finance API csv历史数据

时间:2015-04-06 06:59:57

标签: c# jquery asp.net csv yahoo

我正在使用Yahoo Finanace CSV API获取货币兑换 https://code.google.com/p/yahoo-finance-managed/wiki/CSVAPI

                Currencies = new List<CurrencyModel>();

                string[] rates = null;

                StringBuilder codes = new StringBuilder();
                codes.Append("s=USDUSD=X");
                codes.Append(",USDAUD=X");
                codes.Append(",USDEUR=X");
                codes.Append(",USDCAD=X");
                codes.Append(",USDGBP=X");
                codes.Append(",USDJPY=X");
                codes.Append(",USDCHF=X");
                codes.Append(",USDILS=X");

                WebClient wc = new WebClient();
                var response = wc.DownloadString(string.Format("http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&{0}", codes));

                rates = response.Replace(@"""", "").Replace("=X", "").Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string rate in rates)
                {
                    var split = rate.Split(',');

                    Currencies.Add(new CurrencyModel
                    {
                        FromCurrency = split[0].Substring(0, 3),
                        ToCurrency = split[0].Substring(3, 3),
                        Rate = split[1],
                        Date = split[2],
                        Time = split[3]
                    });
                }
                return Currencies;
            }

我的问题是如何才能将今天的货币与昨天的货币相提并论?

我是否需要取昨天并自行计算?怎么做呢

由于

0 个答案:

没有答案