最近一直在做股票相关的东西,但是股票行情数据花钱来买对于个人用户来说还是太贵了,查了好多资料,总的来说新浪的行情接口还是比较稳定比较全的。以下是把获取的行情字符串通过逗号分开,产生一个数组,并列了每一个对应的含义,部分没找到,欢迎大家来完善
具体如下:
A股
sh上海 sz深圳
http://hq.sinajs.cn/list=sh600379
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";
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";
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";
http://hq.sinajs.cn/list=OP_UP_5100501606(认购期权)
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(认沽期权)
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
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";
以上是行情的获取,下面是一些指数的获取
http://hq.sinajs.cn/list=s_sh000001
var hq_str_s_sh000001="上证指数,2905.5495,26.9920,0.94,1305904,15633938";
http://hq.sinajs.cn/list=s_sz399001
var hq_str_s_sz399001="深证成指,10297.98,166.121,1.64,197126765,32967027";
http://hq.sinajs.cn/list=s_sz399300
var hq_str_s_sz399300="沪深300,3133.96,27.644,0.89,66487113,8134871";
http://hq.sinajs.cn/list=s_sz399006
var hq_str_s_sz399006="创业板指,2144.82,52.818,2.52,14222178,2902867";
http://hq.sinajs.cn/list=int_hangseng
var hq_str_int_hangseng="恒生指数,20795.12,126.68,0.61";
http://hq.sinajs.cn/list=int_dji
var hq_str_int_dji="道琼斯,17829.73,24.86,0.14";
http://hq.sinajs.cn/list=int_nasdaq
var hq_str_int_nasdaq="纳斯达克,4843.76,6.55,0.14";
http://hq.sinajs.cn/list=int_sp500
var hq_str_int_sp500="标普指数,2088.90,5.65,0.27";
http://hq.sinajs.cn/list=int_ftse
var hq_str_int_ftse="伦敦指数,6236.51,9.96,0.16";
http://hq.sinajs.cn/list=s_sz399005
var hq_str_s_sz399005="中小板指,6801.21,103.199,1.54,18323453,3113027";
http://hq.sinajs.cn/list=int_nikkei
var hq_str_int_nikkei="日经指数,16065.72,-103.39,-0.64";
http://hq.sinajs.cn/list=b_TWSE
var hq_str_b_TWSE="台湾台北指数,8716.25,31.40,0.36,1:49 AM";
http://hq.sinajs.cn/list=b_FSSTI
var hq_str_b_FSSTI="富时新加坡海峡时报指数,2786.13,-3.32,-0.12,5:10 AM";
新浪图片接口
下面附一个我用C#获取行情数据的方法
///
/// 通过url获取网页内容
///
///
///
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;
}
}