title: Is it possible to use the Yahoo Query Language to download historical financial data?
body: <p>I've used the Yahoo Finance site to download historical data, using queries like this:</p>
  
  <pre><code>http://ichart.finance.yahoo.com/table.csv?s=AAPL&amp;c=1962
  </code></pre>
  
  <p>and the accompanying Python code:</p>
  
  <pre><code>import urllib.request
  with open("data.csv", "wb") as w:
      url = "http://ichart.finance.yahoo.com/table.csv?s=AAPL&amp;c=1962"
      r = urllib.request.urlopen(url).read()
      w.write(r)
  </code></pre>
  
  <p>I've also used the Yahoo Query Language to download pseudo-realtime data (i.e. data delayed by a few minutes) with queries like this:</p>
  
  <pre><code>http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22AAPL%22)&amp;env=store://datatables.org/alltableswithkeys
  </code></pre>
  
  <p>However, I can't find documentation on how to download historical data (as shown in the first query) using the YQL (as shown in the second query). I'd like to do this before the tables returned by the YQL contain much more data than simply opening/closing prices, volume, etc.</p>
  
  <p>Is there a way to download historical data using the YQL in such a way that it contains the same depth of detail as the pseudo-realtime data?</p>