从雅虎财务获得ISIN的历史价格 [英] Get historic prices by ISIN from yahoo finance

查看:152
本文介绍了从雅虎财务获得ISIN的历史价格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题:

我有大约1000个独特的证券交易所上市公司的ISIN号码。

I have around 1000 unique ISIN numbers of stock exchange listed companies.


  • 我需要这些公司的历史价格从最早的上市开始,直到今天为止。

  • I need the historic prices of these companies starting with the earliest listing until today on a daily basis.

然而,就我的研究而言,雅虎只能提供我没有的股票代码符号的价格。

However, as far as my research goes, yahoo can only provide prices for stock ticker symbols, which I do not have.

有没有办法获得 ISIN:AT0000609664 ,这是公司 Porr 雅虎通过他们的api自动提供历史价格?

Is there a way to get for example for ISIN: AT0000609664, which is the company Porr the historic prices from yahoo automatically via their api?

我感谢您的回复!

推荐答案

答案:



从中获取雅虎股票代码一个ISIN,看一下 yahoo.finance.isin 表,这是一个示例查询:

The Answer:

To get the Yahoo ticker symbol from an ISIN, take a look at the yahoo.finance.isin table, here is an example query:

http://query.yahooapis.com:80/v1/public/yql?q=select * from yahoo.finance.isin where symbol in ("DE000A1EWWW0")&env=store://datatables.org/alltableswithkeys

这将返回股票代码 ADS.DE 在XML中:

This returns the ticker ADS.DE inside an XML:

<query yahoo:count="1" yahoo:created="2015-09-21T12:18:01Z" yahoo:lang="en-US">
    <results>
        <stock symbol="DE000A1EWWW0">
            <Isin>ADS.DE</Isin>
        </stock>
    </results>
</query>
<!-- total: 223 -->
<!-- pprd1-node600-lh3.manhattan.bf1.yahoo.com -->

我担心你的例子ISIN不起作用,但这是Yahoos方面的一个错误(见< a href =http://finance.yahoo.com/lookup =nofollow noreferrer> Yahoo Symbol Lookup ,在那里输入您的ISIN以检查Yahoo上是否存在自动收报机。

I am afraid your example ISIN won't work, but that's an error on Yahoos side (see Yahoo Symbol Lookup, type your ISINs in there to check if the ticker exists on Yahoo).

抱歉,我不再精通Java或R了,但是这个C#代码应该差不多了复制/粘贴:

Sorry, I am not proficient in Java or R anymore, but this C# code should be almost similar enough to copy/paste:

public String GetYahooSymbol(string isin)
{
    string query = GetQuery(isin);
    XDocument result = GetHttpResult(query);
    XElement stock = result.Root.Element("results").Element("stock");
    return stock.Element("Isin").Value.ToString();
}

其中 GetQuery(string isin)将查询的URI返回给yahoo(请参阅我的示例URI)和 GetHttpResult(字符串URI)从Web获取XML。然后你必须提取 Isin 节点的内容,你就完成了。

where GetQuery(string isin) returns the URI for the query to yahoo (see my example URI) and GetHttpResult(string URI) fetches the XML from the web. Then you have to extract the contents of the Isin node and you're done.

我假设你已经使用股票代码符号实现实际数据获取。
另见此问题对于反问题(符号 - > isin)。但是对于记录:

I assume you have already implemented the actual data fetch using ticker symbols. Also see this question for the inverse problem (symbol -> isin). But for the record:

查询以获取符号的历史数据

http://query.yahooapis.com:80/v1/public/yql?q=select * from yahoo.finance.historicaldata where symbol in ("ADS.DE") and startDate = "2015-06-14" and endDate = "2015-09-22"&env=store://datatables.org/alltableswithkeys

您可以传递任意日期和任意的股票代码列表。您可以在代码中构建查询并从您获得的XML中提取结果。回复将是

where you may pass arbitrary dates and an arbitrary list of ticker symbols. It's up to you to build the query in your code and to pull the results from the XML you get back. The response will be along the lines of

<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="71" yahoo:created="2015-09-22T20:00:39Z" yahoo:lang="en-US">
  <results>
    <quote Symbol="ADS.DE">
      <Date>2015-09-21</Date>
      <Open>69.94</Open>
      <High>71.21</High>
      <Low>69.65</Low>
      <Close>70.79</Close>
      <Volume>973600</Volume>
      <Adj_Close>70.79</Adj_Close>
    </quote>
    <quote Symbol="ADS.DE">
      <Date>2015-09-18</Date>
      <Open>70.00</Open>
      <High>71.43</High>
      <Low>69.62</Low>
      <Close>70.17</Close>
      <Volume>3300200</Volume>
      <Adj_Close>70.17</Adj_Close>
    </quote>
    ......
  </results>
</query>
<!-- total: 621 -->
<!-- pprd1-node591-lh3.manhattan.bf1.yahoo.com -->

这应该让你足够自己编写自己的代码。请注意,在查询结束时,有可能使用& e = .csv 将数据作为.csv格式获取,但我对此不太了解或者是它适用于上面的查询,所以请参阅这里供参考。

This should get you far enough to write your own code. Note that there are possibilities to get data as .csv format with &e=.csv at the end of the query, but I don't know much about that or if it will work for the queries above, so see here for reference.

这篇关于从雅虎财务获得ISIN的历史价格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆