外汇汇率
州讯互联 官方文档
以另一国货币来表示本国货币的价格,其高低最终由外汇市场决定。最终数据以商业银行等金融机构数据为准
基本说明:
接口地址:http://zhouxunwang.cn/data/?id=101
返回格式:json
请求方式:get
请求示例:http://zhouxunwang.cn/data/?id=101&key=R5RTF4G5F5H&&type=1
请求参数说明:
名称 类型 必填 说明
key string 必填 api接口来源出key 扫码关注公众号
type int 必填 必须为1
返回参数说明:
名称 类型 说明
error_code int 返回码
reson string 返回说明
result string 返回结果集
JSON返回示例:
{
	"error_code": 0,
	"resultcode": "200",
	"reason": "SUCCESSED!",
	"result": [{
		"AUDUSD": {
			"buyPic": "0.7141",
			"closePri": "0.7141",
			"code": "AUDUSD",
			"color": "",
			"currency": "澳元美元",
			"datatime": "05:29:23",
			"date": "2020-08-01",
			"diffAmo": "-0.0046",
			"diffPer": "-0.64%",
			"highPic": "0.7227",
			"lowPic": "0.7131",
			"openPri": "0.7186",
			"range": "1.34%",
			"sellPic": "0.7143",
			"yesPic": "0.7187"
		},
		"DINIW": {
			"buyPic": "93.4903",
			"closePri": "93.4903",
			"code": "DINIW",
			"color": "",
			"currency": "美元指数",
			"datatime": "05:55:00",
			"date": "2020-08-01",
			"diffAmo": "0.5098",
			"diffPer": "0.5483%",
			"highPic": "93.5509",
			"lowPic": "92.5381",
			"openPri": "92.9756",
			"range": "1.08%",
			"sellPic": "93.4903",
			"yesPic": "92.9805"
		},
		"EURUSD": {
			"buyPic": "1.1771",
			"closePri": "1.1771",
			"code": "EURUSD",
			"color": "",
			"currency": "欧元美元",
			"datatime": "05:29:28",
			"date": "2020-08-01",
			"diffAmo": "-0.007",
			"diffPer": "-0.5912%",
			"highPic": "1.1908",
			"lowPic": "1.1761",
			"openPri": "1.1840",
			"range": "1.25%",
			"sellPic": "1.1773",
			"yesPic": "1.1841"
		},
		"GBPUSD": {
			"buyPic": "1.3082",
			"closePri": "1.3082",
			"code": "GBPUSD",
			"color": "",
			"currency": "英镑美元",
			"datatime": "05:29:18",
			"date": "2020-08-01",
			"diffAmo": "-0.00080",
			"diffPer": "-0.0611%",
			"highPic": "1.3170",
			"lowPic": "1.3069",
			"openPri": "1.3089",
			"range": "0.77%",
			"sellPic": "1.3084",
			"yesPic": "1.3090"
		},
		"NZDUSD": {
			"buyPic": "0.6627",
			"closePri": "0.6627",
			"code": "NZDUSD",
			"color": "",
			"currency": "新西兰元美元",
			"datatime": "05:29:18",
			"date": "2020-08-01",
			"diffAmo": "-0.0063",
			"diffPer": "-0.9417%",
			"highPic": "0.6716",
			"lowPic": "0.6622",
			"openPri": "0.6689",
			"range": "1.42%",
			"sellPic": "0.6629",
			"yesPic": "0.6690"
		},
		"USDCAD": {
			"buyPic": "1.3416",
			"closePri": "1.3416",
			"code": "USDCAD",
			"color": "",
			"currency": "美元加元",
			"datatime": "05:29:18",
			"date": "2020-08-01",
			"diffAmo": "-0.0011",
			"diffPer": "-0.0819%",
			"highPic": "1.3436",
			"lowPic": "1.3370",
			"openPri": "1.3425",
			"range": "0.49%",
			"sellPic": "1.3418",
			"yesPic": "1.3427"
		},
		"USDCHF": {
			"buyPic": "0.9138",
			"closePri": "0.9138",
			"code": "USDCHF",
			"color": "",
			"currency": "美元瑞郎",
			"datatime": "05:29:18",
			"date": "2020-08-01",
			"diffAmo": "0.0049",
			"diffPer": "0.5391%",
			"highPic": "0.9149",
			"lowPic": "0.9053",
			"openPri": "0.9089",
			"range": "1.05%",
			"sellPic": "0.9140",
			"yesPic": "0.9089"
		},
		"USDCNY": {
			"buyPic": "6.9752",
			"closePri": "6.9755",
			"code": "USDCNY",
			"color": "",
			"currency": "美元人民币",
			"datatime": "23:29:14",
			"date": "2020-07-31",
			"diffAmo": "-0.0333",
			"diffPer": "-0.4751%",
			"highPic": "6.9949",
			"lowPic": "6.9718",
			"openPri": "6.9948",
			"range": "0.33%",
			"sellPic": "6.9752",
			"yesPic": "7.0088"
		},
		"USDHKD": {
			"buyPic": "7.7498",
			"closePri": "7.7498",
			"code": "USDHKD",
			"color": "",
			"currency": "美元港元",
			"datatime": "05:43:39",
			"date": "2020-08-01",
			"diffAmo": "0.00020",
			"diffPer": "0.0026%",
			"highPic": "7.7506",
			"lowPic": "7.7495",
			"openPri": "7.7496",
			"range": "0.01%",
			"sellPic": "7.7507",
			"yesPic": "7.7496"
		},
		"USDJPY": {
			"buyPic": "105.92",
			"closePri": "105.92",
			"code": "USDJPY",
			"color": "",
			"currency": "美元日元",
			"datatime": "05:29:18",
			"date": "2020-08-01",
			"diffAmo": "1.15",
			"diffPer": "1.0976%",
			"highPic": "106.05",
			"lowPic": "104.18",
			"openPri": "104.75",
			"range": "1.77%",
			"sellPic": "105.95",
			"yesPic": "104.77"
		},
		"USDMYR": {
			"buyPic": "4.2490",
			"closePri": "4.2490",
			"code": "USDMYR",
			"color": "",
			"currency": "美元马币",
			"datatime": "14:45:58",
			"date": "2020-07-30",
			"diffAmo": "0.007",
			"diffPer": "0.165%",
			"highPic": "4.2490",
			"lowPic": "4.2450",
			"openPri": "4.2450",
			"range": "0.09%",
			"sellPic": "4.2550",
			"yesPic": "4.2420"
		},
		"USDSGD": {
			"buyPic": "1.3743",
			"closePri": "1.3743",
			"code": "USDSGD",
			"color": "",
			"currency": "美元新加坡元",
			"datatime": "05:29:19",
			"date": "2020-08-01",
			"diffAmo": "0.0024",
			"diffPer": "0.1749%",
			"highPic": "1.3758",
			"lowPic": "1.3687",
			"openPri": "1.3720",
			"range": "0.52%",
			"sellPic": "1.3747",
			"yesPic": "1.3719"
		},
		"USDTWD": {
			"buyPic": "29.3300",
			"closePri": "29.3260",
			"code": "USDTWD",
			"color": "",
			"currency": "美元台币",
			"datatime": "05:56:19",
			"date": "2020-08-01",
			"diffAmo": "0.044",
			"diffPer": "0.1503%",
			"highPic": "29.4820",
			"lowPic": "29.1630",
			"openPri": "29.2970",
			"range": "1.09%",
			"sellPic": "29.3560",
			"yesPic": "29.2820"
		}
	}]
}
服务级错误码参照
错误码 说明
00000 没有该接口
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/08/04 12:46
 */
class freeApi
{
    private $apiUrl;

    public function __construct()
    {
        $this->apiUrl = 'http://zhouxunwang.cn/data/?id=101&key=R5RTF4G5F5H&&type=1';
    }

    /**
     * 获取结果
     * @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=101&key=R5RTF4G5F5H&&type=1"
)

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))
}