我想知道我应该在YQL中使用哪个表来从csv获得结果(符号AAPL)。
Date,Open,High,Low,Close,Volume,Adj Close
2014-02-12,536.95,539.56,533.24,535.92,11003600,535.92
2014-02-11,530.61,537.75,529.50,535.96,10080600,535.96
2014-02-10,518.66,531.99,518.00,528.99,12341400,528.99
因为当我使用此链接时:
http://query.yahooapis.com/v1/public/yql?q=select%20%2a%20from%20yahoo.finance.quotes%20where%20symbol%20in%20%28%22AAPL%22%29%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json
我收到了
{"query":{"count":1,"created":"2014-02-13T13:49:01Z","lang":"pl-PL","results":{"quote":{"symbol":"AAPL","Ask":"532.70","AverageDailyVolume":"12521600","Bid":"532.27","AskRealtime":"532.70","BidRealtime":"532.27","BookValue":"145.313","Change_PercentChange":"-0.04 - -0.01%","Change":"-0.04","Commission":null,"ChangeRealtime":"-0.04","AfterHoursChangeRealtime":"N/A - N/A","DividendShare":"12.20","LastTradeDate":"2/12/2014","TradeDate":null,"EarningsShare":"40.233","ErrorIndicationreturnedforsymbolchangedinvalid":null,"EPSEstimateCurrentYear":"42.81","EPSEstimateNextYear":"46.24","EPSEstimateNextQuarter":"8.66","DaysLow":"533.24","DaysHigh":"539.56","YearLow":"385.10","YearHigh":"575.14","HoldingsGainPercent":"- - -","AnnualizedGain":null,"HoldingsGain":null,"HoldingsGainPercentRealtime":"N/A - N/A","HoldingsGainRealtime":null,"MoreInfo":"cnsprmiIed","OrderBookRealtime":null,"MarketCapitalization":"478.0B","MarketCapRealtime":null,"EBITDA":"56.565B","ChangeFromYearLow":"+150.82","PercentChangeFromYearLow":"+39.16%","LastTradeRealtimeWithTime":"N/A - <b>535.92</b>","ChangePercentRealtime":"N/A - -0.01%","ChangeFromYearHigh":"-39.22","PercebtChangeFromYearHigh":"-6.82%","LastTradeWithTime":"Feb 12 - <b>535.92</b>","LastTradePriceOnly":"535.92","HighLimit":null,"LowLimit":null,"DaysRange":"533.24 - 539.56","DaysRangeRealtime":"N/A - N/A","FiftydayMovingAverage":"535.814","TwoHundreddayMovingAverage":"513.917","ChangeFromTwoHundreddayMovingAverage":"+22.003","PercentChangeFromTwoHundreddayMovingAverage":"+4.28%","ChangeFromFiftydayMovingAverage":"+0.106","PercentChangeFromFiftydayMovingAverage":"+0.02%","Name":"Apple Inc.","Notes":null,"Open":"536.92","PreviousClose":"535.96","PricePaid":null,"ChangeinPercent":"-0.01%","PriceSales":"2.75","PriceBook":"3.69","ExDividendDate":"Feb 6","PERatio":"13.32","DividendPayDate":"Feb 13","PERatioRealtime":null,"PEGRatio":"0.63","PriceEPSEstimateCurrentYear":"12.52","PriceEPSEstimateNextYear":"11.59","Symbol":"AAPL","SharesOwned":null,"ShortRatio":"1.30","LastTradeTime":"4:00pm","TickerTrend":" +++=== ","OneyrTargetPrice":"585.09","Volume":"11077535","HoldingsValue":null,"HoldingsValueRealtime":null,"YearRange":"385.10 - 575.14","DaysValueChange":"- - -0.01%","DaysValueChangeRealtime":"N/A - N/A","StockExchange":"NasdaqNM","DividendYield":"2.28","PercentChange":"-0.01%"}}}}
哪个不一样。
http://query.yahooapis.com/v1/public/yql?q=", encodeURIComponent('select * from yahoo.finance.historicaldata where symbol in ("AAPL")') + "&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json
似乎也无法正常工作。
答案 0 :(得分:2)
第一个链接只提供最新的股票报价。如果我理解您的问题,您似乎想知道从何处获取历史数据。这似乎是您需要的链接:
http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%20%3D%20%22AAPL%22%20and%20startDate%20%3D%20%222012-09-11%22%20and%20endDate%20%3D%20%222014-02-11%22&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=
我刚试了一下,它为我提供了一份JSON回复,其中包含了从2012年9月11日到2014年11月2日的历史性报价。
希望这有帮助。