日期:2014-05-16  浏览次数:20395 次

使用 JQuery+json 获取163 股票信息

1 希望能实时查看股票信息变化,比较了新浪,网易,yahoo的股票API, yahoo 延迟15分钟, 新浪的返回数据是 csv格式, 网易返回的是 json 格式。所以选用了网易的股票API。

2 查询股票信息 使用如下格式的请求

http://api.money.126.net/data/feed/1000002,1000001,1000881,money.api

股票代码之间使用逗号分隔,股票代码的命名规则参见 网易财经的规则。


返回的json 结果如下:

_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.189999999999