| 参数名称 | 类型 | 必填 | 说明 |
| goldid | int | 是 | 编号可包含 1051:黄金T+D,1052:白银T+D,1053:黄金9999,1054:黄金9995,1055:白银9999,1056:铂金9995,1057:白银999,1058:金条100g,1059:黄金T+N1,1060:黄金T+N2 |
| 参数名称 | 类型 | 说明 | |
| uptime | string | 更新时间 (行情有变化uptime才会更新) | |
| goldid | int | 编号ID | |
| variety | string | 品种 | |
| varietynm | string | 品种名称 | |
| last_price | decimal | 当天价 | |
| buy_price | decimal | 买入价 | |
| sell_price | decimal | 卖出价 | |
| volume | int | 成交量 | |
| change_price | decimal | 涨跌额 | |
| change_margin | string | 涨跌幅 | |
| high_price | decimal | 最高价 | |
| low_price | decimal | 最低价 | |
| open_price | decimal | 开盘价 | |
| yesy_price | decimal | 昨收价 |
require_once("curl.func.php");
$method = "POST";
$url = "http://open.liupai.net/gold/shgold";
$headers = NULL;
$params = array(
"appkey" => "yourappsecret",
"goldid" => "参数1"
);
$result = api_curl($method, $url, $headers, $params);
if ($result) {
$body = json_decode($result["body"], TRUE);
$status_code = $body["status"];
if ($status_code == "200") {
var_dump($body["result"]);
}else
var_dump($body);
}else
echo "发送请求失败";
/**
* 主函数
* @param args
*/
public static void main(String args[])
{
//请求地址设置
String url = "http://open.liupai.net/gold/shgold";
//请求方法设置
String requestMethod = "POST";
//请求头部设置
Map<String, String> headers = new HashMap<String, String>();
//请求参数设置
Map<String, String> params = new HashMap<String, String>();
params.put("appkey", "yourappsecret");
params.put("goldid", "参数1");
String result = proxyToDesURL(requestMethod, url, headers, params);
if (result != null) {
JSONObject jsonObject = JSONObject.parseObject(result);
String status_code = jsonObject.getString("status");
if (status_code.equals("200")) {
System.out.println("请求成功:" + jsonObject.getString("result"));
} else {
System.out.println("请求失败:" + jsonObject.getString("msg"));
}
} else {
System.out.println("发送请求异常");
}
}
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 测试环境: python2.7
# 安装requests依赖 => pip install requests/ easy_install requests
import requests
import json
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
def api_send_request(method, url, params=None, headers=None):
'''
转发请求到目的主机
@param method str 请求方法
@param url str 请求地址
@param params dict 请求参数
@param headers dict 请求头
'''
method = str.upper(method)
if method == "POST":
return requests.post(url=url, data=params, headers=headers)
elif method == "GET":
return requests.get(url=url, params=params, headers=headers)
else:
return None
method = "POST"
url = "http://open.liupai.net/gold/shgold"
headers = None
params = {
"appkey" : "yourappsecret",
"goldid" : "参数1"
}
result = api_send_request(method=method, url=url, params=params, headers=headers)
if result:
body = result.result
response = json.loads(body)
status_code = response["status"]
if (status_code == "200"):
print("请求成功:%s" % (body,))
else:
{
"status": 200,
"msg": "OK",
"result": {
"goldid": "1051",
"variety": "AuT+D",
"varietynm": "黄金T+D",
"last_price": "342.22",
"buy_price": "0",
"sell_price": "342.22",
"volume": "192846",
"change_price": "2.3",
"change_margin": "0.68%",
"high_price": "346.44",
"low_price": "340.3",
"open_price": "342.01",
"yesy_price": "339.92",
"uptime": "2019-08-08 15:29:59"
}
}| 参数名称 | 类型 | 必填 | 说明 |
| goldid | int | 是 | 编号可包含 1051:黄金T+D,1052:白银T+D,1053:黄金9999,1054:黄金9995,1056:铂金9995,1058:金条100g,1059:黄金T+N1,1060:黄金T+N2,1080:iAu9999,1081:mAuT+D |
| date | int | 是 | 查询的年月日 20161101 |
| 参数名称 | 类型 | 说明 | |
| goldid | int | 编号ID | |
| variety | string | 品种编号 | |
| varietynm | int | 品种名称 | |
| days | string | 查询年月日 | |
| last_price | decimal | 当前价 | |
| high_price | decimal | 最高价 | |
| low_price | decimal | 最低价 | |
| open_price | decimal | 开盘价 | |
| yesy_price | decimal | 收盘价 | |
| rise_fall | decimal | 涨跌(元) | |
| rise_fall_per | string | 涨跌幅 | |
| vwap_price | decimal | 加权平均价 | |
| volume | decimal | 成交量 | |
| turn_volume | decimal | 成交金额 | |
| inventory | decimal | 持仓量 | |
| settlement_direction | string | 交收方向 0:无 1:空支付多 2:多支付空 | |
| settlement_direction_nm | file/string | 交收方向 | |
| settlement | decimal | 交收量 |
require_once("curl.func.php");
$method = "POST";
$url = "http://open.liupai.net/gold/shgold_history";
$headers = NULL;
$params = array(
"appkey" => "yourappsecret",
"goldid" => "参数1",
"date" => "参数2"
);
$result = api_curl($method, $url, $headers, $params);
if ($result) {
$body = json_decode($result["body"], TRUE);
$status_code = $body["status"];
if ($status_code == "200") {
var_dump($body["result"]);
}else
var_dump($body);
}else
echo "发送请求失败";
/**
* 主函数
* @param args
*/
public static void main(String args[])
{
//请求地址设置
String url = "http://open.liupai.net/gold/shgold_history";
//请求方法设置
String requestMethod = "POST";
//请求头部设置
Map<String, String> headers = new HashMap<String, String>();
//请求参数设置
Map<String, String> params = new HashMap<String, String>();
params.put("appkey", "yourappsecret");
params.put("goldid", "参数1");
params.put("date", "参数2");
String result = proxyToDesURL(requestMethod, url, headers, params);
if (result != null) {
JSONObject jsonObject = JSONObject.parseObject(result);
String status_code = jsonObject.getString("status");
if (status_code.equals("200")) {
System.out.println("请求成功:" + jsonObject.getString("result"));
} else {
System.out.println("请求失败:" + jsonObject.getString("msg"));
}
} else {
System.out.println("发送请求异常");
}
}
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 测试环境: python2.7
# 安装requests依赖 => pip install requests/ easy_install requests
import requests
import json
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
def api_send_request(method, url, params=None, headers=None):
'''
转发请求到目的主机
@param method str 请求方法
@param url str 请求地址
@param params dict 请求参数
@param headers dict 请求头
'''
method = str.upper(method)
if method == "POST":
return requests.post(url=url, data=params, headers=headers)
elif method == "GET":
return requests.get(url=url, params=params, headers=headers)
else:
return None
method = "POST"
url = "http://open.liupai.net/gold/shgold_history"
headers = None
params = {
"appkey" : "yourappsecret",
"goldid" : "参数1",
"date" : "参数2"
}
result = api_send_request(method=method, url=url, params=params, headers=headers)
if result:
body = result.result
response = json.loads(body)
status_code = response["status"]
if (status_code == "200"):
prin{
"status": 200,
"msg": "OK",
"result": {
"goldid": "1051",
"variety": "AuT+D",
"varietynm": "黄金T+D",
"days": "2018-08-07",
"last_price": "0.00",
"high_price": "267.87",
"low_price": "267.00",
"open_price": "267.21",
"yesy_price": "267.36",
"rise_fall": "-0.29",
"rise_fall_per": "-0.11",
"vwap_price": "267.38",
"volume": "32990.00",
"turn_volume": "8820926400.00",
"inventory": "189712.00",
"settlement_direction": "2",
"settlement_direction_nm": "多支付空",
"settlement": "11746.00"
}
}| 参数名称 | 类型 | 必填 | 说明 |
| goldid | int | 是 | 编号包含,同时查多个用逗号隔开(如:1201,1202,1203,1204,1205,1206) 1201: 现货黄金(XAU) 1202: 现货钯金(XPD) 1203: 现货白银(XAG) 1204: 现货铂金(XAP) 1205: 香港黄金(GT) 1206: 台两黄金(TWGD) |
| 参数名称 | 类型 | 说明 | |
| goldid | int | 编号 | |
| variety | string | 品种编号 | |
| varietynm | string | 品种名称 | |
| last_price | decimal | 最新价(美元/盎司) | |
| buy_price | decimal | 买入(美元/盎司) | |
| sell_price | decimal | 卖出(美元/盎司) | |
| change_price | string | 涨跌额 | |
| change_margin | string | 涨跌幅 | |
| high_price | decimal | 最高价(美元/盎司) | |
| low_price | decimal | 最低价(美元/盎司) | |
| open_price | decimal | 开盘价(美元/盎司) | |
| yesy_price | decimal | 昨收价(美元/盎司) | |
| uptime | string | 更新时间 (行情有变化uptime才会更新) |
require_once("curl.func.php");
$method = "POST";
$url = "http://open.liupai.net/gold/gsgold";
$headers = NULL;
$params = array(
"appkey" => "yourappsecret",
"goldid" => "参数1"
);
$result = api_curl($method, $url, $headers, $params);
if ($result) {
$body = json_decode($result["body"], TRUE);
$status_code = $body["status"];
if ($status_code == "200") {
var_dump($body["result"]);
}else
var_dump($body);
}else
echo "发送请求失败";
/**
* 主函数
* @param args
*/
public static void main(String args[])
{
//请求地址设置
String url = "http://open.liupai.net/gold/gsgold";
//请求方法设置
String requestMethod = "POST";
//请求头部设置
Map<String, String> headers = new HashMap<String, String>();
//请求参数设置
Map<String, String> params = new HashMap<String, String>();
params.put("appkey", "yourappsecret");
params.put("goldid", "参数1");
String result = proxyToDesURL(requestMethod, url, headers, params);
if (result != null) {
JSONObject jsonObject = JSONObject.parseObject(result);
String status_code = jsonObject.getString("status");
if (status_code.equals("200")) {
System.out.println("请求成功:" + jsonObject.getString("result"));
} else {
System.out.println("请求失败:" + jsonObject.getString("msg"));
}
} else {
System.out.println("发送请求异常");
}
}#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 测试环境: python2.7
# 安装requests依赖 => pip install requests/ easy_install requests
import requests
import json
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
def api_send_request(method, url, params=None, headers=None):
'''
转发请求到目的主机
@param method str 请求方法
@param url str 请求地址
@param params dict 请求参数
@param headers dict 请求头
'''
method = str.upper(method)
if method == "POST":
return requests.post(url=url, data=params, headers=headers)
elif method == "GET":
return requests.get(url=url, params=params, headers=headers)
else:
return None
method = "POST"
url = "http://open.liupai.net/gold/gsgold"
headers = None
params = {
"appkey" : "yourappsecret",
"goldid" : "参数1"
}
result = api_send_request(method=method, url=url, params=params, headers=headers)
if result:
body = result.result
response = json.loads(body)
status_code = response["status"]
if (status_code == "200"):
print("请求成功:%s" % (body,))
else:{
"status": 200,
"msg": "OK",
"result": {
"totLine": "2",
"goldIdS": "1201,1202",
"lists": {
"1201": {
"goldid": "1201",
"variety": "XAU",
"varietynm": "现货黄金",
"last_price": "1496.36",
"buy_price": "1496.21",
"sell_price": "1496.51",
"change_price": "-4.8",
"change_margin": "0.32%",
"high_price": "1506.79",
"low_price": "1491.91",
"open_price": "1500.28",
"yesy_price": "1501.16",
"uptime": "2019-08-08 18:02:50"
},
"1202": {
"goldid": "1202",
"variety": "XPD",
"varietynm": "现货钯金",
"last_price": "1416.4",
"buy_price": "1415.71",
"sell_price": "1417.09",
"change_price": "-1.94",
"change_margin": "0.14%",
"high_price": "1431.33",
"low_price": "1413.6",
"open_price": "1418.41",| 参数名称 | 类型 | 必填 | 说明 |
| goldid | int | 否 | 按编号查询 1011:纽约期金(近月) 1012:伦敦黄金 1013:香港黄金 1014:台湾黄金 1015:东京期金(近月) |
| 参数名称 | 类型 | 说明 | |
| goldid | int | 编号 | |
| variety | string | 品种编号 | |
| varietynm | string | 品种名称 | |
| last_price | decimal | 最新价(人民币元/克) | |
| buy_price | decimal | 买入(人民币元/克) | |
| sell_price | decimal | 卖出(人民币元/克) | |
| volume | int | 成交量(手) | |
| change_price | decimal | 涨跌额 | |
| change_margin | string | 涨跌幅 | |
| high_price | decimal | 最高价(人民币元/克) | |
| low_price | decimal | 最低价(人民币元/克) | |
| open_price | decimal | 开盘价(人民币元/克) | |
| yesy_price | decimal | 昨收价(人民币元/克) | |
| uptime | string | 更新时间 (行情有变化uptime才会更新) |
require_once("curl.func.php");
$method = "POST";
$url = "http://open.liupai.net/gold/ingold";
$headers = NULL;
$params = array(
"appkey" => "yourappsecret",
"goldid" => "参数1"
);
$result = api_curl($method, $url, $headers, $params);
if ($result) {
$body = json_decode($result["body"], TRUE);
$status_code = $body["status"];
if ($status_code == "200") {
var_dump($body["result"]);
}else
var_dump($body);
}else
echo "发送请求失败";
/**
* 主函数
* @param args
*/
public static void main(String args[])
{
//请求地址设置
String url = "http://open.liupai.net/gold/ingold";
//请求方法设置
String requestMethod = "POST";
//请求头部设置
Map<String, String> headers = new HashMap<String, String>();
//请求参数设置
Map<String, String> params = new HashMap<String, String>();
params.put("appkey", "yourappsecret");
params.put("goldid", "参数1");
String result = proxyToDesURL(requestMethod, url, headers, params);
if (result != null) {
JSONObject jsonObject = JSONObject.parseObject(result);
String status_code = jsonObject.getString("status");
if (status_code.equals("200")) {
System.out.println("请求成功:" + jsonObject.getString("result"));
} else {
System.out.println("请求失败:" + jsonObject.getString("msg"));
}
} else {
System.out.println("发送请求异常");
}
}
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 测试环境: python2.7
# 安装requests依赖 => pip install requests/ easy_install requests
import requests
import json
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
def api_send_request(method, url, params=None, headers=None):
'''
转发请求到目的主机
@param method str 请求方法
@param url str 请求地址
@param params dict 请求参数
@param headers dict 请求头
'''
method = str.upper(method)
if method == "POST":
return requests.post(url=url, data=params, headers=headers)
elif method == "GET":
return requests.get(url=url, params=params, headers=headers)
else:
return None
method = "POST"
url = "http://open.liupai.net/gold/ingold"
headers = None
params = {
"appkey" : "yourappsecret",
"goldid" : "参数1"
}
result = api_send_request(method=method, url=url, params=params, headers=headers)
if result:
body = result.result
response = json.loads(body)
status_code = response["status"]
if (status_code == "200"):
print("请求成功:%s" % (body,))
else:
{
"status": 200,
"msg": "OK",
"result": {
"goldid": "1011",
"variety": "NEWYORK_FUTURESGOLD.GOLDCNY",
"varietynm": "纽约期金(近月)",
"last_price": "341.62",
"buy_price": "341.62",
"sell_price": "341.64",
"volume": "0",
"change_price": "-2.54",
"change_margin": "0.74%",
"high_price": "343.93",
"low_price": "340.51",
"open_price": "342.46",
"yesy_price": "344.16",
"uptime": "2019-08-08 18:09:44"
}
}| 参数名称 | 类型 | 必填 | 说明 |
| goldid | int | 否 | 按编号查询 1111:纽约黄金 1112:纽约铂 1113:纽约钯 1114:东京黄金 1115:东京铂 1116:东京钯 1117:美原油06 1118:美原油05 |
| 参数名称 | 类型 | 说明 | |
| goldid | int | 编号 | |
| variety | string | 品种编号 | |
| varietynm | string | 品种名称 | |
| last_price | decimal | 最新价 | |
| buy_price | decimal | 买入 | |
| sell_price | decimal | 卖出 | |
| volume | int | 成交量 | |
| change_price | string | 涨跌额 | |
| change_margin | string | 涨跌幅 | |
| high_price | decimal | 最高价 | |
| low_price | decimal | 最低价 | |
| open_price | decimal | 开盘价 | |
| yesy_price | decimal | 昨收价 | |
| uptime | string | 更新时间 |
require_once("curl.func.php");
$method = "POST";
$url = "http://open.liupai.net/gold/qhgold";
$headers = NULL;
$params = array(
"appkey" => "yourappsecret",
"goldid" => "参数1"
);
$result = api_curl($method, $url, $headers, $params);
if ($result) {
$body = json_decode($result["body"], TRUE);
$status_code = $body["status"];
if ($status_code == "200") {
var_dump($body["result"]);
}else
var_dump($body);
}else
echo "发送请求失败";
/**
* 主函数
* @param args
*/
public static void main(String args[])
{
//请求地址设置
String url = "http://open.liupai.net/gold/qhgold";
//请求方法设置
String requestMethod = "POST";
//请求头部设置
Map<String, String> headers = new HashMap<String, String>();
//请求参数设置
Map<String, String> params = new HashMap<String, String>();
params.put("appkey", "yourappsecret");
params.put("goldid", "参数1");
String result = proxyToDesURL(requestMethod, url, headers, params);
if (result != null) {
JSONObject jsonObject = JSONObject.parseObject(result);
String status_code = jsonObject.getString("status");
if (status_code.equals("200")) {
System.out.println("请求成功:" + jsonObject.getString("result"));
} else {
System.out.println("请求失败:" + jsonObject.getString("msg"));
}
} else {
System.out.println("发送请求异常");
}
}
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 测试环境: python2.7
# 安装requests依赖 => pip install requests/ easy_install requests
import requests
import json
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
def api_send_request(method, url, params=None, headers=None):
'''
转发请求到目的主机
@param method str 请求方法
@param url str 请求地址
@param params dict 请求参数
@param headers dict 请求头
'''
method = str.upper(method)
if method == "POST":
return requests.post(url=url, data=params, headers=headers)
elif method == "GET":
return requests.get(url=url, params=params, headers=headers)
else:
return None
method = "POST"
url = "http://open.liupai.net/gold/qhgold"
headers = None
params = {
"appkey" : "yourappsecret",
"goldid" : "参数1"
}
result = api_send_request(method=method, url=url, params=params, headers=headers)
if result:
body = result.result
response = json.loads(body)
status_code = response["status"]
if (status_code == "200"):
print("请求成功:%s" % (body,))
else:
{
"status": 200,
"msg": "OK",
"result": {
"goldid": "1111",
"variety": "NEWYORK_GOLD.GOLDFUTURES",
"varietynm": "纽约黄金",
"last_price": "1501.9",
"buy_price": "1321.7",
"sell_price": "1321.8",
"volume": "2823",
"change_price": "4.5",
"change_margin": "0.3%",
"high_price": "1504.9",
"low_price": "1513.2",
"open_price": "1512.1",
"yesy_price": "1497.4",
"uptime": "2019-08-08 18:15:42"
}
}
| 参数名称 | 类型 | 必填 | 说明 |
| goldid | int | 否 | 按编号查询 1151:工行纸黄金(美元) 1152:工行纸黄金(人民币) 1153:工行纸白银(美元) 1154:工行纸白银(人民币) 1155:工行纸铂金(美元) 1156:工行纸铂金(人民币) 1157:工行纸钯金(美元) 1158:工行纸钯金(人民币) |
| 参数名称 | 类型 | 说明 | |
| goldid | int | 编号 | |
| variety | string | 品种编号 | |
| varietynm | string | 品种名称 | |
| last_price | decimal | 中间价 | |
| high_price | decimal | 最高中间价 | |
| low_price | decimal | 最低中间价 | |
| buy_price | decimal | 银行买入价 | |
| sell_price | decimal | 银行卖出价 | |
| uptime | string | 更新时间 |
require_once("curl.func.php");
$method = "POST";
$url = "http://open.liupai.net/gold/gzgold";
$headers = NULL;
$params = array(
"appkey" => "yourappsecret",
"goldid" => "参数1"
);
$result = api_curl($method, $url, $headers, $params);
if ($result) {
$body = json_decode($result["body"], TRUE);
$status_code = $body["status"];
if ($status_code == "200") {
var_dump($body["result"]);
}else
var_dump($body);
}else
echo "发送请求失败";
/**
* 主函数
* @param args
*/
public static void main(String args[])
{
//请求地址设置
String url = "http://open.liupai.net/gold/gzgold";
//请求方法设置
String requestMethod = "POST";
//请求头部设置
Map<String, String> headers = new HashMap<String, String>();
//请求参数设置
Map<String, String> params = new HashMap<String, String>();
params.put("appkey", "yourappsecret");
params.put("goldid", "参数1");
String result = proxyToDesURL(requestMethod, url, headers, params);
if (result != null) {
JSONObject jsonObject = JSONObject.parseObject(result);
String status_code = jsonObject.getString("status");
if (status_code.equals("200")) {
System.out.println("请求成功:" + jsonObject.getString("result"));
} else {
System.out.println("请求失败:" + jsonObject.getString("msg"));
}
} else {
System.out.println("发送请求异常");
}
}
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 测试环境: python2.7
# 安装requests依赖 => pip install requests/ easy_install requests
import requests
import json
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
def api_send_request(method, url, params=None, headers=None):
'''
转发请求到目的主机
@param method str 请求方法
@param url str 请求地址
@param params dict 请求参数
@param headers dict 请求头
'''
method = str.upper(method)
if method == "POST":
return requests.post(url=url, data=params, headers=headers)
elif method == "GET":
return requests.get(url=url, params=params, headers=headers)
else:
return None
method = "POST"
url = "http://open.liupai.net/gold/gzgold"
headers = None
params = {
"appkey" : "yourappsecret",
"goldid" : "参数1"
}
result = api_send_request(method=method, url=url, params=params, headers=headers)
if result:
body = result.result
response = json.loads(body)
status_code = response["status"]
if (status_code == "200"):
print("请求成功:%s" % (body,))
else:
{
"status": 200,
"msg": "OK",
"result": {
"goldid": "1151",
"variety": "USDAAU",
"varietynm": "工行纸黄金(美元)",
"last_price": "1496.275",
"high_price": "1510.085",
"low_price": "1491.815",
"buy_price": "1495.375",
"sell_price": "1497.175",
"uptime": "2019-08-08 18:35:22"
}
}| 参数名称 | 类型 | 必填 | 说明 |
| 暂无参数 | |||
| 参数名称 | 类型 | 说明 | |
| goldid | int | 编号 | |
| variety | string | 品种 | |
| varietynm | int | 品种名称 | |
| xauPrice | decimal | 黄金价格(oz盎司) | |
| xagPrice | decimal | 白银价格(oz盎司) | |
| chgXau | string | 黄金涨跌额 | |
| chgXag | string | 白银涨跌额 | |
| pcXau | string | pc黄金 | |
| pcXag | string | pc白银 | |
| xauClose | decimal | 黄金收盘价 | |
| xagClose | decimal | 白银收盘价 | |
| uptime | string | 更新时间 (行情有变化uptime才会更新) |
require_once("curl.func.php");
$method = "POST";
$url = "http://open.liupai.net/gold/idgold";
$headers = NULL;
$params = array(
"appkey" => "yourappsecret"
);
$result = api_curl($method, $url, $headers, $params);
if ($result) {
$body = json_decode($result["body"], TRUE);
$status_code = $body["status"];
if ($status_code == "200") {
var_dump($body["result"]);
}else
var_dump($body);
}else
echo "发送请求失败";
/**
* 主函数
* @param args
*/
public static void main(String args[])
{
//请求地址设置
String url = "http://open.liupai.net/gold/idgold";
//请求方法设置
String requestMethod = "POST";
//请求头部设置
Map<String, String> headers = new HashMap<String, String>();
//请求参数设置
Map<String, String> params = new HashMap<String, String>();
params.put("appkey", "yourappsecret");
String result = proxyToDesURL(requestMethod, url, headers, params);
if (result != null) {
JSONObject jsonObject = JSONObject.parseObject(result);
String status_code = jsonObject.getString("status");
if (status_code.equals("200")) {
System.out.println("请求成功:" + jsonObject.getString("result"));
} else {
System.out.println("请求失败:" + jsonObject.getString("msg"));
}
} else {
System.out.println("发送请求异常");
}
}#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 测试环境: python2.7
# 安装requests依赖 => pip install requests/ easy_install requests
import requests
import json
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
def api_send_request(method, url, params=None, headers=None):
'''
转发请求到目的主机
@param method str 请求方法
@param url str 请求地址
@param params dict 请求参数
@param headers dict 请求头
'''
method = str.upper(method)
if method == "POST":
return requests.post(url=url, data=params, headers=headers)
elif method == "GET":
return requests.get(url=url, params=params, headers=headers)
else:
return None
method = "POST"
url = "http://open.liupai.net/gold/idgold"
headers = None
params = {
"appkey" : "yourappsecret"
}
result = api_send_request(method=method, url=url, params=params, headers=headers)
if result:
body = result.result
response = json.loads(body)
status_code = response["status"]
if (status_code == "200"):
print("请求成功:%s" % (body,))
else:
print("请求失败: %s" % (body,))
else:
print("发送请求失败"){
"status": 200,
"msg": "OK",
"result": {
"goldid": 2001,
"variety": "INR",
"varietynm": "印度黄金",
"xauPrice": 125305.7748,
"xagPrice": 1797.894,
"chgXau": -483.5183,
"chgXag": -20.1576,
"pcXau": -0.3844,
"pcXag": -1.1087,
"xauClose": 125789.29308,
"xagClose": 1818.05163,
"uptime": "2021-03-29 18:11:11"
}
}| 状态码 | 描述 |
| 107 | 接口维护中 |
| 108 | 暂无数据 |
| 状态码 | 描述 |
| 101 | APPKEY为空或不存在 |
| 102 | APPKEY已过期 |
| 103 | APPKEY无请求此数据权限 |
| 104 | 请求超过次数限制 |
| 105 | IP被禁 |
| 106 | IP请求超过限制 |
| 107 | 接口维护中 |
| 108 | 接口已停用 |
| 计次套餐 | 权限 | 原价 | 优惠价 | 单价 |
| 试用套餐 | 20次 | 0.01 | / | ≈0.00050元/次 |
| level1 | 10000次 | 98.00 | / | ≈0.00980元/次 |
| level2 | 50000次 | 458.00 | / | ≈0.00916元/次 |
| level3 | 120000次 | 1000.00 | / | ≈0.00833元/次 |
| level4 | 500000次 | 3000.00 | / | ≈0.00600元/次 |
| 更多优惠,请咨询 010-8639-9970 周一至周五(9:30-18:30) | ||||
| 包月套餐 | 权限 | 原价 | 优惠价 | 单价 |
| M-level1 | 3000次/天 | 750.00 | / | ≈0.00833元/次 |
| M-level2 | 5000次/天 | 1200.00 | / | ≈0.00800元/次 |
| M-level3 | 10000次/天 | 1800.00 | / | ≈0.00600元/次 |
| * 套餐使用时限为订购之日起30日。 | ||||
| 包年套餐 | 权限 | 原价 | 优惠价 | 单价 |
| L-level1 | 10/QPS | 16800.00 | / | 不限次 |
| * 套餐使用时限为订购之日起1年。 | ||||
| 用户 | 购买时间 | 周期 | 套餐 |
| 185****9356 | 2025-12-06 16:59:25 | 一年 | **** |
| 198****1249 | 2025-08-17 20:12:59 | 一年 | **** |
| 198****1249 | 2025-08-12 10:50:22 | 一年 | **** |
| 151****5393 | 2025-08-03 14:36:56 | 一年 | **** |
| 130****9856 | 2025-07-15 13:18:13 | 一年 | **** |
| 130****9856 | 2025-07-14 14:31:26 | 一年 | **** |
| 132****1828 | 2025-05-31 23:17:18 | 一年 | **** |
| 159****7935 | 2022-08-29 19:23:48 | 一年 | **** |
| 188****6464 | 2022-01-21 20:58:22 | 一年 | **** |
| 159****6321 | 2020-09-03 13:21:43 | 一年 | **** |
