本帖最后由 xandy 于 2016-11-25 17:26 编辑
更多信息:
1、通过API获取实时数据
请求地址
http://finance.yahoo.com/d/quotes.csv?s=<股票名称>&f=<数据列选项>
参数说明
s –表示股票名称,多个股票之间使用英文加号分隔,如”XOM+BBDb.TO+JNJ+MSFT”,罗列了四个公司的股票:XOM,BBDb.TO, JNJ, MSFT。
f – 表示返回数据列,如”snd1l1yr”。更详细的参见雅虎股票 API f参数对照表。
2、通过API获取历史数据
请求地址
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 – 股票名称
a – 起始时间,月
b – 起始时间,日
c – 起始时间,年
d – 结束时间,月
e – 结束时间,日
f – 结束时间,年
g – 时间周期。例如g=w, 表示周期是'周'。d->'日'(day),w->'周'(week),m->'月'(mouth),v->'dividendsonly'
一定注意月份参数,其值比真实数据-1。如需要9月数据,则写为08。
下面的链接可以下载到IBM股票从2016年3月16日起到2016年7月22的数据。把ibm改成sohu,就可以抓到sohu的股票数据了。
http://table.finance.yahoo.com/table.csv?s=ibm&a=02&b=16&c=2016&d=06&e=22&f=2016&g=d&ignore=.csv
3、通过API获取深沪股票数据
雅虎的API是国际性的,支持查询国内沪深股市的数据,但代码稍微变动一下,规则是:上海市场末尾加.ss,深圳市场末尾加.sz。例如浦发银行的代号是:600000.SS。
深市数据链接:http://table.finance.yahoo.com/table.csv?s=000001.sz
上市数据链接:http://table.finance.yahoo.com/table.csv?s=600000.ss
上证综指代码:000001.ss,深证成指代码:399001.SZ,沪深300代码:000300.ss
下面就是世界股票交易所的网址和缩写,要查找哪个股票交易所的数据,就按照上面的格式以此类推。
上海交易所=cn.finance.yahoo.com,.SS,Chinese,sl1d1t1c1ohgv
深圳交易所=cn.finance.yahoo.com,.SZ,Chinese,sl1d1t1c1ohgv
美国交易所=finance.yahoo.com,,United States,sl1d1t1c1ohgv
加拿大=ca.finance.yahoo.com,.TO,Toronto,sl1d1t1c1ohgv
新西兰=au.finance.yahoo.com,.NZ,sl1d1t1c1ohgv
新加坡=sg.finance.yahoo.com,.SI,Singapore,sl1d1t1c1ohgv
香港=hk.finance.yahoo.com,.HK,Hong Kong,sl1d1t1c1ohgv
台湾=tw.finance.yahoo.com,.TW,Taiwan,sl1d1t1c1ohgv
印度=in.finance.yahoo.com,.BO,Bombay,sl1d1t1c1ohgv
伦敦=uk.finance.yahoo.com,.L,London,sl1d1t1c1ohgv
澳洲=au.finance.yahoo.com,.AX,Sydney,sl1d1t1c1ohgv
巴西=br.finance.yahoo.com,.SA,Sao Paulo,sl1d1t1c1ohgv
瑞典=se.finance.yahoo.com,.ST,Stockholm,sl1d1t1c1ohgv
【附录】雅虎股票API f参数对照表
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 |
|
|
共 0 个关于本帖的回复 最后回复于 2016-11-1 17:35