Question

I would like to know which table should I use in YQL to achieve result (symbol AAPL) from csv.

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

Because when I use this link:

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

I receive

{"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":"&nbsp;+++===&nbsp;","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%"}}}}

Which is not the same.

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

Seems to also not working.

Was it helpful?

Solution

The first link just gives the most recent stock quote. If I understand your question, it looks like you want to know where to get historic data. This seems to be the link you need:

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=

I just tried it and it pulled back a JSON response for me that has historic quotes from 09-11-2012 to 02-11-2014.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top