股票查询
州讯互联 官方文档
提供沪深、香港、美国股市信息
基本说明:
接口地址:http://zhouxunwang.cn/data/?id=15
返回格式:json
请求方式:get
请求示例:http://zhouxunwang.cn/data/?id=15&key=R5RTF4G5F5H&stock=汽车之家
请求参数说明:
名称 类型 必填 说明
key string 必填 平台KEY 扫码关注公众号
stock string 必填 股票名称
返回参数说明:
名称 类型 说明
见json返回 - -
JSON返回示例:
{
	"reason": "查询成功",
	"result": {
		"title": "汽车之家[ATHM]美股_富利证券",
		"urlWap": "https:\/\/www.so.com\/link?m=bPWrvQykJ8K4U0qdUT6QWQ28bk6pSOrJ9HbJm1RyAZ1YQRJHRSUmEWNMxK0YMPm%2Bqov8r4i8Ja5L29cP5pghDNOkQ8%2FTfh%2BmG4Fl70olUhWyt0Lkzu2pDwXOOWb0rHjY%2FW5psA6a3D2d3MUlBM7edGgpOvkc%3D",
		"url": "https:\/\/www.so.com\/link?m=b0oEAms4%2FMPLtkeoiJWutkIyZh0K%2Foz48ob6pd1SupK04m9FXw7Tr0tCF8nuG%2B4K5SsOsWm05Qd9VxUxFKXRdyaG%2FNaahOLFsfvQvsObCVf6E8%2FIRaPjyzN%2FDeYqiUN4mqTfbrOBh20UQrqynjGYP%2BgY84t8%3D",
		"stockName": "汽车之家",
		"currentPrice": "85.87",
		"changeAmount": "+1.96",
		"priceChangeRatio": "+2.34%",
		"currenttime": "2020-09-05 04:00:04",
		"timeZone": "北京时间",
		"status": "2",
		"open": "84.11",
		"close": "83.91",
		"maxPrice": "86.41",
		"minPrice": "82.31",
		"volume": "44.97万",
		"amount": "3820.21万",
		"marketCapitalization": "102.25亿",
		"timeChart": {
			"points": "330",
			"cx": {
				"o": ["21:30", "23:00", "00:30", "02:00", "04:00"]
			},
			"cy": {
				"o": ["86.41", "85.44", "84.47", "83.51", "82.54"]
			},
			"cyrate": {
				"o": ["2.92%", "1.77%", "0.61%", "-0.54%", "-1.69%"]
			},
			"p": [{
				"date": "2020\/09\/04 星期五",
				"price": "83.96",
				"rise": "0",
				"volumn": "30",
				"time": "21:31"
			}, {
				"date": "2020\/09\/04 星期五",
				"price": "83.96",
				"rise": "0.00%",
				"volumn": "30",
				"time": "21:32"
			}, {
				"date": "2020\/09\/04 星期五",
				"price": "83.59",
				"rise": "-0.43%",
				"volumn": "40",
				"time": "21:33"
			}]
		},
		"index": [{
			"name": "道琼斯",
			"nameurl": "https:\/\/www.so.com\/link?m=b19r8gGgzIjB%2BdsJA6oGJJomRHcBB%2BjxzGb3%2BxYgvsiLHOdHlGS9axbfukcx7ZOlUR7kgKYdz12jZx7DkwvSepXe%2FOwsV%2B3ks3VTrLoFP3szXoF6OiXaa4X4%2B6v6uTgVaGdJBwLqmMiciJn6rZTA9FdgBXKs%3D",
			"point": "281.71",
			"ratio": "-0.58%"
		}, {
			"name": "标普500",
			"nameurl": "https:\/\/www.so.com\/link?m=bM6dQsyT%2BliJ2AX430FqRRCudpxfzddW7%2FSBBsNRwDsBf5UgXfErBBuUv30YXbIs5yIKvJL8BLls2H0SJ%2BnAXRnnOt7e4nU57oYEKmXUKJfQW7yxUZ%2BYdfG1E7DsPEE522iuQ8eHajRMgL%2FeGTfRT4T0sINA%3D",
			"point": "342.35",
			"ratio": "-0.88%"
		}, {
			"name": "纳斯达克",
			"nameurl": "https:\/\/www.so.com\/link?m=bHSnz86LhsDJQt7Hdv%2BF8LyPNZm9TpI0OeWSZ4pzzw0LMfmh3HgP3U108VYaBmUPQ3ByhcASpZC%2FzefVTtYBLYegDwD2J1WKKAE%2BucFEafRTiPFs9BYPQKpYkfMlnwg5DPGPTcFta%2FII0nf%2B%2BCT9psR%2BDkVlJgLon",
			"point": "283.58",
			"ratio": "-1.33%"
		}],
		"provider": "富利证券",
		"showurl": "richbays.com",
		"e": {
			"@attributes": {
				"e1": "85.87",
				"e2": "+1.96",
				"e3": "(+2.34%)",
				"datetime": "2020-09-05 04:00:04"
			}
		}
	},
	"error_code": 0
}
服务级错误码参照
错误码 说明
00001 参数有空
00002 KEY错误
00003 未办理过该业务
00004 条数不够
00005 已到期
00006 今天条数已用光
00007 您的帐号不存在
10001 错误的请求KEY
10002 该KEY无请求权限
10003 KEY过期
10004 错误的OPENID
10005 应用未审核超时,请提交认证
10007 未知的请求源
10008 被禁止的IP
10009 被禁止的KEY
10011 当前IP请求超过限制
10012 请求超过次数限制
10013 测试KEY超过请求限制
10014 系统内部异常
10020 接口维护
10021 接口停用
完整教学代码示例
<?php
/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2020/09/05 16:46
 */
class freeApi
{
    private $apiUrl;

    public function __construct()
    {
        $this->apiUrl = 'http://zhouxunwang.cn/data/?id=15&key=R5RTF4G5F5H&stock=汽车之家';
    }

    /**
     * 获取结果
     * @return array
     */
    public function getResult()
    {
        return file_get_contents($this->apiUrl);
    }
}
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

const (
	APIURL   = "http://zhouxunwang.cn/data/?id=15&key=R5RTF4G5F5H&stock=汽车之家"
)

func main() {
	queryUrl := fmt.Sprintf("%s",APIURL)
	resp, err := http.Get(queryUrl)
	if err != nil {
		log.Println(err)
		return
	}

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)

	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(string(body))
}