本文介绍了需要API来找到一个完整的公司名称给予股票代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要的方式从客户端Javascript中找到的完全的公司给出股票代码名称。我知道雅虎财经的接口为:

I need a way from within client-side Javascript to find a full company name given a ticker symbol. I am aware of Yahoo Finance's interface at:

<一个href=\"http://finance.yahoo.com/d/quotes.csv?s=TKR&f=n\">http://finance.yahoo.com/d/quotes.csv?s=TKR&f=n

和我能够访问通过YQL(因为这是跨域)。然而,这并没有返回完整的公司名称,但雅虎财经有这样的,因为它出现在他们的图表,为公司和他们对公司的网页。

and am able to access that via YQL (since this is cross-domain). However, that doesn't return the full company name, yet Yahoo Finance has such because it appears in their charts for the company and on their pages about the company.

我不需要为解决要通过雅虎财经...只是提到它作为在这里我已经知道这件事(和我访问它的其他数据)。

I don't need for the solution to be via Yahoo Finance... just mention it here as I already know about it (and am accessing it for other data).

推荐答案

一社区提供的YQL表看起来它会为你工作。yahoo.finance.stocks

One of the community-provided YQL tables looks like it will work for you: yahoo.finance.stocks.

例YQL查询:
<一href=\"http://developer.yahoo.com/yql/console/?q=select%20CompanyName%20from%20yahoo.finance.stocks%20where%20symbol%3D%22TKR%22&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys\"相对=nofollow> 选择yahoo.finance.stocks公司名称,其中符号=TKR

Example YQL query:select CompanyName from yahoo.finance.stocks where symbol="TKR"

更新2012-02-10:作为firebush在评论中指出的,这YQL社区表(yahoo.finance.stocks)似乎并没有被正确的工作多,可能是因为在finance.yahoo.com HTML页面的结构发生了变化。这是依赖于HTML刮,而不是一个真正的API的任何YQL表的缺点的一个很好的例子。 (这对于雅虎财经不存在,很遗憾。)

Update 2012-02-10: As firebush points out in the comments, this YQL community table (yahoo.finance.stocks) doesn't seem to be working correctly any more, probably because the HTML page structures on finance.yahoo.com have changed. This is a good example of the downside of any YQL tables that rely on HTML scraping rather than a true API. (Which for Yahoo Finance doesn't exist, unfortunately.)

它看起来像谷歌财经团体表仍在工作,所以这可能是尝试另一种:<一href=\"http://developer.yahoo.com/yql/console/?q=select%20%2a%20from%20google.igoogle.stock%20where%20stock%3D%27TRK%27%3B&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys\"相对=nofollow> SELECT * FROM google.igoogle.stock,其中股票='TRK';

It looks like the community table for Google Finance is still working, so this may be an alternative to try: select * from google.igoogle.stock where stock='TRK';

这篇关于需要API来找到一个完整的公司名称给予股票代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 01:35