参数名称 | 类型 | 必填 | 说明 |
---|---|---|---|
from | string | 是 | 要换算的单位 (默认:CNY、USD) |
to | string | 是 | 换算后的单位 |
amount | string | 是 | 数量(默认:1) |
参数名称 | 类型 | 说明 |
---|---|---|
from | string | 要换算的货币 |
to | string | 换算后的货币 |
fromname | string | 要换算的货币名称 |
toname | string | 换算后的货币名称 |
updatetime | string | 更新时间 |
rate | string | 汇率 |
camount | string | 计算金额 |
<?php require_once 'curl.func.php'; $appkey = 'your_appkey_here';//你的appkey $from = 'CNY'; $to = 'USD'; $amount = 10; $url = "https://api.jisuapi.com/exchange/convert?appkey=$appkey&from=$from&to=$to&amount=$amount"; $result = curlOpen($url, ['ssl'=>true]); $jsonarr = json_decode($result, true); //exit(var_dump($jsonarr)); if($jsonarr['status'] != 0) { echo $jsonarr['msg']; exit(); } $result = $jsonarr['result']; echo $result['from'].' '.$result['to'].' '.$result['fromname'].' '.$result['toname'].' '.$result['updatetime'].' '.$result['rate'].' '.$result['camount'].'
';
#!/usr/bin/python # encoding:utf-8 import requests # 1、汇率转换 data = {} data["appkey"] = "your_appkey_here" data["from"] = "CNY" data["to"] = "USD" data["amount"] = 10 url = "https://api.jisuapi.com/exchange/convert" response = requests.get(url,params=data) jsonarr = response.json() if jsonarr["status"] != 0: print(jsonarr["msg"]) exit() result = jsonarr["result"] print(result["from"],result["to"],result["fromname"],result["toname"],result["updatetime"],result["rate"],result["camount"])
package api.jisuapi.exchange; import api.util.HttpUtil; import net.sf.json.JSONObject; public class Convert { public static final String APPKEY = "your_appkey_here";// 你的appkey public static final String URL = "https://api.jisuapi.com/exchange/convert"; public static final String from = "CNY"; public static final String to = "USD"; public static final String amount = "10"; public static void Get() { String result = null; String url = URL + "?appkey=" + APPKEY + "&from=" + from + "&to=" + to + "&amount=" + amount; try { result = HttpUtil.sendGet(url, "utf-8"); JSONObject json = JSONObject.fromObject(result); if (json.getInt("status") != 0) { System.out.println(json.getString("msg")); } else { JSONObject resultarr = json.optJSONObject("result"); String from = resultarr.getString("from"); String to = resultarr.getString("to"); String fromname = resultarr.getString("fromname"); String toname = resultarr.getString("toname"); String updatetime = resultarr.getString("updatetime"); String rate = resultarr.getString("rate"); String camount = resultarr.getString("camount"); System.out.println( from + " " + to + "" + fromname + " " + toname + " " + updatetime + " " + rate + " " + camount); } } catch (Exception e) { e.printStackTrace(); } } }
// 1. 安装 axios(如果未安装) // 在终端执行: npm install axios const axios = require('axios'); // 2. 直接配置参数 const url = 'https://api.jisuapi.com/exchange/convert'; const params = { appkey: 'your_appkey_here', // 替换成你的真实appkey from: 'CNY', to: 'USD', amount: 1 }; // 3. 立即发送请求 axios.get(url, { params }) .then(response => { // 检查API业务状态码 if (response.data.status !== 0) { console.error('API返回错误:', response.data.status+"-"+response.data.msg); return; } // 输出结果 for (const [key, value] of Object.entries(response.data.result)) { console.log(`${key.padEnd(8)}:`, value); } }) .catch(error => { // 统一错误处理 console.error('请求失败!'); });
{ "status": 0, "msg": "ok", "result": { "from": "CNY", "to": "USD", "fromname": "人民币", "toname": "美元", "updatetime": "2015-10-26 16:56:22", "rate": "0.1574", "camount": "1.574" } }
参数名称 | 类型 | 必填 | 说明 |
---|---|---|---|
currency | string | 是 | 货币 |
参数名称 | 类型 | 说明 |
---|---|---|
currency | string | 货币 |
name | string | 名称 |
rate | string | 汇率 |
updatetime | string | 更新时间 |
<?php require_once 'curl.func.php'; $appkey = 'your_appkey_here';//你的appkey $currency = 'CNY'; $url = "https://api.jisuapi.com/exchange/single?appkey=$appkey¤cy=$currency"; $result = curlOpen($url, ['ssl'=>true]); $jsonarr = json_decode($result, true); //exit(var_dump($jsonarr)); if($jsonarr['status'] != 0) { echo $jsonarr['msg']; exit(); } $result = $jsonarr['result']; echo $result['currency'].' '.$result['name'].'
'; foreach($result['list'] as $key=>$val) { echo $key.' '.$val['name'].' '.$val['rate'].' '.$val['updatetime'].'
'; }
#!/usr/bin/python # encoding:utf-8 import requests # 2、单个货币 data = {} data["appkey"] = "your_appkey_here" data["currency"] = "CNY" url = "https://api.jisuapi.com/exchange/single" response = requests.get(url,params=data) jsonarr = response.json() if jsonarr["status"] != 0: print(jsonarr["msg"]) exit() result = jsonarr["result"] print(result["currency"],result["name"]) for val in result["list"]: list = result["list"][val] print(val,list["name"],list["rate"],list["updatetime"])
package api.jisuapi.exchange; import api.util.HttpUtil; import net.sf.json.JSONObject; public class Single { public static final String APPKEY = "your_appkey_here";// 你的appkey public static final String URL = "https://api.jisuapi.com/exchange/single"; public static final String currency = "CNY"; public static void Get() { String result = null; String url = URL + "?currency=" + currency + "&appkey=" + APPKEY; try { result = HttpUtil.sendGet(url, "utf-8"); JSONObject json = JSONObject.fromObject(result); if (json.getInt("status") != 0) { System.out.println(json.getString("msg")); } else { JSONObject resultarr = json.optJSONObject("result"); String currency = resultarr.getString("currency"); String name = resultarr.getString("name"); System.out.println(currency + " " + name); if (resultarr.opt("list") != null) { JSONObject list = resultarr.optJSONObject("list"); if (list.opt("HKD") != null) { JSONObject HKD = (JSONObject) list.opt("HKD"); String name1 = HKD.getString("name"); String rate = HKD.getString("rate"); String updatetime = HKD.getString("updatetime"); System.out.println(name1 + " " + rate + " " + updatetime); } if (list.opt("EUR") != null) { JSONObject EUR = list.optJSONObject("EUR"); String name1 = EUR.getString("name"); String rate = EUR.getString("rate"); String updatetime = EUR.getString("updatetime"); System.out.println(name1 + " " + rate + " " + updatetime); } if (list.opt("HKD") != null) { JSONObject HKD = list.optJSONObject("HKD"); String name1 = HKD.getString("name"); String rate = HKD.getString("rate"); String updatetime = HKD.getString("updatetime"); System.out.println(name1 + " " + rate + " " + updatetime); } } } } catch (Exception e) { e.printStackTrace(); } } }
// 1. 安装 axios(如果未安装) // 在终端执行: npm install axios const axios = require('axios'); // 2. 直接配置参数 const url = 'https://api.jisuapi.com/exchange/single'; const params = { appkey: 'your_appkey_here', // 替换成你的真实appkey currency: 'CNY' }; // 3. 立即发送请求 axios.get(url, { params }) .then(response => { // 检查API业务状态码 if (response.data.status !== 0) { console.error('API返回错误:', response.data.status+"-"+response.data.msg); return; } // 输出结果 console.log('货币:', response.data.result.currency); console.log('货币名称:', response.data.result.name); console.log('汇率列表:'); for (const [key, value] of Object.entries(response.data.result.list)) { console.log(`${key.padEnd(8)}:`); for (const [k, v] of Object.entries(value)) { console.log(`${k.padEnd(8)}: ${v}`); } console.log('----------------------------------'); } }) .catch(error => { // 统一错误处理 console.error('请求失败!'); });
{ "status": 0, "msg": "ok", "result": { "currency": "CNY", "name": "人民币", "list": { "HKD": { "name": "港币", "rate": "1.2198", "updatetime": "2015-10-26 16:56:22" }, "USD": { "name": "美元", "rate": "0.1574", "updatetime": "2015-10-26 16:56:22" }, "EUR": { "name": "欧元", "rate": "0.1426", "updatetime": "2015-10-26 16:56:22" } } } }
参数名称 | 类型 | 必填 | 说明 |
---|
参数名称 | 类型 | 说明 |
---|---|---|
currency | string | 货币 |
name | string | 名称 |
<?php require_once 'curl.func.php'; $appkey = 'your_appkey_here';//你的appkey $url = "https://api.jisuapi.com/exchange/currency?appkey=$appkey"; $result = curlOpen($url, ['ssl'=>true]); $jsonarr = json_decode($result, true); //exit(var_dump($jsonarr)); if($jsonarr['status'] != 0) { echo $jsonarr['msg']; exit(); } $result = $jsonarr['result']; foreach($result as $val) { echo $val['currency'].' '.$val['name'].'
'; }
#!/usr/bin/python # encoding:utf-8 import requests # 3、所有货币 data = {} data["appkey"] = "your_appkey_here" url = "https://api.jisuapi.com/exchange/currency" response = requests.get(url,params=data) jsonarr = response.json() if jsonarr["status"] != 0: print(jsonarr["msg"]) exit() result = jsonarr["result"] for val in result: print(val["currency"],val["name"])
package api.jisuapi.exchange; import api.util.HttpUtil; import net.sf.json.JSONArray; import net.sf.json.JSONObject; public class Currency { public static final String APPKEY = "your_appkey_here";// 你的appkey public static final String URL = "https://api.jisuapi.com/exchange/currency"; public static void Get() { String result = null; String url = URL + "?appkey=" + APPKEY; try { result = HttpUtil.sendGet(url, "utf-8"); JSONObject json = JSONObject.fromObject(result); if (json.getInt("status") != 0) { System.out.println(json.getString("msg")); } else { JSONArray resultarr = json.optJSONArray("result"); for (int i = 0; i < resultarr.size(); i++) { JSONObject obj = (JSONObject) resultarr.opt(i); String currency = obj.getString("currency"); String name = obj.getString("name"); System.out.println(currency + " " + name); } } } catch (Exception e) { e.printStackTrace(); } } }
// 1. 安装 axios(如果未安装) // 在终端执行: npm install axios const axios = require('axios'); // 2. 直接配置参数 const url = 'https://api.jisuapi.com/exchange/currency'; const params = { appkey: 'your_appkey_here', // 替换成你的真实appkey }; // 3. 立即发送请求 axios.get(url, { params }) .then(response => { // 检查API业务状态码 if (response.data.status !== 0) { console.error('API返回错误:', response.data.status+"-"+response.data.msg); return; } // 输出结果 for (const [key, value] of Object.entries(response.data.result)) { console.log(`${value.currency}: ${value.name}`); } }) .catch(error => { // 统一错误处理 console.error('请求失败!'); });
{ "status": 0, "msg": "ok", "result": [ { "currency": "USD", "name": "美元" }, { "currency": "EUR", "name": "欧元" }, { "currency": "CNY", "name": "人民币" } ] }
参数名称 | 类型 | 必填 | 说明 |
---|---|---|---|
bank | string | 否 | 银行编码,工商银行:ICBC ,中国银行:BOC ,农业银行:ABCHINA ,交通银行:BANKCOMM ,建设银行:CCB ,招商银行:CMBCHINA ,光大银行:CEBBANK ,浦发银行:SPDB ,兴业银行:CIB ,中信银行:ECITIC,默认BOC |
参数名称 | 类型 | 说明 |
---|---|---|
bank | string | 银行编码 |
code | string | 货币代码 |
name | string | 货币名称 |
midprice | string | 中间价 |
cashbuyprice | string | 钞买价 |
forexbuyprice | string | 汇买价 |
cashsellprice | string | 钞卖价 |
forexsellprice | string | 汇卖价 |
updatetime | string | 最后更新时间 |
// 1. 安装 axios(如果未安装) // 在终端执行: npm install axios const axios = require('axios'); // 2. 直接配置参数 const url = 'https://api.jisuapi.com/exchange/bank'; const params = { appkey: 'your_appkey_here', // 替换成你的真实appkey bank: 'BOC' }; // 3. 立即发送请求 axios.get(url, { params }) .then(response => { // 检查API业务状态码 if (response.data.status !== 0) { console.error('API返回错误:', response.data.status+"-"+response.data.msg); return; } // 输出结果 console.log('银行代号:', params.bank); for (const [key, value] of Object.entries(response.data.result.list)) { for (const [k, v] of Object.entries(value)) { console.log(`${k.padEnd(8)}:`, v); } console.log('----------------------------------'); } }) .catch(error => { // 统一错误处理 console.error('请求失败!'); });
{ "status": 0, "msg": "ok", "result": { "bank": "BOC", "list": [ { "code": "AUD", "name": "澳大利亚元", "midprice": "452.9400", "cashbuyprice": "453.5400", "forexbuyprice": "453.5400", "cashsellprice": "457.1500", "forexsellprice": "457.1500", "updatetime": "2025-03-11 18:05:59" }, { "code": "BRL", "name": "巴西雷亚尔", "midprice": "--", "cashbuyprice": "--", "forexbuyprice": "--", "cashsellprice": "--", "forexsellprice": "--", "updatetime": "2025-03-11 18:05:59" }, { "code": "CAD", "name": "加拿大元", "midprice": "500.0100", "cashbuyprice": "500.4200", "forexbuyprice": "500.4200", "cashsellprice": "504.3500", "forexsellprice": "504.3500", "updatetime": "2025-03-11 18:05:59" }, { "code": "CHF", "name": "瑞士法郎", "midprice": "818.1600", "cashbuyprice": "817.8500", "forexbuyprice": "817.8500", "cashsellprice": "824.1700", "forexsellprice": "824.1700", "updatetime": "2025-03-11 18:05:59" }, { "code": "DKK", "name": "丹麦克朗", "midprice": "104.6600", "cashbuyprice": "105.3600", "forexbuyprice": "105.3600", "cashsellprice": "106.2000", "forexsellprice": "106.2000", "updatetime": "2025-03-11 18:05:59" }, { "code": "EUR", "name": "欧元", "midprice": "781.1800", "cashbuyprice": "786.2300", "forexbuyprice": "786.2300", "cashsellprice": "791.9900", "forexsellprice": "791.9900", "updatetime": "2025-03-11 18:05:59" }, { "code": "GBP", "name": "英镑", "midprice": "928.0100", "cashbuyprice": "932.3700", "forexbuyprice": "932.3700", "cashsellprice": "939.2900", "forexsellprice": "939.2900", "updatetime": "2025-03-11 18:05:59" }, { "code": "HKD", "name": "港币", "midprice": "92.3600", "cashbuyprice": "92.9300", "forexbuyprice": "92.9300", "cashsellprice": "93.3100", "forexsellprice": "93.3100", "updatetime": "2025-03-11 18:05:59" }, { "code": "JPY", "name": "日元", "midprice": "4.9195", "cashbuyprice": "4.8897", "forexbuyprice": "4.8897", "cashsellprice": "4.9275", "forexsellprice": "4.9275", "updatetime": "2025-03-11 18:05:59" }, { "code": "KRW", "name": "韩元", "midprice": "0.4961", "cashbuyprice": "0.4948", "forexbuyprice": "0.4948", "cashsellprice": "0.5033", "forexsellprice": "0.5033", "updatetime": "2025-03-11 18:05:59" }, { "code": "KZT", "name": "哈萨克斯坦坚戈", "midprice": "--", "cashbuyprice": "--", "forexbuyprice": "--", "cashsellprice": "--", "forexsellprice": "--", "updatetime": "2025-03-11 18:05:59" }, { "code": "MOP", "name": "澳门元", "midprice": "89.6200", "cashbuyprice": "90.2200", "forexbuyprice": "90.2200", "cashsellprice": "90.6400", "forexsellprice": "90.6400", "updatetime": "2025-03-11 18:05:59" }, { "code": "MYR", "name": "林吉特", "midprice": "162.7900", "cashbuyprice": "--", "forexbuyprice": "163.3700", "cashsellprice": "--", "forexsellprice": "164.8400", "updatetime": "2025-03-11 18:05:59" }, { "code": "NOK", "name": "挪威克朗", "midprice": "67.0000", "cashbuyprice": "67.6000", "forexbuyprice": "67.6000", "cashsellprice": "68.1400", "forexsellprice": "68.1400", "updatetime": "2025-03-11 18:05:59" }, { "code": "NZD", "name": "新西兰元", "midprice": "411.7000", "cashbuyprice": "411.4600", "forexbuyprice": "411.4600", "cashsellprice": "414.5600", "forexsellprice": "414.5600", "updatetime": "2025-03-11 18:05:59" }, { "code": "PHP", "name": "菲律宾比索", "midprice": "12.6400", "cashbuyprice": "12.5100", "forexbuyprice": "12.5100", "cashsellprice": "12.7700", "forexsellprice": "12.7700", "updatetime": "2025-03-11 18:05:59" }, { "code": "PKR", "name": "巴基斯坦卢比", "midprice": "--", "cashbuyprice": "--", "forexbuyprice": "--", "cashsellprice": "--", "forexsellprice": "--", "updatetime": "2025-03-11 18:05:59" }, { "code": "RMB", "name": null, "midprice": "--", "cashbuyprice": "--", "forexbuyprice": "--", "cashsellprice": "--", "forexsellprice": "--", "updatetime": "2025-03-11 18:05:59" }, { "code": "RUB", "name": "卢布", "midprice": "8.2800", "cashbuyprice": "7.8300", "forexbuyprice": "7.8300", "cashsellprice": "8.2300", "forexsellprice": "8.2300", "updatetime": "2025-03-11 18:05:59" }, { "code": "SEK", "name": "瑞典克朗", "midprice": "71.2600", "cashbuyprice": "71.8000", "forexbuyprice": "71.8000", "cashsellprice": "72.3800", "forexsellprice": "72.3800", "updatetime": "2025-03-11 18:05:59" }, { "code": "SGD", "name": "新加坡元", "midprice": "540.3000", "cashbuyprice": "541.3900", "forexbuyprice": "541.3900", "cashsellprice": "545.4600", "forexsellprice": "545.4600", "updatetime": "2025-03-11 18:05:59" }, { "code": "THB", "name": "泰国铢", "midprice": "21.3400", "cashbuyprice": "21.3000", "forexbuyprice": "21.3000", "cashsellprice": "21.4800", "forexsellprice": "21.4800", "updatetime": "2025-03-11 18:05:59" }, { "code": "TWD", "name": "新台币", "midprice": "22.0500", "cashbuyprice": "21.0900", "forexbuyprice": "--", "cashsellprice": "23.1100", "forexsellprice": "--", "updatetime": "2025-03-11 18:05:59" }, { "code": "USD", "name": "美元", "midprice": "717.4100", "cashbuyprice": "722.0800", "forexbuyprice": "722.0800", "cashsellprice": "725.1100", "forexsellprice": "725.1100", "updatetime": "2025-03-11 18:05:59" }, { "code": "ZAR", "name": "南非兰特", "midprice": "39.2500", "cashbuyprice": "39.4300", "forexbuyprice": "39.4300", "cashsellprice": "39.8800", "forexsellprice": "39.8800", "updatetime": "2025-03-11 18:05:59" } ] } }
代号 | 说明 |
---|---|
201 | 要兑换的货币为空 |
202 | 兑换后的货币为空 |
203 | 兑换数量为空 |
204 | 要兑换的货币有误 |
205 | 兑换后的货币有误 |
206 | 货币为空 |
207 | 货币有误 |
208 | 没有信息 |
代号 | 说明 |
---|---|
101 | APPKEY为空或不存在 |
102 | APPKEY已过期 |
103 | APPKEY无请求此数据权限 |
104 | 请求超过次数限制 |
105 | IP被禁止 |
106 | IP请求超过限制 |
107 | 接口维护中 |
108 | 接口已停用 |
© 2015-2025 杭州极速互联科技有限公司 版权所有 浙ICP备17047587号-4 浙公网安备33010502005096 增值电信业务经营许可证:浙B2-20190875