开发者

Yahoo! Finance API DOW [closed]

开发者 https://www.devze.com 2023-04-07 18:20 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. 开发者_开发知识库 Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers. 开发者_开发知识库

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 9 years ago.

Improve this question

Until now, I've been using the INDU ticker to follow the DOW with the Yahoo! API. For whatever reason you were unable to directly follow ^dji ^djia or any other reasonable combination. Up until yesterday, INDU was working fine. However now I receive no data when requesting indu.

What other ticker can I use with the Yahoo! finance API that will return the DJIA?


This index is not available under any other name.

However, this problem was just a temporary glitch, now resolved by Yahoo. Unfortunately, their financial data availability is very flaky lately. E.g. data available on the web page, but CSV downloads give "N/A" for all fields, etc. There were similar incidents in recent months, with stock prices for random stocks given wrong values, and more.

So, if you're building a new service around these Yahoo services, be aware that:

  1. These services are not reliable.
  2. You're breaking Yahoo ToS, so there's nothing you can do if they are broken / not working, you cannot even complain to Yahoo in good faith. According to Yahoo (post by Yahoo Developer Network Community Manager Robyn Tippins on Yahoo developer forums):

    The reason for the lack of documentation is that we don't have a Finance API. It appears some have reverse engineered an API that they use to pull Finance data, but they are breaking our Terms of Service (no redistribution of Finance data) in doing this so I would encourage you to avoid using these webservices.


The formula for the DJIA isn't very complicated. If you are still able to pull quotes from individual stocks, you could use your code to pull the prices of the existing 30 components of the DJIA, add them up and divide by the current divisor. Of course, this has several disadvantages.

  1. You need to make 30 requests instead of one.
  2. You will have to adjust the divisor if there is a stock-split.
  3. You will have to change the the queries when the components change.

The components of the DJIA are

AA AXP BA BAC CAT CSCO CVX DD DIS GE HD
HPQ IBM INTC JNJ JPM KFT KO MCD MMM MRK 
MSFT PFE PG T TRV UTX VZ WMT XOM

The current divisor is 0.132129493. The divisor changes whenever there is a stock split in on of the components. The components of the DOW changed 48 times from 1896-2009.


It seems like Yahoo Finance does not support the web service to query ^DJI or INDU.

Check out this discussion:

http://developer.yahoo.com/forum/General-Discussion-at-YDN/Dow-Jones-Industrial-Average-Quote-Error/1317052217631-f9173931-04fd-4519-b1b3-efb65d7ff8fa/1317065435082


Assuming that your application does not need to be real time market data (to the second), you can use the RAW data that is provided to build the interactive graph on yahoo. This data is comma separated and updates about once every minute. The downside: it will include all the data from the trading day. The time given is in Unix time so a conversion would be needed. I tried this out for the ticker symbols you listed and the only one I was able to get data with was ^dji. Hopefully this is what you are looking for!

You can mess with the link and see what happens to the data. For example you can change the amount of days.

http://chartapi.finance.yahoo.com/instrument/1.0/%5Edji/chartdata;type=quote;range=1d/csv/


I think Yahoo Finance All Currencies quote API Documentation will help you.

I found a Yahoo forum answer that says we cannot download CSV data for ^DJI.

Check also YQL console. This console will fetch values in JSON format.


The DIA ticker (SPDR Dow Jones Industrial Average) closely imitates the Dow.

0

精彩评论

暂无评论...
验证码 换一张
取 消