接口用途
当前值在自身历史窗口中的分位及统计量。
请求地址
POST https://liangmai.pro/api/gateway统一网关调用,query 参数携带 token(访问令牌)与 api=factors_percentile(接口名),其余为业务参数。
参数说明
| 参数 | 名称 | 是否必填 | 说明 | 示例 |
|---|---|---|---|---|
factor_id | 因子 ID | 必填 | 因子唯一 ID(如 pe_ttm) | pe_ttm |
ts_code | 股票代码 | 必填 | 股票代码(可传 ts_code / code / symbol,6 位;带后缀自动规范为 6 位) | 600519 |
返回字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
current_value | number/null | 当前值 |
period | int | 窗口天数 |
percentile | number/null | 0–100 历史分位 |
description | string | 白话说明 |
history_min | number/null | 窗口最小值 |
history_max | number/null | 窗口最大值 |
history_median | number/null | 窗口中位数 |
history_mean | number/null | 窗口均值 |
调用示例
Python
import requests
url = "https://liangmai.pro/api/gateway"
params = {
"token": "YOUR_TOKEN",
"api": "factors_percentile",
"factor_id": "pe_ttm",
"ts_code": "600519",
}
r = requests.post(url, params=params)
print(r.json())PHP
$url = "https://liangmai.pro/api/gateway";
$data = [
'token' => 'YOUR_TOKEN',
'api' => 'factors_percentile',
'factor_id' => 'pe_ttm',
'ts_code' => '600519',
];
$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: "factors_percentile",
factor_id: "pe_ttm",
ts_code: "600519",
});
fetch("https://liangmai.pro/api/gateway", {
method: "POST",
body: params
})
.then(r => r.json())
.then(data => console.log(data));更新与限流
数据更新:基于历史序列现算或预计算 ·