title: Is YQL not reliably returning the correct data - Any replacements?
body: <p>I'm writing an application that chooses companies based upon market cap and dividend yield.  It uses Yahoo!'s YQL REST API to get this data.  It seemed to work well yesterday, but today I saw that my program says that one of the companies had a yield of 65.95%!  No problem - a bug in my code.  So I thought.  But when I view the contents of the xml from the yql url for the stock:</p>
  
  <p><a href="http://query.yahooapis.com/v1/public/yql?q=select%20%2a%20from%20yahoo.finance.quotes%20where%20symbol%20in%20%28%22MRO%22%29&amp;env=store://datatables.org/alltableswithkeys" rel="nofollow">http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol in ("MRO")&amp;env=store://datatables.org/alltableswithkeys</a></p>
  
  <p>I see the xml I'm pasting at the bottom of the post. (I paste it in full here because when someone views it after this weekend it will be different.)</p>
  
  <p>Scroll down to the bottom and you will see that it actually says the yield of the Marathon Oil Corporation Common (MRO) stock is 65.95%.  You'll see it in the contents of the DividendYield tag.</p>
  
  <p>When I look at Yahoo!'s finance site here:
      <a href="http://finance.yahoo.com/q?s=mro" rel="nofollow">http://finance.yahoo.com/q?s=mro</a></p>
  
  <p>It shows a much more reasonable yield:</p>
  
  <pre><code>Div &amp; Yield:    0.68 (2.10%)
  </code></pre>
  
  <p>So, am I misreading this data (I hope so)?  Why the disparity between what I see in their publicly facing site and what I get from the query?  Aren't they using the same database?  </p>
  
  <p>If the content is unreliable, please point me to a different tool.  My app is in python.</p>
  
  <p>In case it's helpful, here's a minimal code snippet:</p>
  
  <pre><code>#!/usr/bin/env python 
  
  import yql
  y = yql.Public()
  q = 'use "http://www.datatables.org/yahoo/finance/yahoo.finance.quotes.xml" as yahoo.finance.quotes; select * from yahoo.finance.quotes where symbol in ("MRO")'
  result = y.execute(q)
  print result.rows[0]['DividendYield']
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>65.95
  </code></pre>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p>Edit Feb 11, 2012:</p>
  
  <p>The day after my post, I found this on the Yahoo! Developer Network:</p>
  
  <p><a href="http://developer.yahoo.com/forum/YQL/yahoo-finance-quotes-data-very-inaccurate/1313170622678-7121b5e0-317d-4a87-bd58-7a27cb8a62ce" rel="nofollow">http://developer.yahoo.com/forum/YQL/yahoo-finance-quotes-data-very-inaccurate/1313170622678-7121b5e0-317d-4a87-bd58-7a27cb8a62ce</a></p>
  
  <p>Many people there comment on getting erroneous data in a variety of fields.</p>
  
  <p>Google has an API for collecting data.  Here's an example use of it for the same company that the yql request below is about (MRO):</p>
  
  <p><a href="http://www.google.com/ig/api?stock=MRO" rel="nofollow">http://www.google.com/ig/api?stock=MRO</a></p>
  
  <p>Maybe that will help someone else, but it doesn't seem to contain dividend information, which is critical for my needs.</p>
  
  <p>Has someone else written an app that programmatically collects stock data using a source that pleases them?  If so, please share - I'm willing to move onto something else. BTW: I don't need real-time data.  I'll usually be running my app infrequently after coming home from work, after the markets are closed.</p>
  
  <p>Thank you.</p>
  
  <hr>
  
  <pre><code>&lt;query yahoo:count="1" yahoo:created="2012-02-11T06:30:09Z" yahoo:lang="en-US"&gt;&lt;results&gt;&lt;quote symbol="MRO"&gt;&lt;Ask/&gt;
  &lt;AverageDailyVolume&gt;7003410&lt;/AverageDailyVolume&gt;
  &lt;Bid/&gt;
  &lt;AskRealtime&gt;36.00&lt;/AskRealtime&gt;
  &lt;BidRealtime&gt;32.73&lt;/BidRealtime&gt;
  &lt;BookValue&gt;23.79&lt;/BookValue&gt;
  &lt;Change_PercentChange&gt;+0.55 - +1.69%&lt;/Change_PercentChange&gt;&lt;Change&gt;+0.55&lt;/Change&gt;
  &lt;Commission/&gt;
  &lt;ChangeRealtime&gt;+0.55&lt;/ChangeRealtime&gt;
  &lt;AfterHoursChangeRealtime&gt;N/A - N/A&lt;/AfterHoursChangeRealtime&gt;
  &lt;DividendShare&gt;21.50&lt;/DividendShare&gt;
  &lt;LastTradeDate&gt;2/10/2012&lt;/LastTradeDate&gt;
  &lt;TradeDate/&gt;
  &lt;EarningsShare&gt;4.125&lt;/EarningsShare&gt;
  &lt;ErrorIndicationreturnedforsymbolchangedinvalid/&gt;
  &lt;EPSEstimateCurrentYear&gt;3.66&lt;/EPSEstimateCurrentYear&gt;
  &lt;EPSEstimateNextYear&gt;4.38&lt;/EPSEstimateNextYear&gt;
  &lt;EPSEstimateNextQuarter&gt;0.89&lt;/EPSEstimateNextQuarter&gt;
  &lt;DaysLow&gt;32.04&lt;/DaysLow&gt;
  &lt;DaysHigh&gt;33.16&lt;/DaysHigh&gt;
  &lt;YearLow&gt;19.13&lt;/YearLow&gt;
  &lt;YearHigh&gt;54.33&lt;/YearHigh&gt;
  &lt;HoldingsGainPercent&gt;- - -&lt;/HoldingsGainPercent&gt;
  &lt;AnnualizedGain/&gt;
  &lt;HoldingsGain/&gt;
  &lt;HoldingsGainPercentRealtime&gt;N/A - N/A&lt;/HoldingsGainPercentRealtime&gt;
  &lt;HoldingsGainRealtime/&gt;
  &lt;MoreInfo&gt;cnsprmiIed&lt;/MoreInfo&gt;
  &lt;OrderBookRealtime/&gt;
  &lt;MarketCapitalization&gt;23.328B&lt;/MarketCapitalization&gt;
  &lt;MarketCapRealtime/&gt;
  &lt;EBITDA&gt;6.846B&lt;/EBITDA&gt;
  &lt;ChangeFromYearLow&gt;+14.02&lt;/ChangeFromYearLow&gt;
  &lt;PercentChangeFromYearLow&gt;+73.29%&lt;/PercentChangeFromYearLow&gt;
  &lt;LastTradeRealtimeWithTime&gt;N/A - &lt;b&gt;33.15&lt;/b&gt;
  &lt;/LastTradeRealtimeWithTime&gt;
  &lt;ChangePercentRealtime&gt;N/A - +1.69%&lt;/ChangePercentRealtime&gt;
  &lt;ChangeFromYearHigh&gt;-21.18&lt;/ChangeFromYearHigh&gt;
  &lt;PercebtChangeFromYearHigh&gt;-38.98%&lt;/PercebtChangeFromYearHigh&gt;
  &lt;LastTradeWithTime&gt;Feb 10 - &lt;b&gt;33.15&lt;/b&gt;
  &lt;/LastTradeWithTime&gt;
  &lt;LastTradePriceOnly&gt;33.15&lt;/LastTradePriceOnly&gt;
  &lt;HighLimit/&gt;
  &lt;LowLimit/&gt;
  &lt;DaysRange&gt;32.04 - 33.16&lt;/DaysRange&gt;
  &lt;DaysRangeRealtime&gt;N/A - N/A&lt;/DaysRangeRealtime&gt;
  &lt;FiftydayMovingAverage&gt;31.2758&lt;/FiftydayMovingAverage&gt;
  &lt;TwoHundreddayMovingAverage&gt;27.2837&lt;/TwoHundreddayMovingAverage&gt;
  &lt;ChangeFromTwoHundreddayMovingAverage&gt;+5.8663&lt;/ChangeFromTwoHundreddayMovingAverage&gt;
  &lt;PercentChangeFromTwoHundreddayMovingAverage&gt;+21.50%&lt;/PercentChangeFromTwoHundreddayMovingAverage&gt;
  &lt;ChangeFromFiftydayMovingAverage&gt;+1.8742&lt;/ChangeFromFiftydayMovingAverage&gt;
  &lt;PercentChangeFromFiftydayMovingAverage&gt;+5.99%&lt;/PercentChangeFromFiftydayMovingAverage&gt;
  &lt;Name&gt;Marathon Oil Corp&lt;/Name&gt;
  &lt;Notes/&gt;
  &lt;Open&gt;32.26&lt;/Open&gt;
  &lt;PreviousClose&gt;32.60&lt;/PreviousClose&gt;
  &lt;PricePaid/&gt;
  &lt;ChangeinPercent&gt;+1.69%&lt;/ChangeinPercent&gt;
  &lt;PriceSales&gt;1.56&lt;/PriceSales&gt;
  &lt;PriceBook&gt;1.37&lt;/PriceBook&gt;
  &lt;ExDividendDate&gt;Nov 14&lt;/ExDividendDate&gt;
  &lt;PERatio&gt;7.90&lt;/PERatio&gt;
  &lt;DividendPayDate&gt;Mar 12&lt;/DividendPayDate&gt;
  &lt;PERatioRealtime/&gt;
  &lt;PEGRatio&gt;0.99&lt;/PEGRatio&gt;
  &lt;PriceEPSEstimateCurrentYear&gt;8.91&lt;/PriceEPSEstimateCurrentYear&gt;
  &lt;PriceEPSEstimateNextYear&gt;7.44&lt;/PriceEPSEstimateNextYear&gt;
  &lt;Symbol&gt;MRO&lt;/Symbol&gt;
  &lt;SharesOwned/&gt;
  &lt;ShortRatio&gt;2.60&lt;/ShortRatio&gt;
  &lt;LastTradeTime&gt;4:02pm&lt;/LastTradeTime&gt;
  &lt;TickerTrend&gt;&amp;nbsp;++-+-=&amp;nbsp;&lt;/TickerTrend&gt;
  &lt;OneyrTargetPrice&gt;37.19&lt;/OneyrTargetPrice&gt;
  &lt;Volume&gt;9239122&lt;/Volume&gt;
  &lt;HoldingsValue/&gt;
  &lt;HoldingsValueRealtime/&gt;
  &lt;YearRange&gt;19.13 - 54.33&lt;/YearRange&gt;
  &lt;DaysValueChange&gt;- - +1.69%&lt;/DaysValueChange&gt;
  &lt;DaysValueChangeRealtime&gt;N/A - N/A&lt;/DaysValueChangeRealtime&gt;
  &lt;StockExchange&gt;NYSE&lt;/StockExchange&gt;
  &lt;DividendYield&gt;65.95&lt;/DividendYield&gt;
  &lt;PercentChange&gt;+1.69%&lt;/PercentChange&gt;
  &lt;/quote&gt;
  &lt;/results&gt;
  &lt;/query&gt;
  &lt;!-- total: 270 --&gt;
  &lt;!-- engine5.yql.ac4.yahoo.com --&gt;
  </code></pre>