banner
李大仁博客

李大仁博客

天地虽大,但有一念向善,心存良知,虽凡夫俗子,皆可为圣贤。

Use Yahoo API to access Yahoo's stock market data interface (real-time quotes, K-line, etc.)

Found on the internet, the Yahoo Finance API interface can basically obtain stock, index, and foreign exchange data from various markets around the world. However, it seems that there is no data available for Japan domestically, but after investigation, it was found that it can be obtained using other methods, which will be included in a subsequent blog post.

  1. Get real-time data
    http://finance.yahoo.com/d/quotes.csv?s=stock+name&f=data+column+options
    s - represents the stock name, multiple stocks are separated by plus signs, such as "XOM+BBDb.TO+JNJ+MSFT", listing four companies' stocks: XOM, BBDb.TO, JNJ, MSFT.
    f - represents the returned data columns, such as "snd1l1yr".

  2. Historical data request
    http://ichart.yahoo.com/table.csv?s=string&a=int&b=int&c=int&d=int&e=int&f=int&g=d&ignore=.csv
    s - stock name
    a - start time, month
    b - start time, day
    c - start time, year
    d - end time, month
    e - end time, day
    f - end time, year
    g - time period.
    The parameter g can have the following values: d->'day', w->'week', m->'month', v->'dividends only'
    The month starts from 0, so for September data, it should be written as 08.

Reference URLs:
http://blog.sina.com.cn/s/blog\_71302a17010100on.html
http://www.gummy-stuff.org/Yahoo-data.htm
http://hi.baidu.com/arjsyy/blog/item/3057167ab50157d50ad1878a.html

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.