接口用途

指数最新 K 线/分钟线。可选 lt,与股票 latest 相同,单次最多 5 条;更多请用 index_bars_history。

请求地址POST https://liangmai.pro/api/gateway

统一网关调用,query 参数携带 token(访问令牌)与 api=idx_bars_latest(接口名),其余为业务参数。

参数说明

参数名称是否必填说明示例
index_full指数代码必填指数代码.市场(如 000001.SH)000001.SH
interval分时级别可选K线/分时级别(1/5/15/30/60 为分钟,d/w/m/y 为日/周/月/年)
lt条数可选返回条数(最多见接口说明)5

返回字段说明

字段类型说明
tstring时间
ofloat开盘价
hfloat最高价
lfloat最低价
cfloat收盘价
vfloat成交量
afloat成交额
pcfloat前收盘价

调用示例

Python
import requests

url = "https://liangmai.pro/api/gateway"
params = {
    "token": "YOUR_TOKEN",
    "api": "idx_bars_latest",
    "index_full": "000001.SH",
    "lt": "5",
}
r = requests.post(url, params=params)
print(r.json())
PHP
$url = "https://liangmai.pro/api/gateway";
$data = [
    'token' => 'YOUR_TOKEN',
    'api' => 'idx_bars_latest',
    'index_full' => '000001.SH',
    'lt' => '5',
];
$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: "idx_bars_latest",
    index_full: "000001.SH",
    lt: "5",
});

fetch("https://liangmai.pro/api/gateway", {
  method: "POST",
  body: params
})
  .then(r => r.json())
  .then(data => console.log(data));

更新与限流

调用限制:受您当前 Token 的每分钟请求上限约束;高峰时可能排队或短暂不可用。

相关接口