接口用途
根据基金代码(《封闭式基金列表》《ETF基金列表》《LOF基金列表》或《所有基金列表》返回的 dm,一般为6位数字,不要加 sh/sz 前缀)获取历史K线数据(不复权)。分时级别支持日、周、月,参数分别为 Day、Week、Month(dn 为 Day 的别名,效果相同)。
请求地址
POST https://liangmai.pro/api/gateway统一网关调用,query 参数携带 token(访问令牌)与 api=fund_kline_history(接口名),其余为业务参数。
参数说明
| 参数 | 名称 | 是否必填 | 说明 | 示例 |
|---|---|---|---|---|
fund_code | 基金代码 | 必填 | 基金代码(6 位) | 510300 |
interval | 分时级别 | 可选 | 分时级别:Day=日、Week=周、Month=月(dn 为 Day 别名) | — |
返回字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
d | string | 交易时间,yyyy-MM-dd |
o | number | 开盘价(元) |
h | number | 最高价(元) |
l | number | 最低价(元) |
c | number | 收盘价(元) |
v | number | 成交量(股) |
zde | number | 涨跌额(元) |
zd | number | 涨跌幅(%) |
zf | number | 振幅(%) |
调用示例
Python
import requests
url = "https://liangmai.pro/api/gateway"
params = {
"token": "YOUR_TOKEN",
"api": "fund_kline_history",
"fund_code": "510300",
}
r = requests.post(url, params=params)
print(r.json())PHP
$url = "https://liangmai.pro/api/gateway";
$data = [
'token' => 'YOUR_TOKEN',
'api' => 'fund_kline_history',
'fund_code' => '510300',
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);
curl_close($ch);
echo $res;JavaScript
const params = new URLSearchParams({
token: "YOUR_TOKEN",
api: "fund_kline_history",
fund_code: "510300",
});
fetch("https://liangmai.pro/api/gateway", {
method: "POST",
body: params
})
.then(r => r.json())
.then(data => console.log(data));更新与限流
数据更新:每日16:30 ·