List available factors
curl --request GET \
--url https://api.reportify.cn/v1/quant/factors \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.reportify.cn/v1/quant/factors"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.reportify.cn/v1/quant/factors', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.reportify.cn/v1/quant/factors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.reportify.cn/v1/quant/factors"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.reportify.cn/v1/quant/factors")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reportify.cn/v1/quant/factors")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"name": "<string>",
"type": "<string>",
"level": 123,
"description": "<string>",
"description_en": "<string>"
}
]{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}量化分析接口
获取因子列表
获取所有可用的因子(变量和函数)定义
GET
/
v1
/
quant
/
factors
List available factors
curl --request GET \
--url https://api.reportify.cn/v1/quant/factors \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.reportify.cn/v1/quant/factors"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.reportify.cn/v1/quant/factors', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.reportify.cn/v1/quant/factors",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.reportify.cn/v1/quant/factors"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.reportify.cn/v1/quant/factors")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.reportify.cn/v1/quant/factors")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"name": "<string>",
"type": "<string>",
"level": 123,
"description": "<string>",
"description_en": "<string>"
}
]{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}获取所有可用的因子(变量和函数)定义,用于公式计算。
curl https://api.reportify.cn/v1/quant/factors \
-H "Authorization: Bearer <token>"
import requests
response = requests.get(
"https://api.reportify.cn/v1/quant/factors",
headers={"Authorization": "Bearer <token>"}
)
print(response.json())
const response = await fetch('https://api.reportify.cn/v1/quant/factors', {
headers: {
'Authorization': 'Bearer <token>'
}
});
const data = await response.json();
请求参数
string
default:"cn"
股票市场:
cn(A股), hk(港股), us(美股)响应参数
返回FactorMeta[] 数组,因子列表按 level 分类。
Show FactorMeta 字段
Show FactorMeta 字段
响应示例
[
{
"name": "CLOSE",
"type": "variable",
"level": 0,
"description": "收盘价"
},
{
"name": "MA",
"type": "function",
"level": 0,
"description": "简单移动平均"
},
{
"name": "RSI",
"type": "function",
"level": 2,
"description": "相对强弱指数"
},
{
"name": "PE",
"type": "function",
"level": 2,
"description": "市盈率(需括号调用:PE())"
}
]
技术因子(Level 0-2)
Level 0 - 变量
| 名称 | 别名 | 描述 |
|---|---|---|
CLOSE | C | 收盘价 |
OPEN | O | 开盘价 |
HIGH | H | 最高价 |
LOW | L | 最低价 |
VOLUME | V, VOL | 成交量 |
AMOUNT | - | 成交额 |
LISTING_DATE | - | 上市日期(YYYY-MM-DD 字符串) |
ISSUE_PRICE | - | IPO 发行价 |
Level 0 - 股票属性函数
| 函数 | 描述 | 示例 |
|---|---|---|
IS_ST() | 是否为 ST 股票 | IS_ST() == 0 排除 ST |
IS_LIMIT_UP() | 是否一字涨停 | IS_LIMIT_UP() == 0 |
IS_LIMIT_DOWN() | 是否一字跌停 | IS_LIMIT_DOWN() == 0 |
IS_CHAIN_MAIN() | 是否主板(60/000 开头) | IS_CHAIN_MAIN() == 1 |
IS_CHAIN_STAR() | 是否科创板(68 开头) | IS_CHAIN_STAR() == 1 |
IS_CHAIN_CHINEXT() | 是否创业板(30 开头) | IS_CHAIN_CHINEXT() == 1 |
Level 0 - 基础函数 (TongDaXin 风格: col 在前, n 在后)
| 函数 | 描述 | 示例 |
|---|---|---|
MA(X, N) | N 日简单移动平均 | MA(CLOSE, 20) |
EMA(X, N) | N 日指数移动平均 | EMA(CLOSE, 12) |
SMA(X, N, M) | 平滑移动平均 | SMA(CLOSE, 9, 1) |
REF(X, N) | 引用 N 天前的值 | REF(CLOSE, 1) |
HHV(X, N) | N 周期最高值 | HHV(HIGH, 20) |
LLV(X, N) | N 周期最低值 | LLV(LOW, 20) |
STD(X, N) | N 周期标准差 | STD(CLOSE, 20) |
SUM(X, N) | N 周期求和 | SUM(VOLUME, 5) |
ABS(X) | 绝对值 | ABS(CLOSE - OPEN) |
MAX(X, Y) | 取最大值 | MAX(CLOSE, OPEN) |
MIN(X, Y) | 取最小值 | MIN(CLOSE, OPEN) |
IF(C, A, B) | 条件选择 | IF(CLOSE > OPEN, 1, 0) |
Level 1 - 应用函数
| 函数 | 描述 | 示例 |
|---|---|---|
CROSS(A, B) | A 上穿 B | CROSS(MA(CLOSE, 5), MA(CLOSE, 10)) |
CROSSDOWN(A, B) | A 下穿 B | CROSSDOWN(MA(CLOSE, 5), MA(CLOSE, 10)) |
COUNT(X, N) | N 周期内满足条件的天数 | COUNT(CLOSE > OPEN, 10) |
EVERY(X, N) | N 周期内全部满足条件 | EVERY(CLOSE > MA(CLOSE, 20), 5) |
EXIST(X, N) | N 周期内存在满足条件 | EXIST(CLOSE > HHV(HIGH, 60), 5) |
BARSLAST(X) | 上次满足条件到现在的周期数 | BARSLAST(CROSS(MA(CLOSE, 5), MA(CLOSE, 10))) |
FIN_REF(expr) | 财务历史数据链式引用,支持 .where(cond).shift(n).alias(name) | FIN_REF(INCOME.net_profit).where(INCOME.fiscal_quarter == "FY").shift(1) |
Level 2 - 技术指标
| 函数 | 描述 | 返回字段 |
|---|---|---|
RSI(N) | 相对强弱指数 | rsi |
MACD(S, L, M) | MACD 指标 | dif, dea, macd |
KDJ(N, M1, M2) | KDJ 随机指标 | k, d, j |
BOLL(N, P) | 布林带 | upper, mid, lower |
WR(N) | 威廉指标 | wr |
ATR(N) | 平均真实波幅 | atr |
CCI(N) | 商品通道指数 | cci |
BIAS(N) | 乖离率 | bias |
PSY(N) | 心理线 | psy |
基本面因子(Level 2)
财务报表
通过. 访问报表字段:
| 报表 | 描述 | 示例 |
|---|---|---|
INCOME | 利润表 | INCOME.net_profit |
BALANCESHEET | 资产负债表 | BALANCESHEET.total_assets |
CASHFLOW | 现金流量表 | CASHFLOW.operating_cashflow |
EQUITY | 股东权益表 | EQUITY.total_equity |
盈利能力
| 因子 | 描述 |
|---|---|
ROE() | 净资产收益率 |
ROA() | 总资产收益率 |
GPM() | 毛利率 |
NPM() | 净利率 |
ROIC() | 投入资本回报率 |
估值因子
| 因子 | 描述 |
|---|---|
PE() | 市盈率 |
PE_TTM() | 市盈率(TTM) |
PB() | 市净率 |
PS() | 市销率 |
PCF() | 市现率 |
EV() | 企业价值 |
PEG() | PEG 比率 |
偿债能力
| 因子 | 描述 |
|---|---|
CURRENT_RATIO() | 流动比率 |
QUICK_RATIO() | 速动比率 |
DEBT_RATIO() | 资产负债率 |
成长能力
| 因子 | 描述 |
|---|---|
REVENUE_GROWTH_RATE() | 营收增长率 |
NET_PROFIT_GROWTH_RATE() | 净利润增长率 |
EPS_GROWTH_RATE() | EPS 增长率 |
运营能力
| 因子 | 描述 |
|---|---|
INVENTORY_TURNOVER() | 存货周转率 |
ACCOUNTS_RECEIVABLE_DAYS() | 应收账款周转天数 |
TOTAL_ASSET_TURNOVER() | 总资产周转率 |
每股指标
| 因子 | 描述 |
|---|---|
EPS() | 每股收益 |
BPS() | 每股净资产 |
OCFPS() | 每股经营现金流 |
REVENUE_PER_SHARE() | 每股营收 |
Authorizations
Enter your Bearer token
Query Parameters
Stock market (cn, hk, us), default cn Stock market identifier
Available options:
cn, hk, us, global Response
Successful Response
Factor name for use in formulas
"variable" or "function"
Level: 0 (variable/core), 1 (application functions), 2 (indicators)
Brief description in Chinese
Brief description in English (optional)
⌘I
