使用 JQuery+json 获取163 股票信息
来自:新思网络时间:2012-08-19 10:29:54
1 希望能实时查看股票信息变化,比较了新浪,网易,yahoo的股票API, yahoo 延迟15分钟, 新浪的返回数据是 csv格式, 网易返回的是 json 格式。所以选用了网易的股票API。
2 查询股票信息 使用如下格式的请求
http://api.money.126.net/data/feed/1000002,1000001,1000881,money.api
股票代码之间使用逗号分隔,股票代码的命名规则参见
_ntes_quote_callback({
"1000002": {
"code": "1000002",
"percent": -0.012731481481481621,
"high": 8.6999999999999993,
"askvol3": 10700,
"askvol2": 41700,
"askvol5": 22500,
"askvol4": 36822,
"price": 8.5299999999999994,
"open": 8.6300000000000008,
"bid5": 8.4800000000000004,
"bid4": 8.4900000000000002,
"bid3": 8.5,
"bid2": 8.5099999999999998,
"bid1": 8.5199999999999996,
"low": 8.5,
"updown": -0.11000000000000121,
"type": "SZ",
"bidvol1": 1000,
"bidvol3": 168500,
"bidvol2": 63395,
"symbol": "000002",
"update": "2012/08/17 13:46:28",
"bidvol5": 215300,
"bidvol4": 176600,
"volume": 17132617,
"askvol1": 11413,
"ask5": 8.5700000000000003,
"ask4": 8.5600000000000005,
"ask1": 8.5299999999999994,
"name": "\u4e07 \u79d1\uff21",
"ask3": 8.5500000000000007,
"ask2": 8.5399999999999991,
"arrow": "\u2193",
"time": "2012/08/17 13:46:20",
"yestclose": 8.6400000000000006,
"turnover": 147404890.41999999
},
"1000001": {
"code": "1000001",
"percent": 0.0093896713615023858,
"high": 15.1,
"askvol3": 71712,
"askvol2": 135132,
"askvol5": 392350,
"askvol4": 111230,
"price": 15.050000000000001,
"open": 14.91,
"bid5": 15.01,
"bid4": 15.02,
"bid3": 15.029999999999999,
"bid2": 15.039999999999999,
"bid1": 15.050000000000001,
"low": 14.880000000000001,
"updown": 0.14000000000000057,
"type": "SZ",
"bidvol1": 265,
"bidvol3": 39983,
"bidvol2": 15060,
"symbol": "000001",
"update": "2012/08/17 13:46:28",
"bidvol5": 50349,
"bidvol4": 24437,
"volume": 7187625,
"askvol1": 67847,
"ask5": 15.1,
"ask4": 15.09,
"ask1": 15.06,
"name": "\u5e73\u5b89\u94f6\u884c",
"ask3": 15.08,
"ask2": 15.07,
"arrow": "\u2191",
"time": "2012/08/17 13:46:20",
"yestclose": 14.91,
"turnover": 107989733.23
},
"1000881": {
"code": "1000881",
"percent": -0.014388489208633001,
"high": 8.3800000000000008,
"askvol3": 500,
"askvol2": 47500,
"askvol5": 3100,
"askvol4": 2978,
"price": 8.2200000000000006,
"open": 8.3000000000000007,
"bid5": 8.1899999999999995,
"bid4": 8.1999999999999993,
"bid3": 8.2100000000000009,
"bid2": 8.2200000000000006,
"bid1": 8.2300000000000004,
"low": 8.2100000000000009,
"updown": -0.11999999999999922,
"type": "SZ",
"bidvol1": 1000,
"bidvol3": 38154,
"bidvol2": 5611,
"symbol": "000881",
"update": "2012/08/17 13:46:28",
"bidvol5": 28500,
"bidvol4": 32200,
"volume": 1652944,
"askvol1": 12262,
"ask5": 8.2899999999999991,
"ask4": 8.2799999999999994,
"ask1": 8.2400000000000002,
"name": "\u5927\u8fde\u56fd\u9645",
"ask3": 8.2599999999999998,
"ask2": 8.25,
"arrow": "\u2193",
"time": "2012/08/17 13:46:20",
"yestclose": 8.3399999999999999,
"turnover": 13662482.58
}
});
3 根据相应的属性,取出对应的值即可。
相应Jquery处理 Json 代码参考 http://bingzone.sinaapp.com/JobAlliance/quotes/stock.php
4 取K线图的地址。
http://img1.quotes.ws.126.net/chart/timechart/1000001.png 分时图
http://img1.quotes.ws.126.net/chart/kchart/30/1000001.png 30天日K线
http://img1.quotes.ws.126.net/chart/kchart/90/1000001.png 90天日K线
http://img1.quotes.ws.126.net/chart/kchart/180/1000001.png 180天日K线
http://img1.quotes.ws.126.net/chart/kchart/week/1000001.png 周线
http://img1.quotes.ws.126.net/chart/kchart/month/1000001.png 月线
http://img1.quotes.ws.126.net/chart/kchart/180/1000001.png 半年线
关键词:jquery,股票
分类: jQuery 浏览 ( 8466 ) 次
电脑故障 | ps教程 | 设计 |
创业 | seo | discuz |
word | 配置 | c# |
数据库 | mysql | asp |
ShopEx | html | JavaScript |
模板 | Joomla | PhotoShop |
CSS | PHP | WordPress |
ECShop | jQuery | 用户体验 |
新闻 | 读书 |
jquery | 股票 |
[ html ] div css 高度 宽度 自适应浏......
[ 电脑故障 ] 联想的笔记本电脑不动十分钟,就黑屏了......
[ 设计 ] 国外30款设计精美的网站登录页面模板
[ JavaScript ] js替换函数replace 替换多个......
[ 设计 ] 浅谈—韩国游戏网站设计
[ 创业 ] 内部创业:选择大于努力
[ seo ] 浅谈论坛内容成型的三个特性:模仿性 ......
[ seo ] 利用链接的价值导向来优化网站链接