需要一个 API 来查找给定股票代码的完整公司名称

发布于 2024-09-08 16:56:52 字数 1539 浏览 4 评论 0原文

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

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

发布评论

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

评论(5

我一向站在原地 2024-09-15 16:56:52

社区提供的 YQL 表之一看起来适合您:yahoo.finance.stocks。

YQL 查询示例:
从 yahoo.finance.stocks 中选择 CompanyName,其中 symbol="TKR"

更新 2012-02-10: 正如 firebush 在评论中指出的那样,这个 YQL 社区表 (yahoo.finance.stocks) 似乎不再正常工作,可能是因为 Finance.yahoo.com 上的 HTML 页面结构发生了变化。这是任何依赖 HTML 抓取而不是真正的 API 的 YQL 表的缺点的一个很好的例子。 (不幸的是,雅虎财经不存在。)

看起来 Google 财经的社区表仍在工作,因此这可能是尝试的替代方案:从 google.igoogle.stock 中选择 *,其中 stock='TRK';

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

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

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.)

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';

や三分注定 2024-09-15 16:56:52

我过去曾使用 Yahoo Finance 或 MSN Money 屏幕废弃此信息。例如,您可以通过访问 (链接) 获取埃克森美孚的此信息。至于 API,您可能需要自己构建一个。如需 API 检查 Xignite

I have screen scrapped this information in the past either using Yahoo Finance or MSN Money. For instance you can get this information for ExxonMobil by going to (link). As far as an API you might need to build one yourself. For an API checkout Xignite.

任性一次 2024-09-15 16:56:52

您可以在此处使用公司基础 API 中的“公司搜索”操作:http://www.mergent.com /塞尔维乌斯/

You can use the "Company Search" operation in the Company Fundamentals API here: http://www.mergent.com/servius/

千仐 2024-09-15 16:56:52

您可以使用 Jonathan Christian 的 .NET API 来使用 Yahoo 的查找服务,该 API 可在 NuGet 上的“Yahoo Stock Quotes”下找到。

https://github.com/jchristian/yahoo_stock_quotes

//Create the quote service
 var quote_service = new QuoteService();

//Get a quote
var quotes = quote_service.Quote("MSFT", "GOOG").Return(QuoteReturnParameter.Symbol,
                                                    QuoteReturnParameter.Name,
                                                    QuoteReturnParameter.LatestTradePrice,
                                                    QuoteReturnParameter.LatestTradeTime);

//Get info from the quotes
foreach (var quote in quotes)
{
    Console.WriteLine("{0} - {1} - {2} - {3}", quote.Symbol, quote.Name, quote.LatestTradePrice, quote.LatestTradeTime);
}

编辑: 发布此内容后我尝试了这个确切的代码,但它对我不起作用,所以我使用了 Yahoo Finance Managed Api 但是它不能通过 NuGet 获得。一个很好的使用示例这里

QuotesDownload dl = new QuotesDownload();
DownloadClient<QuotesResult> baseDl = dl;

QuotesDownloadSettings settings = dl.Settings;
settings.IDs = new string[] { "MSFT", "GOOG", "YHOO" };
settings.Properties = new QuoteProperty[] { QuoteProperty.Symbol,
                                        QuoteProperty.Name, 
                                        QuoteProperty.LastTradePriceOnly
                                      };            
SettingsBase baseSettings = baseDl.Settings;
Response<QuotesResult> resp = baseDl.Download();

另外,如果你只是想下载 stocktwits api 的东西在“资源”下有符号系统和行业的下载链接 http://stocktwits.com/developers/docs

You can use Yahoo's look up service using Jonathan Christian's .NET api that is available on NuGet under "Yahoo Stock Quotes".

https://github.com/jchristian/yahoo_stock_quotes

//Create the quote service
 var quote_service = new QuoteService();

//Get a quote
var quotes = quote_service.Quote("MSFT", "GOOG").Return(QuoteReturnParameter.Symbol,
                                                    QuoteReturnParameter.Name,
                                                    QuoteReturnParameter.LatestTradePrice,
                                                    QuoteReturnParameter.LatestTradeTime);

//Get info from the quotes
foreach (var quote in quotes)
{
    Console.WriteLine("{0} - {1} - {2} - {3}", quote.Symbol, quote.Name, quote.LatestTradePrice, quote.LatestTradeTime);
}

EDIT: After posting this I tried this exact code and it was not working for me so instead I used the Yahoo Finance Managed Api however it's not available via NuGet. A good example of use here

QuotesDownload dl = new QuotesDownload();
DownloadClient<QuotesResult> baseDl = dl;

QuotesDownloadSettings settings = dl.Settings;
settings.IDs = new string[] { "MSFT", "GOOG", "YHOO" };
settings.Properties = new QuoteProperty[] { QuoteProperty.Symbol,
                                        QuoteProperty.Name, 
                                        QuoteProperty.LastTradePriceOnly
                                      };            
SettingsBase baseSettings = baseDl.Settings;
Response<QuotesResult> resp = baseDl.Download();

Also if you just want to download the stuff stocktwits api has a download link for the symbology and industries under "Resources" http://stocktwits.com/developers/docs

还不是爱你 2024-09-15 16:56:52

还可以使用 Quandl.com 资源。他们的 WIKI 数据库包含 3339 只主要股票,可以通过 secwiki_tickers 获取.csv 文件。对于存储股票代码列表(美国市场的股票)的普通文件 portfolio.lst,例如:

AAPL
IBM
JNJ
MSFT
TXN

您可以扫描 .csv 文件以获取名称,例如:

import pandas as pd

df = pd.read_csv('secwiki_tickers.csv')
dp = pd.read_csv('portfolio.lst',names=['pTicker'])

pTickers = dp.pTicker.values  # converts into a list

tmpTickers = []

for i in range(len(pTickers)):
    test = df[df.Ticker==pTickers[i]]
    if not (test.empty):
        print("%-10s%s" % (pTickers[i], list(test.Name.values)[0]))

返回什么:

AAPL      Apple Inc.
IBM       International Business Machines Corporation
JNJ       Johnson & Johnson
MSFT      Microsoft Corporation
TXN       Texas Instruments Inc.

可以组合来自 Quandl 其他资源的更多库存。请参阅在线文档。

It also possible to use Quandl.com resources. Their WIKI database contains 3339 major stocks and can be fetched via secwiki_tickers.csv file. For a plain file portfolio.lst storing the list of your tickers (stocks in US markets), e.g.:

AAPL
IBM
JNJ
MSFT
TXN

you can scan the .csv file for the name, e.g:

import pandas as pd

df = pd.read_csv('secwiki_tickers.csv')
dp = pd.read_csv('portfolio.lst',names=['pTicker'])

pTickers = dp.pTicker.values  # converts into a list

tmpTickers = []

for i in range(len(pTickers)):
    test = df[df.Ticker==pTickers[i]]
    if not (test.empty):
        print("%-10s%s" % (pTickers[i], list(test.Name.values)[0]))

what returns:

AAPL      Apple Inc.
IBM       International Business Machines Corporation
JNJ       Johnson & Johnson
MSFT      Microsoft Corporation
TXN       Texas Instruments Inc.

It is possible to combine more stocks from other Quandl's resources. See the documentation online.

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