了解yahoo_quote_download [英] Understanding yahoo_quote_download
问题描述
由于Yahoo Finance终止了下载EoD价格数据的服务,因此我遇到了以下Python脚本 yahoo_quote_download 继续下载我需要的数据。不幸的是,我对Python完全陌生,我一直在努力使用这个有前途的工具。
Since Yahoo Finance terminated its service to download EoD prices data, I have come across the following Python script yahoo_quote_download to continue downloading the data I require. Unfortunately, I am completely new to Python, and I am struggling with using this promising tool.
我正在Mac OS X上运行Python 2.7.10。在脚本说明中,我没有观察到任何错误消息。 readme.md文件指出以下内容:
I am running Python 2.7.10 on Mac OS X. Having followed the installation instructions of the script, I have not observed any error messages. The readme.md file states the following:
通过新API下载的CSV文件与CSV文件有一些数据和格式差异
The CSV file downloaded through the new API has a few data and format differences from the CSV file from the original iChart source.
最有可能是由于我对Python完全陌生,所以我找不到语法
Most likely due to the fact that I am completely new to Python, I fail to find the syntax for the Python code to download data into a CSV-file as mentioned in the readme file.
与其他代码一起使用,test_yqd.py仅提供屏幕输出,例如:
Playing around with amongst others the test_yqd.py gives only screen output, for instance:
bash-3.2$ python test_yqd.py
('===', 'FP.PA', '===')
[u'Date,Dividends', u'2015-06-08,0.61', u'2016-06-06,0.61', u'2014-12-15,0.61', u'2014-03-24,0.59', u'2015-03-23,0.61', u'2016-03-21,0.61', u'2017-03-20,0.61', u'2014-09-23,0.61', u'2015-12-21,0.61', u'2015-09-28,0.61', u'2016-09-27,0.61', u'2016-12-21,0.61', u'2014-06-02,0.61', u'']
bash-3.2$
这很有希望,因为我已经测试了数据集很少,而且我似乎可以访问所需的所有数据,很遗憾,我的尝试未能下载包含该数据的CSV文件。
This is promising, because I have tested a few data sets, and I seem to get access to all of the data I require, unfortunately my attempts have failed to download a CSV file with the data.
实际上,我试图找到调用Python脚本并将数据下载到CSV中的语法。随后,我可以提取CSV文件并更新数据库并进行分析。我需要调用哪些Python命令才能使用哪些参数下载CSV文件?
Practically, I seek to find the syntax that invokes the Python script and downloads the data into a CSV. Subsequently, I can pick up the CSV file and update my database and perform analysis. What is the Python command I need to invoke with which arguments to download a CSV file?
任何有助于理解和使用yahoo_quote_download脚本的帮助都将不胜感激。 / p>
Any help that leads to understanding and using the yahoo_quote_download scripts will be much appreciate.
推荐答案
CSV代表逗号分隔值, https://en.wikipedia.org/wiki/逗号分隔值。
CSV stands for "Comma Separated Values", https://en.wikipedia.org/wiki/Comma-separated_values.
因此该数据如下您可以通过调用代码获得CSV。
So this data below you got from calling the code is the CSV.
[u'Date,Dividends', u'2015-06-08,0.61', u'2016-06-06,0.61', u'2014-12-15,0.61', u'2014-03-24,0.59', u'2015-03-23,0.61', u'2016-03-21,0.61', u'2017-03-20,0.61', u'2014-09-23,0.61', u'2015-12-21,0.61', u'2015-09-28,0.61', u'2016-09-27,0.61', u'2016-12-21,0.61', u'2014-06-02,0.61', u'']
每个都是一行,并且在每一行中有两个用逗号分隔的字段。 CSV文件只不过是写入文件中的CSV数据。如果需要CSV文件,则只需一次将此数据写入一个文件中(即,您需要在每个项目后面添加新行)。
Each of these is a line, and within each line there are two fields separated by a comma. CSV file is nothing more than the CSV data written into a file. If you need a CSV file, you just need to write this data into a file, one line at a time (i.e., you need to add a new line after each item).
您的问题似乎与Python编码无关。希望对您有所帮助。
It does not look like your issue is with Python coding. Hope it helps.
这篇关于了解yahoo_quote_download的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!