股市行情实时

股票数据,含沪深股市、香港股市、美国股市等实时行情,历史行情
接口编号: 603接口名称: 股票数据连接应用: 1204个
应用编号: 120030应用标识: finance.stock_realtime服务商: NowAPI

说明

实时股市行情查询接口,含沪深股市、香港股市、美国股市

扣费扣量特别说明(扣量: 包月套餐扣可用配额次数,流量包套餐扣可用次数)
1. 响应result.totline节点值为数据条数,每10或不足10条扣1次量。例如:条数1或10扣1次量,条数11扣2次量。

更新时间: 小于等于1分钟
测试示例: https://sapi.k780.com/?app=finance.stock_realtime&stoSym=sh600000,sh60000&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json (示例中sign会不定期调整)

调用方式

Get/Post

请求url

 HTTP: http://api.k780.com
HTTPS: https://sapi.k780.com

请求参数

参数 类型 是否必须 备注
app string 固定 finance.stock_realtime
stoSym string 股票代码,多个逗号隔开,单次查询最多5000个,查看支持股票代码列表
说明:
1.单次查询10个或不足10个品种扣1次量。(例:单次查1个或10个扣1次量,查11个扣2次量)
2.单次查询超500个建议POST方式。
appkey string 使用API的唯一凭证 获取
sign string md5后的32位密文,登陆用. 获取
format {json|xml} 返回数据格式
jsoncallback string js跨域使用jsonp时可使用此参数

Json请求示例

http://api.k780.com/?app=finance.stock_realtime&stoSym=sh600000&appkey=APPKEY&sign=SIGN&format=json

Json返回示例

1. 沪深股市
{
    success: "1",
    result: {
        totline: "1",
        disline: "1",
        page: "1",
        lists: {
            sh600000: {
                stoid: "1", /*自定义编号*/
                symbol: "sh600000", /*股票代号*/
                scode: "600000", /*股票编号*/
                sname: "浦发银行", /*股票名称*/
                sname_eng: "", /*股票名称英文*/
                open_price: "16.390", /*开盘价*/
                yesy_price: "16.400", /*昨收价*/
                last_price: "16.430", /*当前价*/
                high_price: "16.450", /*最高价*/
                low_price: "16.380", /*最低价*/
                rise_fall: "0.030", /*涨跌额*/
                rise_fall_per: "0.18", /*涨跌幅*/
                volume: "21269924", /*成交量*/
                turn_volume: "349039232.000", /*成交量额*/
                buy1_n: "6300", /*买1*/
                buy1_m: "16.420", /*买1报价*/
                buy2_n: "6980", /*买2*/
                buy2_m: "16.410", /*买2报价*/
                buy3_n: "343800", /*买3*/
                buy3_m: "16.400", /*买3报价*/
                buy4_n: "473321", /*买4*/
                buy4_m: "16.390", /*买4报价*/
                buy5_n: "292400", /*买5*/
                buy5_m: "16.380", /*买5报价*/
                sell1_n: "254", /*卖1*/
                sell1_m: "16.430", /*卖1报价*/
                sell2_n: "223459", /*卖2*/
                sell2_m: "16.440", /*卖2报价*/
                sell3_n: "368981", /*卖3*/
                sell3_m: "16.450", /*卖3报价*/
                sell4_n: "226339", /*卖4*/
                sell4_m: "16.460", /*卖4报价*/
                sell5_n: "237610", /*卖5*/
                sell5_m: "16.470", /*卖5报价*/
                uptime: "2016-11-07 14:58:50" /*更新时间*/
            }
        }
    }
}

备注: 涨停价/跌停价计算方式,涨停=昨日收盘价+(昨日收盘价*0.1)   跌停=昨日收盘价-(昨日收盘价*0.1)

------------------------------------------------------------------

2.香港股市
{
    success: "1",
    result: {
        totline: "1",
        disline: "1",
        page: "1",
        lists: {
            hk00001: {
                stoid: "2906", /*自定义编号*/
                symbol: "hk00001", /*股票代码*/
                scode: "00001",  /*股票代号*/
                sname: "长和", /*股票名称*/
                sname_eng: "CHEUNG KONG", /*股票名称英文*/
                open_price: "95.250", /*开盘价*/
                yesy_price: "95.500", /*昨收价*/
                last_price: "96.000", /*当前价*/
                high_price: "96.250", /*最高价*/
                low_price: "94.800", /*最低价*/
                rise_fall: "0.500", /*涨跌额*/
                rise_fall_per: "0.52", /*涨跌幅*/
                volume: "2341664", /*成交量*/
                turn_volume: "224225024.000", /*成交额*/
                peratio: "11.713", /*市盈率*/
                week52_high: "105.400", /*52周最高*/
                week52_low: "80.600", /*52周最低*/
                uptime: "2016-11-07 15:36:00" /*更新时间*/
            }
        }
    }
}

------------------------------------------------------------------

3.美国股市
{
    success: "1",
    result: {
        totline: "1",
        disline: "1",
        page: "1",
        lists: {
            gb_aapl: {
                stoid: "4803",/*自定义编号*/
                symbol: "gb_aapl", /*股票代码*/
                scode: "AAPL", /*股票代号*/
                sname: "苹果公司", /*股票名称*/
                sname_eng: "Apple Inc.", /*股票名称英文*/
                open_price: "108.530", /*开盘价*/
                yesy_price: "109.830", /*昨收价*/
                last_price: "108.840", /*当前价*/
                high_price: "110.250", /*最高价*/
                low_price: "108.110", /*最低价*/
                rise_fall: "-0.990", /*涨跌额*/
                rise_fall_per: "-0.90", /*涨跌幅*/
                volume: "29939342", /*成交量*/
                turn_volume: "0.000", /*成交额 美股暂无法提供提交额*/
                peratio: "13.100", /*市盈率*/
                week52_high: "121.810", /*52周最高*/
                week52_low: "89.470", /*52周最低*/
                day10_volume: "34542335", /*10日均量*/
                mvalue: "2147483647", /*市值*/
                ep_share: "8.310", /*每股收益*/
                beta_coefficient: "13.100", /*贝塔系数*/
                dividend: "2.180", /*股息*/
                yield: "1.100", /*收益率*/
                equity: "2147483647", /*股本*/
                db_price: "108.950", /*盘后价*/
                db_volume: "779446", /*盘后成交量*/
                uptime: "2016-11-05 04:57:56" /*更新时间*/
            }
        }
    }
}

------------------------------------------------------------------

4. 错误
{
    "success":"0",
    "msgid":"...",
    "msg":"..."
}

示例代码

<?php
header("Content-Type:text/html;charset=UTF-8");
function nowapiRequest($postData,&$errMsg=''){
    $apiUrl     = 'https://sapi.k780.com/';
    $useContext = stream_context_create(array(
        'http' => array(
            'method'  => 'POST',
            'header'  => 'Content-type:application/x-www-form-urlencoded',
            'content' => http_build_query($postData)
        )
    ));
    if(!$resData=file_get_contents($apiUrl,false,$useContext)){
        $errMsg = 'ERR_CONNECT';
        return false;
    }
    if(!$arrData=json_decode($resData,true)){
        $errMsg = 'ERR_DECODE';
        return false;
    }
    if($arrData['success']!=1){
        $errMsg = $arrData['msgid'].' '.$arrData['msg'];
        return false;
    }
    return $arrData['result'];
}

$postData['app'] = 'finance.stock_realtime';
$postData['stoSym'] = 'sh600000';
$postData['appkey'] = '10003';//替换成自己的appkey
$postData['sign'] = 'b59bc3ef6191eb9f747dd4e83c99f2a4';//替换成自己的sign
$postData['format'] = 'json';
$result = nowapiRequest($postData,$errMsg);
print_r($errMsg);
print_r($result);

#python
import json,urllib
from urllib import urlencode

url = 'http://api.k780.com'
params = {
  'app' : 'finance.stock_realtime',
  'stoSym' : 'sh600000',
  'appkey' : 'APPKEY',
  'sign' : 'SIGN',
  'format' : 'json',
}
params = urlencode(params)

f = urllib.urlopen('%s?%s' % (url, params))
nowapi_call = f.read()
#print content
a_result = json.loads(nowapi_call)
if a_result:
  if a_result['success'] != '0':
    print a_result['result'];
  else:
    print a_result['msgid']+' '+a_result['msg']
else:
  print 'Request nowapi fail.';

import java.net.*;
import java.io.*;

public class test{
    public static void main(String args[]) throws Exception {
        URL u=new URL("http://api.k780.com/?app=finance.stock_realtime&stoSym=sh600000&appkey=APPKEY&sign=SIGN&format=json");
        InputStream in=u.openStream();
        ByteArrayOutputStream out=new ByteArrayOutputStream();
        try {
            byte buf[]=new byte[1024];
            int read = 0;
            while ((read = in.read(buf)) > 0) {
                out.write(buf, 0, read);
            }
        }  finally {
            if (in != null) {
                in.close();
            }
        }
        byte b[]=out.toByteArray( );
        System.out.println(new String(b,"utf-8"));
    }
}

curl "http://api.k780.com/?app=finance.stock_realtime&stoSym=sh600000&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json"

流量包套餐说明:

买多少用多少,多买有优惠,10元起买,适合大多数应用场景.

规格套餐名称价格描述
201流量包 1000 次10 元约可更新1万条行情或历史数据
202流量包 11000 次100 元约可更新11万条行情或历史数据
203流量包 22000 次200 元约可更新22万条行情或历史数据
204流量包 33000 次300 元约可更新33万条行情或历史数据
205流量包 55000 次500 元约可更新55万条行情或历史数据
206流量包 110000 次1000 元约可更新110万条行情或历史数据
207流量包 220000 次2000 元约可更新220万条行情或历史数据
208流量包 330000 次3000 元约可更新330万条行情或历史数据
209流量包 550000 次5000 元约可更新550万条行情或历史数据
210流量包 1100000 次10000 元约可更新1100万条行情或历史数据
立即开通

包月套餐说明:

适合调用量比较平均的高频应用场景;有配额限制,超出配额会被暂停调用1小时,请留意购买足够配额.

规格套餐名称价格描述
10210000 次配额/每小时88 元/月约可更新10万条行情或历史数据/每小时
10318000 次配额/每小时132 元/月约可更新18万条行情或历史数据/每小时
10424000 次配额/每小时176 元/月约可更新24万条行情或历史数据/每小时
10536000 次配额/每小时264 元/月约可更新36万条行情或历史数据/每小时
10660000 次配额/每小时440 元/月约可更新60万条行情或历史数据/每小时
107120000 次配额/每小时880 元/月约可更新120万条行情或历史数据/每小时
108240000 次配额/每小时1760 元/月约可更新240万条行情或历史数据/每小时
109360000 次配额/每小时2640 元/月约可更新360万条行情或历史数据/每小时
110720000 次配额/每小时5280 元/月约可更新720万条行情或历史数据/每小时
1111440000 次配额/每小时10560 元/月约可更新1440万条行情或历史数据/每小时
立即开通

免费试用套餐说明:

商用请选择付费套餐。 (系统繁忙或极端情况下,优先保证付费用户使用).

规格套餐名称价格描述
0试用套餐 50 次/每小时0 元/月可免费试用3个月,延长试用或次数不够可联系客服增加
立即开通

客户服务

客服QQ: 1486133340 
QQ群8: 204490433

客服微信:

数据定制

定制接口、定制数据格式、采集等;联系请提供数据样式范本。1486133340 

意见反馈