<p>谷歌的数据阅读器想要下载一个csv文件。因此,对于“goog”,它请求以下获取csv文件的URL:</p>
<p><a href="http://www.google.com/finance/historical?q=GOOG&startdate=Jan+1%2C+2013&enddate=Mar+1%2C+2014&output=csv" rel="nofollow">http://www.google.com/finance/historical?q=GOOG&startdate=Jan+1%2C+2013&enddate=Mar+1%2C+2014&output=csv</a></p>
<p>所有的国内股票(如IBM)都是如此。但对于“香港:0700”,它要求:</p>
<p><a href="http://www.google.com/finance/historical?q=HKG%3A0700&startdate=Jan+01%2C+2014&enddate=Mar+01%2C+2014&output=csv" rel="nofollow">http://www.google.com/finance/historical?q=HKG%3A0700&startdate=Jan+01%2C+2014&enddate=Mar+01%2C+2014&output=csv</a></p>
<p>这会产生“在该服务器上找不到请求的URL”错误。您可以查看以下历史数据:</p>
<p><a href="http://www.google.com/finance/historical?q=HKG%3A0700&startdate=Jan+01%2C+2014&enddate=Mar+01%2C+2014" rel="nofollow">http://www.google.com/finance/historical?q=HKG%3A0700&startdate=Jan+01%2C+2014&enddate=Mar+01%2C+2014</a></p>
<p>但看起来你不能得到一个csv文件。</p>
<p>当创建URL时,您可以看到它正在执行pandas/io/data.py:</p>
<pre><code># www.google.com/finance/historical?q=GOOG&startdate=Jun+9%2C+2011&enddate=Jun+8%2C+2013&output=csv
url = "%s%s" % (_HISTORICAL_GOOGLE_URL,
urlencode({"q": sym,
"startdate": start.strftime('%b %d, ' '%Y'),
"enddate": end.strftime('%b %d, %Y'),
"output": "csv"}))
</code></pre>