新浪A股、港股、美股、股票期权行情接口

最近一直在做股票相关的东西,但是股票行情数据花钱来买对于个人用户来说还是太贵了,查了好多资料,总的来说新浪的行情接口还是比较稳定比较全的。以下是把获取的行情字符串通过逗号分开,产生一个数组,并列了每一个对应的含义,部分没找到,欢迎大家来完善

具体如下:

A股

sh上海 sz深圳

http://hq.sinajs.cn/list=sh600379

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_sh600379="宝光股份,18.100,18.190,19.080,19.090,18.100,19.080,19.090,2871283,53939719.000,1100,19.080,4600,19.070,5500,19.060,6200,19.050,13900,19.040,13159,19.090,20122,19.100,8000,19.110,7800,19.120,1300,19.130,2016-06-22,15:00:00,00";  

temp[0]------宝光股份------股票名称

temp[1]------18.100------今日开盘价

temp[2]------18.190------昨日收盘价

temp[3]------19.080------现价(股票当前价,收盘以后这个价格就是当日收盘价)

temp[4]------19.090------最高价

temp[5]------18.100------最低价

temp[6]------19.080------买一

temp[7]------19.090------卖一

temp[8]------2871283------总量(成交量,成交的股票数,由于股票交易以一百股为基本单位,所以在使用时,通常把该值除以一百;)

temp[9]------53939719.000------成交额,单位为“元”,为了一目了然,通常以“万元”为成交金额的单位,所以通常把该值除以一万;

temp[10]------1100------买一挂单数量(也就是11手)

temp[11]------19.080------买一

temp[12]------4600------买二挂单数量

temp[13]------19.070------买二

temp[14]------5500------买三挂单数量

temp[15]------19.060------买三

temp[16]------6200------买四挂单数量

temp[17]------19.050------买四

temp[18]------13900------买五挂单数量

temp[19]------19.040------买五

temp[20]------13159------卖一挂单数量

temp[21]------19.090------卖一

temp[22]------20122------卖二挂单数量

temp[23]------19.100------卖二

temp[24]------8000------卖三数量

temp[25]------19.110------卖三

temp[26]------7800------卖四数量

temp[27]------19.120------卖四

temp[28]------1300------卖五数量

temp[29]------19.130------卖五

temp[30]------2016-06-22------日期

temp[31]------15:00:00------时间

temp[32]------00------00表示收盘

港股

http://hq.sinajs.cn/list=hk00001

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_hk00001="CHEUNG KONG,长和,90.300,91.050,91.050,90.000,90.750,-0.300,-0.329,90.650,90.750,627798876,6932826,2.954,2.810,118.800,87.600,2016/06/22,16:01";  

temp[0]------CHEUNG KONG------名称

temp[1]------长和------股票名称

temp[2]------90.300------今日开盘价

temp[3]------91.050------昨日收盘价

temp[4]------91.050------最高价

temp[5]------90.000------最低价

temp[6]------90.750------当前价(现价)

temp[7]------ -0.300------涨跌

temp[8]------ -0.329------涨幅

temp[9]------90.650------买一

temp[10]------90.750------卖一

temp[11]------627798876------成交额

temp[12]------6932826------成交量

temp[13]------2.954------市盈率

temp[14]------2.810------周息率(2.810%)

temp[15]------118.800------52周最高

temp[16]------87.600------52周最低

temp[17]------2016/06/22------日期

temp[18]------16:01------时间

美股

http://hq.sinajs.cn/list=gb_sina

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_gb_sina="新浪,48.98,-0.57,2016-06-22 08:19:42,-0.28,49.31,49.83,48.92,57.01,32.61,280775,609728,3443098080,0.79,62.00,0.00,1.15,0.00,0.00,70296000,58.00,48.98,0.00,0.00,,Jun 21 04:00PM EDT,49.26,0.00";  

temp[0]------新浪------

temp[1]------48.98------当前价

temp[2]------ -0.57------涨幅(-0.57%)

temp[3]------2016-06-22 08:19:42------时间

temp[4]------ -0.28------涨跌

temp[5]------49.31------开盘价

temp[6]------49.83------最高价

temp[7]------48.92------最低价

temp[8]------57.01------52周最高

temp[9]------32.61------52周最低

temp[10]------280775------成交量

temp[11]------609728------10日均量

temp[12]------3443098080------市值

temp[13]------0.79------每股收益

temp[14]------62.00------市盈率

temp[15]------0.00------

temp[16]------1.15------贝塔系数

temp[17]------0.00------

temp[18]------0.00------

temp[19]------70296000------股本

temp[20]------58.00------

temp[21]------48.98------今日收盘价

temp[22]------0.00------

temp[23]------0.00------

temp[24]------------

temp[25]------Jun 21 04:00PM EDT------

temp[26]------49.26------昨日收盘价

temp[27]------0.00------

股票期权

http://hq.sinajs.cn/list=OP_UP_5100501606(认购期权)

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_OP_UP_5100501606="CON_OP_10000567,CON_OP_10000551,CON_OP_10000552,CON_OP_10000541,CON_OP_10000535,CON_OP_10000529,CON_OP_10000523,CON_OP_10000459,CON_OP_10000449,CON_OP_10000450,CON_OP_10000451,CON_OP_10000452,CON_OP_10000453,CON_OP_10000463,CON_OP_10000464,CON_OP_10000469,CON_OP_10000473,CON_OP_10000477,";  

http://hq.sinajs.cn/list=OP_DOWN_5100501606(认沽期权)

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_OP_DOWN_5100501606="CON_OP_10000568,CON_OP_10000553,CON_OP_10000554,CON_OP_10000542,CON_OP_10000536,CON_OP_10000530,CON_OP_10000524,CON_OP_10000460,CON_OP_10000454,CON_OP_10000455,CON_OP_10000456,CON_OP_10000457,CON_OP_10000458,CON_OP_10000465,CON_OP_10000466,CON_OP_10000470,CON_OP_10000474,CON_OP_10000478,";  

可以通过上面两个地址获取当月认购和认沽期权的代码,OP_UP_5100501606和OP_DOWN_5100501606的最后四位是年的最后两位+当月,比如2017年7月,后四位就是1707。然后通过下面的地址获取具体期权的行情数据。

http://hq.sinajs.cn/list=CON_OP_10000555

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_CON_OP_10000555="2,0.2527,0.2537,0.2545,1,4078,5.27,1.8500,0.2410,0.2438,0.4732,0.0508,0.2600,1,0.2574,10,0.2571,1,0.2550,1,0.2545,1,0.2527,2,0.2524,1,0.2523,2,0.2513,10,0.2504,14,2016-06-22 15:05:45,0,E01,EBS,510050,50ETF购9月1850,6.64,0.2549,0.2389,263,653858.00";  

temp[0]------2------买一挂单

temp[1]------0.2527------买一价格

temp[2]------0.2537------现价 当前价

temp[3]------0.2545------卖一价格

temp[4]------1------卖一挂单

temp[5]------4078------持仓

temp[6]------5.27------涨幅

temp[7]------1.8500------行权价

temp[8]------0.2410------昨结

temp[9]------0.2438------今开

temp[10]------0.4732------涨停价格

temp[11]------0.0508------跌停价格

temp[12]------0.2600------卖5

temp[13]------1------卖5挂单量

temp[14]------0.2574------卖4

temp[15]------10------卖4挂单量

temp[16]------0.2571------卖3

temp[17]------1------卖3挂单

temp[18]------0.2550------卖2

temp[19]------1------卖2挂单

temp[20]------0.2545------卖1

temp[21]------1------卖1挂单

temp[22]------0.2527------买1

temp[23]------2------买1挂单量

temp[24]------0.2524------买2

temp[25]------1------买2挂单量

temp[26]------0.2523------买3

temp[27]------2------买3挂单

temp[28]------0.2513------买4

temp[29]------10------买4挂单

temp[30]------0.2504------买5

temp[31]------14------买5挂单

temp[32]------2016-06-22 15:05:45------时间

temp[33]------0------0是认购期权,1是认沽期权

temp[34]------E01------

temp[35]------EBS------

temp[36]------510050------期权成份股

temp[37]------50ETF购9月1850------期权名称

temp[38]------6.64------

temp[39]------0.2549------最高价

temp[40]------0.2389------最低价

temp[41]------263------成交总量

temp[42]------653858.00------成交金额

以上是行情的获取,下面是一些指数的获取

http://hq.sinajs.cn/list=s_sh000001

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_s_sh000001="上证指数,2905.5495,26.9920,0.94,1305904,15633938";  

http://hq.sinajs.cn/list=s_sz399001

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_s_sz399001="深证成指,10297.98,166.121,1.64,197126765,32967027";  

http://hq.sinajs.cn/list=s_sz399300

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_s_sz399300="沪深300,3133.96,27.644,0.89,66487113,8134871";  

http://hq.sinajs.cn/list=s_sz399006

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_s_sz399006="创业板指,2144.82,52.818,2.52,14222178,2902867";  

http://hq.sinajs.cn/list=int_hangseng

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_int_hangseng="恒生指数,20795.12,126.68,0.61";  

http://hq.sinajs.cn/list=int_dji

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_int_dji="道琼斯,17829.73,24.86,0.14";  

http://hq.sinajs.cn/list=int_nasdaq

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_int_nasdaq="纳斯达克,4843.76,6.55,0.14";  

http://hq.sinajs.cn/list=int_sp500

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_int_sp500="标普指数,2088.90,5.65,0.27";  

http://hq.sinajs.cn/list=int_ftse

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_int_ftse="伦敦指数,6236.51,9.96,0.16";  

http://hq.sinajs.cn/list=s_sz399005

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_s_sz399005="中小板指,6801.21,103.199,1.54,18323453,3113027";  

http://hq.sinajs.cn/list=int_nikkei

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_int_nikkei="日经指数,16065.72,-103.39,-0.64";  

http://hq.sinajs.cn/list=b_TWSE

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_b_TWSE="台湾台北指数,8716.25,31.40,0.36,1:49 AM";  

http://hq.sinajs.cn/list=b_FSSTI

[html] view plain copy 在CODE上查看代码片派生到我的代码片

var hq_str_b_FSSTI="富时新加坡海峡时报指数,2786.13,-3.32,-0.12,5:10 AM";  

新浪图片接口

查看日K线图:

http://image.sinajs.cn/newchart/daily/n/sh601006.gif

分时线的查询:

http://image.sinajs.cn/newchart/min/n/sh000001.gif

日K线查询:

http://image.sinajs.cn/newchart/daily/n/sh000001.gif

周K线查询:

http://image.sinajs.cn/newchart/weekly/n/sh000001.gif

月K线查询:

http://image.sinajs.cn/newchart/monthly/n/sh000001.gif

下面附一个我用C#获取行情数据的方法

     

[csharp] view plain copy 在CODE上查看代码片派生到我的代码片

/// <summary>  

/// 通过url获取网页内容  

/// </summary>  

/// <param name="url"></param>  

/// <returns></returns>  

private static string GetHttpString(string url)  

{  

    try  

    {  

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);  

  

  

        HttpWebResponse response = (HttpWebResponse)request.GetResponse();  

        string ret = string.Empty;  

        if (response.StatusCode == HttpStatusCode.OK)  

        {  

            StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("GB2312"));  

            ret = reader.ReadToEnd();  

        }  

        return ret;  

    }  

    catch  

    {  

        return null;  

    }  

}  

http://mizarrr.blog.163.com/blog/static/1651594112011101882538362/

http://blog.csdn.net/simon803/article/details/7784682

http://blog.csdn.net/zai_yuzhong/article/details/51735769

http://www.aigaogao.com/tools/history.html?s=000877

猜你喜欢

转载自m635674608.iteye.com/blog/2386815