雅虎!财务 CSV 文件不会返回道琼斯 (^DJI)

发布于 2024-09-18 10:34:47 字数 500 浏览 7 评论 0原文

我正在尝试从 Yahoo! 检索市场数据财务和脚本多年来一直运行良好,但最近,它停止显示道琼斯数据。这是 URL:

http://download.finance.yahoo.com/d/quotes.csv?s=^DJI,^IXIC,^GSPC,^TNX&f=snl1d1t1c1ohg

该 URL 应返回以下数据:

  • Dow Jones
  • 纳斯达克
  • 标准普尔
  • 10年期债券

实际上对我来说并没有返回到CSV中,我已经尝试了我能想到的一切,但无济于事,而且我没有在网上看到有人遇到同样的问题。

有什么想法吗?有人遇到同样的问题吗?

谢谢。

I am trying to retrieve market data from Yahoo! finance and the script has worked fine for years, but recently, it stopped showing The Dow Jones data. Here is the URL:

http://download.finance.yahoo.com/d/quotes.csv?s=^DJI,^IXIC,^GSPC,^TNX&f=snl1d1t1c1ohg

The URL should return data on:

  • Dow Jones
  • NASDAQ
  • S&P
  • 10 Year Bonds

It actually doesn't get returned into the CSV for me, I have tried everything I can think of, but to no avail, and I haven't seen anyone having the same problem online.

Any ideas and is anyone having the same issues?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

绾颜 2024-09-25 10:34:47

将 ^DJI 替换为 INDU(这是道琼斯指数的股票之一)——这样就可以了。

不知道为什么 ^DJI 上周末停止工作 - 有人做了“负增强”。

奇瑞欧

GT

Replace ^DJI with INDU (that's one of the tickers for the Dow) - that will work.

No idea why ^DJI stopped working last weekend - someone has made a 'negative enhancement'.

Cheerio

GT

叹梦 2024-09-25 10:34:47

根据雅虎的说法:

http://developer.yahoo.net/forum/index.html php?showtopic=6943

感谢您写信给雅虎!金融。
我了解到您报告无法下载 ^DJI 的 CSV 数据。我当然可以向您提供更多有关此的信息。
您遇到的限制是由于道琼斯指数的限制造成的。雅虎!不再能够以这种方式提供道琼斯指数数据。对于造成的任何不便,我深表歉意。
如果我可以提供进一步的帮助,请告诉我。
再次感谢您联系雅虎!金融。
问候,
布雷特
雅虎!金融客户服务

建议使用 INDU 的另一篇文章似乎确实有效!...不知道雅虎(或道琼斯)是否错过了这篇文章,它最终会消失...

According to Yahoo at:

http://developer.yahoo.net/forum/index.php?showtopic=6943

Thank you for writing to Yahoo! Finance.
I understand you're reporting that you cannot download CSV data for ^DJI. I can certainly give you more information about this.
The limitation you are encountering is due to restrictions by the Dow Jones Index. Yahoo! is no longer able to provide Dow Jones Index data in this manner. I apologize for any inconvenience caused.
Please let me know if I can be of further assistance.
Thank you again for contacting Yahoo! Finance.
Regards,
Brett
Yahoo! Finance Customer Care

The other post that suggests using INDU does seem to work!... Wonder if Yahoo (or Dow Jones) just missed this one and it will eventually go away...

秋叶绚丽 2024-09-25 10:34:47

我知道这个问题已经回答了一段时间,但我最近遇到了这个 ^DJI 和 Yahoo!由于雅虎的另一项变化,报价再次出现问题!并提出了一个解决方案,可以帮助OP和通过搜索到达此页面的任何其他人。

作为一点背景知识,请注意,有几个 URL 可能可用于从雅虎下载历史报价数据。它们是:

1) http://download.finance.yahoo.com/d/quotes .csv

2) http://ichart.finance.yahoo.com/table。 csv

3) http://finance.yahoo.com/q/hp

1) 是 OP 列出的链接,2) 实际上是您在报价网页显示下方获得的“下载”链接,3) 是正常的历史报价网页 URL。

事实证明,正如马里奥·费尔南德斯 (Mario Fernandez) 所说,自 2011 年 8 月以来,1) 已被 ^DJI 和其他一些人屏蔽,但 2) 实际上直到前几天仍在工作。我知道这一点是因为我一直在使用它,但大约一周前它停止工作(事实证明)。顺便说一句,2) 的好处是,它实际上允许您检索比通过 1) 或 3) 明显可用的数据更多的数据,例如,您可以使用方法 2) 检索一直追溯到 1928 年的数据,但我离题了。不管怎样,正如我所说,2)最近也停止工作,这让我因无法自动更新我的数据集/模型而感到沮丧。

考虑到我实际上在我的一些模型等中使用了 ^DJI 数据,我最终花了一两个小时为普通报价页面(例如第 3 号)编写了一个页面抓取工具,现在它将直接从 HTML 报价网络获取报价页。这是在一个用 Python 编写的开源命令行下载应用程序的上下文中,我在过去的几个月里做了一些小工作。我目前用它来定期刷新我的数据集。有了最新的补丁,OP和其他想要下载^DJI的人就有了另一种可能的解决方案来根据需要下载^DJI。

如果您想尝试一下,那么您需要首先下载并安装 Python(在 Windows 上。Linux 和 Mac 内置了 Python。)我建议使用 ActiveState 的 Python 发行版,可在此处获取:

http://www.activestate.com/activepython/downloads

请注意,他们要求提供注册详细信息,但这不是强制性的。您可以忽略点击其中一个下载链接后出现的注册页面。

然后你需要pyQ程序源。您可以从此处的项目页面获取此信息:

http://bazaar.launchpad.net/~wprins/python-pyq/trunk/view/head:/pyq.py

编辑 2016-10-20:代码现已在 github 上提供,并将在 Python 3 下运行还有: https://github.com/ByteJuggler/pyq

单击“下载”链接,然后将脚本保存在合适的地方。然后打开命令提示符,“cd”到您下载脚本的文件夹,并尝试使用“pyq”运行脚本。假设已安装 Python,您应该会看到使用摘要。在最简单的形式中,像这样的命令:

pyq IBM

将获取 IBM 的实时报价行。

类似于:

pyq 20120601 20120701 IBM

... 将获取 IBM 从 20120601 到 20120701 日期的报价。等等。输出实际上是 CSV。如果您想将输出保存到文件中,请按正常方式重定向输出:

pyq 20120601 20120701 IBM >ibm.csv

无论如何,希望对某人有所帮助。 (今天早些时候,我在试图找出为什么我的 ^DJI 数据集自大约一周前以来就已经过时时偶然发现了此页面,并决定在我想出解决方案时发回此处。)

编辑:请注意 ^ DJI 您应该引用股票代码,例如:

pyq 20120601 20120701 "^DJI" >"^DJI.csv"

I know this question has been answered some time ago but I've recently run into this ^DJI and Yahoo! quotes issue again due to another change at Yahoo! and have come up with a solution that might help the OP and anyone else who reaches this page as a result of a search.

As a bit of background please note that there's several URL's that may conceivably be used to download historical quote data from Yahoo. They are:

1) http://download.finance.yahoo.com/d/quotes.csv

2) http://ichart.finance.yahoo.com/table.csv

3) http://finance.yahoo.com/q/hp

1) is the one the OP listed, 2) is effectively the "download" link that you get below the web page display of quotes and 3) is the normal historical price quote webpage URL.

It turns out that while 1) has been blocked for ^DJI and some others since Aug 2011 as metioned by Mario Fernandez, 2) was actually still working until just the other day. I know this because I've been using it and it stopped working (as it turned out) about a week ago. As an aside, 2) had the benefit that it would in fact allow you to retrieve more data than was apparently available via either 1) or 3), for example, you could retrieve data all the way back to 1928 using method 2), but I digress. Anyway, as I say, 2) also stopped working recently which left me with the frustration of not being able to keep my datasets/models updated automatically.

Given that I actually use the ^DJI data for some of my models etc, I eventually spent an hour or 2 today writing a page scraper for the normal quotes page (e.g. no. 3) which will now directly fetch quotes from the HTML quotes web page. This is in the context of an open source command line downloader application written in Python that I've done some minor work on over the last couple of months. It is what I currently use to refresh my datasets on a routine basis. With the latest patch, the OP and anyone else that want to download ^DJI has another possible solution to download ^DJI as required.

If you'd like to try this out then you'll need to download and install Python first (on Windows. Linux and Mac has Python built in.) I suggest ActiveState's Python distribution, available here:

http://www.activestate.com/activepython/downloads

Note they ask for registration details but it's not obligatory. You can just ignore the registration page you get after clicking on one of the download links.

Then you need the pyQ program source. You can get this from the project page here:

http://bazaar.launchpad.net/~wprins/python-pyq/trunk/view/head:/pyq.py

Edit 2016-10-20: Code is now available on github and will run under Python 3 as well: https://github.com/ByteJuggler/pyq

Click the "download" link, and save the script somewhere suitable. Then open up a command prompt, "cd" to the folder you've downloaded the script to, and try to run the script with "pyq". Assuming Python has been installed, you should be presented with a summary of usage. In it's simplest form, a command like:

pyq IBM

will fetch a live quote line for IBM.

Something like:

pyq 20120601 20120701 IBM

... will fetch quotes for IBM from 20120601 to 20120701 date. Etc. Output is effectively CSV. If you want to save the output to a file, then redirect the output as per normal:

pyq 20120601 20120701 IBM >ibm.csv

Anyway, hope that helps someone. (I stumbled over this page earlier today while trying to figure out why my ^DJI dataset was out of date since about a week ago and decided to post back here if/when I came up with a solution.)

Edit: Please note for ^DJI you should quote the ticker, for example:

pyq 20120601 20120701 "^DJI" >"^DJI.csv"

秋叶绚丽 2024-09-25 10:34:47

我认为您最好联系 Yahoo!金融。因为他们了解他们的系统并且很可能能够提供帮助。

I think that you are better off contacting Yahoo! Finance. As they know their system and will most likely be able to help.

_失温 2024-09-25 10:34:47

现在雅虎屏蔽了 INDU,您可以使用跟踪该指数的 ETF。我不认为他们会阻止这一点。

now that yahoo blocked INDU you can use an ETF that tracks the index instead. I don't think they would block that.

水中月 2024-09-25 10:34:47

自 Y 以来,我一直在使用 Google 财经获取数据!财务已停止运作。尽管谷歌将来也可能会改变他们的政策。在此之前,我会访问

http://finance .google.com/finance/info?lient=ig&q=INDEXDJX:.DJI&callback=

这将返回一个 JSONP 文档。

I'm using Google Finance to get the data since Y! Finance has stopped working. Albeit Google might change their policy as well in the future. Until this will happen I access

http://finance.google.com/finance/info?lient=ig&q=INDEXDJX:.DJI&callback=?

which will return a JSONP document.

意犹 2024-09-25 10:34:47

我上周看到了这个...

http://webdesignsnow.com/forums/about125.html 它描述了更改以及 csv 文件中看到的消息。

I saw this last week...

http://webdesignsnow.com/forums/about125.html which describes a change as well as the message seen in the csv file.

氛圍 2024-09-25 10:34:47

以下链接:http://finance.yahoo.com/q/hp?s= ^DJI 将为您提供一些您感兴趣的信息(例如开盘价、最高价和最低价)。

此外,以下无效代码:

wget -qO ^DJI.csv "http://ichart.finance.yahoo.com/table.csv?s=^DJI"

可以替换为以下 hack:

(echo "Date,Open,High,Low,Close,Volume,Adj Close"
for y in {0..7603..66}; do # increase 7603 if necessary
  wget -qO- "http://finance.yahoo.com/q/hp?s=^DJI&y=$y" |
    sed 's/<\/\(td\|a\)>/\n/g' |
    grep yfnc_tabledata1 |
    sed -e 's/<.*>//g' -e 's/\([0-9]\),\([0-9]\)/\1\2/g' |
    grep -v ^$ |
    awk 'BEGIN {m["Jan"]=1; m["Feb"]=2; m["Mar"]=3;
    m["Apr"]=4; m["May"]=5; m["Jun"]=6;
    m["Jul"]=7; m["Aug"]=8; m["Sep"]=9;
    m["Oct"]=10; m["Nov"]=11; m["Dec"]=12}
    NR%7==1 {printf "%d-%02d-%02d,",$3,m[$1],$2}
    NR%7>1 {printf "%s,",$0} NR%7==0'
done) > ^DJI.csv

,它将生成一个表格,其中包含 ^DJI 从 1985 年 1 月 29 日开始的每日历史数据。

The following link: http://finance.yahoo.com/q/hp?s=^DJI will give you some of the information that you are interested in (like Open, DaysHigh, and DaysLow).

Furthermore, the following non-functioning code:

wget -qO ^DJI.csv "http://ichart.finance.yahoo.com/table.csv?s=^DJI"

can be replaced with the following hack:

(echo "Date,Open,High,Low,Close,Volume,Adj Close"
for y in {0..7603..66}; do # increase 7603 if necessary
  wget -qO- "http://finance.yahoo.com/q/hp?s=^DJI&y=$y" |
    sed 's/<\/\(td\|a\)>/\n/g' |
    grep yfnc_tabledata1 |
    sed -e 's/<.*>//g' -e 's/\([0-9]\),\([0-9]\)/\1\2/g' |
    grep -v ^$ |
    awk 'BEGIN {m["Jan"]=1; m["Feb"]=2; m["Mar"]=3;
    m["Apr"]=4; m["May"]=5; m["Jun"]=6;
    m["Jul"]=7; m["Aug"]=8; m["Sep"]=9;
    m["Oct"]=10; m["Nov"]=11; m["Dec"]=12}
    NR%7==1 {printf "%d-%02d-%02d,",$3,m[$1],$2}
    NR%7>1 {printf "%s,",$0} NR%7==0'
done) > ^DJI.csv

which will generate a table with daily historical data for the ^DJI starting from January 29, 1985.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文