Home
avatar

如果不存在过

黄金实时交易行情

在线查询实时金价,上海交易所金价以及国际市场行情

接口信息

项目内容
接口地址https://api.code410.com/api/gold/trade
返回格式application/json
请求方式HTTP GET POST/JSON
更新日期2024-04-04
调用权限免费开放
每日限制无限制
请求频率限制1秒5次

请求示例

https://api.code410.com/api/gold/trade

请求 HEADER

名称
Content-Typeapplication/x-www-form-urlencoded;charset;

请求参数说明

名称必填类型示例值说明
linestringyt仅 line=yt 时有用

返回参数说明

名称类型说明
codeint状态码
msgstring状态信息
datastring请求结果数据集
debugstring/array调试数据
exec_timefloat执行耗时
user_ipstring客户端IP

错误码参照

错误码类型说明
403int没有权限
400int参数传递不正确
500int服务器内部错误

在线调试 / 完整文档

本接口为 信息查找 分类下的开放接口。完整文档、在线调试与示例代码请前往 https://api.code410.com/doc/208

返回示例

{
  "code": 200,
  "msg": "请求成功",
  "data": {
    "UpTime": "2026-06-07 15:21:50",
    "OpenMark": 0,
    "LF": [
      {
        "Symbol": "Au",
        "Name": "黄金",
        "BP": 946.74,
        "SP": 951.74,
        "High": 951.74,
        "Low": 946.74,
        "Sort": 1
      },
      {
        "Symbol": "Pt",
        "Name": "铂金",
        "BP": 360.7,
        "SP": 459.7,
        "High": 459.7,
        "Low": 360.7,
        "Sort": 2
      },
      {
        "Symbol": "Pd",
        "Name": "钯金",
        "BP": 266.1,
        "SP": 270.1,
        "High": 270.1,
        "Low": 266.1,
        "Sort": 3
      },
      {
        "Symbol": "Ag",
        "Name": "白银(含税)",
        "BP": 16.399,
        "SP": 16.619,
        "High": 16.619,
        "Low": 16.399,
        "Sort": 4
      },
      {
        "Symbol": "Au750Old",
        "Name": "18K旧料",
        "BP": 706.3,
        "SP": 0,
        "High": 0,
        "Low": 0,
        "Sort": 6
      },
      {
        "Symbol": "Pt950",
        "Name": "铂金950",
        "BP": 340.1,
        "SP": 0,
        "High": 0,
        "Low": 0,
        "Sort": 7
      },
      {
        "Symbol": "Pd990",
        "Name": "钯金990",
        "BP": 258.1,
        "SP": 0,
        "High": 0,
        "Low": 0,
        "Sort": 8
      },
      {
        "Symbol": "AU999JS",
        "Name": "旧饰999",
        "BP": 944.6,
        "SP": 0,
        "High": 0,
        "Low": 0,
        "Sort": 9
      },
      {
        "Symbol": "AU9999JS",
        "Name": "旧饰9999",
        "BP": 945.3,
        "SP": 0,
        "High": 0,
        "Low": 0,
        "Sort": 10
      },
      {
        "Symbol": "AU999YJ",
        "Name": "硬金",
        "BP": 944.3,
        "SP": 0,
        "High": 0,
        "Low": 0,
        "Sort": 11
      }
    ],
    "SH": [
      {
        "Symbol": "SH_AuTD",
        "Name": "黄金(T+D)",
        "BP": 946.38,
        "SP": 947.1,
        "High": 974.6,
        "Low": 946.48,
        "Sort": 1
      },
      {
        "Symbol": "SH_Au9999",
        "Name": "黄金99.99",
        "BP": 946.8,
        "SP": 948.8,
        "High": 975,
        "Low": 940,
        "Sort": 2
      },
      {
        "Symbol": "SH_Au9995",
        "Name": "黄金99.95",
        "BP": 890,
        "SP": 1020,
        "High": 0,
        "Low": 0,
        "Sort": 3
      },
      {
        "Symbol": "SH_AgTD",
        "Name": "白银(T+D)",
        "BP": 16420,
        "SP": 16479,
        "High": 17755,
        "Low": 16400,
        "Sort": 4
      },
      {
        "Symbol": "SH_PT9995",
        "Name": "铂金9995",
        "BP": 0,
        "SP": 0,
        "High": 468.01,
        "Low": 461,
        "Sort": 5
      }
    ],
    "GJ": [
      {
        "Symbol": "GJ_HKAu",
        "Name": "港金",
        "BP": 40265,
        "SP": 40276,
        "High": 41683,
        "Low": 40099,
        "Sort": 1
      },
      {
        "Symbol": "GJ_Au",
        "Name": "伦敦金",
        "BP": 4328.5,
        "SP": 4329.2,
        "High": 4480.6,
        "Low": 4311.1,
        "Sort": 2
      },
      {
        "Symbol": "GJ_Pt",
        "Name": "伦敦铂",
        "BP": 1777,
        "SP": 1780,
        "High": 1903.7,
        "Low": 1769.3,
        "Sort": 3
      },
      {
        "Symbol": "GJ_Pd",
        "Name": "伦敦钯",
        "BP": 1228.8,
        "SP": 1232.8,
        "High": 1329.1,
        "Low": 1221.2,
        "Sort": 4
      },
      {
        "Symbol": "GJ_Ag",
        "Name": "伦敦银",
        "BP": 67.82,
        "SP": 67.86,
        "High": 74.1,
        "Low": 67.53,
        "Sort": 5
      },
      {
        "Symbol": "GJ_UDI",
        "Name": "美元指数",
        "BP": 100.06,
        "SP": 100.06,
        "High": 100.1,
        "Low": 99.16,
        "Sort": 6
      },
      {
        "Symbol": "GJ_USD",
        "Name": "美元/人民币",
        "BP": 6.7905,
        "SP": 6.7905,
        "High": 6.7919,
        "Low": 6.7629,
        "Sort": 7
      }
    ]
  },
  "exec_time": 0.548,
  "ip": "197.149.235.178"
}

示例代码

// jQuery-Ajax
$.ajax({
	url: 'https://api.code410.com/api/gold/trade',
	data: {
		line: "yt",
	},
	type: 'GET',
	dataType: 'json',
	success: function (data) {
		console.log(data); // 请求成功,输出结果
	},
	error: function () {
		console.log('请求失败');
	}
});
import requests

url = "https://api.code410.com/api/gold/trade"
params = {
    "line": "yt",
}
res = requests.get(url, params=params)
print(res.json())
const https = require('https');
const url = 'https://api.code410.com/api/gold/trade?line=yt';

https.get(url, res => {
  let data = '';
  res.on('data', chunk => data += chunk);
  res.on('end', () => console.log(JSON.parse(data)));
}).on('error', err => console.error(err));
package main

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

func main() {
	resp, err := http.Get("https://api.code410.com/api/gold/trade?line=yt")
	if err != nil {
		fmt.Println("http get error", err)
		return
	}
	defer resp.Body.Close()

	result, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(result))
}
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class Test {
    public static void main(String[] args) {
        try {
            URL url = new URL("https://api.code410.com/api/gold/trade?line=yt");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("GET");
            conn.connect();

            BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
            String line;
            StringBuilder sb = new StringBuilder();
            while ((line = reader.readLine()) != null) sb.append(line);
            reader.close();
            System.out.println(sb.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program {
    static async Task Main() {
        HttpClient client = new HttpClient();
        string url = "https://api.code410.com/api/gold/trade?line=yt";
        HttpResponseMessage response = await client.GetAsync(url);
        string body = await response.Content.ReadAsStringAsync();
        Console.WriteLine(body);
    }
}
<?php
$url = "https://api.code410.com/api/gold/trade?line=yt";
$response = file_get_contents($url);
$data = json_decode($response, true);
print_r($data);
curl "https://api.code410.com/api/gold/trade?line=yt"

在线调试

填写参数后点击「发起请求」查看实时返回结果。

免费