Stock API-yahoo financial channel

Source: Internet
Author: User
Tags ichart
Document directory
  • Request address
  • Parameters
  • Example
  • Request address
  • Parameters
  • Example
  • Reference

This article describes the yahoo financial channel's API for obtaining stock data. You can use this API to obtain real-time data.

Real-time Data Request address
Http://finance.yahoo.com/d/quotes.csv? S = <stock name> & F = <data column Options>
Parameters
  • S-indicates the stock name. Multiple stocks are separated by the plus signs, for example, "XOM + bbdb. to + jnj + MSFT ", which lists the shares of four companies: XOM and bbdb. to, jnj, MSFT.
  • F-indicates the returned data column, such as "snd1l1yr ". For more details, see the appendix.
Example
http://finance.yahoo.com/d/quotes.csv?s=XOM+BBDb.TO+JNJ+MSFT&f=snd1l1yr

Return Value:

"XOM","Exxon Mobil Corpo","10/7/2010",63.85,2.69,12.33
"BBD-B.TO","BOMBARDIER INC., ","10/7/2010",5.27,1.90,N/A
"JNJ","Johnson & Johnson","10/7/2010",63.22,3.26,13.06
"MSFT","Microsoft Corpora","10/7/2010",24.53,2.12,11.68
Historical data requests

The preceding figure shows the latest data. To obtain historical data, use the following API.

Request address
http://ichart.yahoo.com/table.csv?s=<string>&a=<int>&b=<int>&c=<int>&d=<int>&e=<int>&f=<int>&g=d&ignore=.csv
Parameters
  • 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. Example: g = W, indicating the cycle is 'Week '. D-> 'day' (day), w-> 'Week' (week), M-> 'month' (mouth), V-> 'dividends only'

Pay attention to the month parameter. Its value is greater than the actual data-1. If you need the data for January 1, September, it is written as 08.

Example

Query the daily data of Shanghai Pudong Development Bank between 2010.09.25 and 2010.10.8

http://ichart.yahoo.com/table.csv?s=600000.SS&a=08&b=25&c=2010&d=09&e=8&f=2010&g=d

Return Value:

Date,Open,High,Low,Close,Volume,Adj Close
2010-09-30,12.37,12.99,12.32,12.95,76420500,12.95
2010-09-29,12.20,12.69,12.12,12.48,79916400,12.48
2010-09-28,12.92,12.92,12.57,12.58,63988100,12.58
2010-09-27,13.00,13.02,12.89,12.94,43203600,12.94
Shenzhen-Shanghai Stock Code

Yahoo's API is international and supports the domestic Shanghai and Shenzhen stock markets, but the code changes slightly. For example, the Code of Shanghai and Shenzhen Pudong Development Bank is 600000.ss. The rule is: Add. SS at the end of the Shanghai market, and Add. sz at the end of the Shenzhen Market.

-- EOF --

Reference
  • Http://code.google.com/p/yahoo-finance-managed/
  • Http://finance.yahoo.com/
  • Http://www.gummy-stuff.org/Yahoo-data.htm
  • Python API class http://www.goldb.org/ystockquote.html
  • Ruby API class http://www.transparentech.com/opensource/yahoofinance

Appendix

Yahoo stock api f parameter table

A Ask A2 Average daily volume A5 Ask size
B Bid B2 Ask (Real-Time) B3 Bid (Real-Time)
B4 Book value B6 Bid size C Change & percent change
C1 Change C3 Commission C6 Change (Real-Time)
C8 After hours change (Real-Time) D Dividend/share D1 Last trade date
D2 Trade Date E Earnings/share E1 Error Indication (returned for symbol changed/invalid)
E7 EPS estimate current year E8 EPS estimate next year E9 EPS estimate next quarter
F6 Float shares G Day's low H Day's high
J 52-week low K 52-week high G1 Holdings gain percent
G3 Annualized gain G4 Holdings gain G5 Holdings gain percent (Real-Time)
G6 Holdings gain (Real-Time) I More Info I5 Order Book (Real-Time)
J1 Market capitalization J3 Market cap (Real-Time) J4 EBITDA
J5 Change from 52-week low J6 Percent change from 52-week low K1 Last trade (Real-Time) with time
K2 Change percent (Real-Time) K3 Last trade size K4 Change from 52-week high
K5 Percebt change from 52-week high L Last trade (with time) L1 Last trade (price only)
L2 High Limit L3 Low limit M Day's range
M2 Day's range (Real-Time) M3 50-day moving average M4 200-day moving average
M5 Change from 200-day moving average M6 Percent change from 200-day moving average M7 Change from 50-day moving average
M8 Percent change from 50-day moving average N Name N4 Notes
O Open P Previous close P1 Price paid
P2 Change in percent P5 Price/sales P6 Price/book
Q Ex-dividend date R P/E ratio R1 Dividend pay date
R2 P/E ratio (Real-Time) R5 PEG ratio R6 Price/EPS estimate current year
R7 Price/EPS estimate next year S Symbol S1 Shares owned
S7 Short Ratio T1 Last trade time T6 Trade links
T7 Ticker Trend T8 1 yr target price V Volume
V1 Holdings Value V7 Holdings value (Real-Time) W 52-week range
W1 Day's value change W4 Day's value change (Real-Time) X Stock Exchange
Y Dividend yield

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.