feat(tsl-api-reference): expand and reorganize api catalog

Flatten builtin pages, add third-party and platform scopes, and import financial and data warehouse references.

Keep the existing generated index without rebuilding after signature normalization.
This commit is contained in:
csh
2026-08-10 18:26:24 +08:00
parent 2938300acb
commit 9010829c6d
1186 changed files with 243901 additions and 219769 deletions
@@ -1,42 +1,87 @@
# 数据仓库 / 向导函数
## `compositeRatioValue(v1, v2, n)`
## `avgOfSector(exp, mode, shares_day, list_day, s_type, sample_select, eps_criterion, except_no_trade)`
声明:function
返回初值V1到末值V2的复合增长率。
板块平均。对指定板块按照一定标准进行选股后,对板块下每一只股票Exp表达式的指标值按mode求平均,选股标准由SampleSelect与EPSCriterion确定。其中亏损股为当前时间之前最近一期报告期每股收益(摊薄)\*12/报告期所在月份<0,停牌股为当前时间之前最近一期报告期每股收益(摊薄)\*12/报告期所在月份<EPSCriterion,与系统参数(股票,周期)相关
| 参数 | 类型 | 说明 |
| ---- | ---- | ---------- |
| `v1` | int | 实数,初值 |
| `v2` | int | 实数,末值 |
| `n` | int | 整数,期数 |
| 参数 | 类型 | 说明 |
| ----------------- | -------- | ------------------------------------------------------------ |
| `exp` | expr | 函数表达式 |
| `mode` | int | 用户自定义,平均模式 |
| `shares_day` | datetime | 日期,收益计算日 |
| `list_day` | datetime | 日期,在之前上市 |
| `s_type` | int | 用户自定义,股票类型 |
| `sample_select` | int | 用户自定义,样本股选择 |
| `eps_criterion` | float | 实数,绩差股标准。每股收益(摊薄)<EPSCriterion即表示绩差股 |
| `except_no_trade` | bool | 真假,剔除停牌股 |
返回:float
## `growthOfRepPeriod(expr, r_date, result_type)`
### 示例
范例01:返回:12.27
```tsl
return AvgOfSector(@close(), 2, 20180801T, 20180801T, 1, 0, 0, 0);
// 输出:12.27
```
## `derivative1(f, n)`
声明:function
表达式Exp某个指标在报告期Rdate的同比增长,ReturnType决定返回偏离值(增加值)还是偏离率(增速%)。
指标技术趋势,返回N个时间点前连续三个周期的指标Expr变化趋势,与当前系统参数(股票,日期,周期,复权)相关
| 参数 | 类型 | 说明 |
| ------------- | -------- | -------------------- |
| `expr` | any | 函数表达式 |
| `r_date` | datetime | 报告期 |
| `result_type` | any | 用户自定义,返回类型 |
| 参数 | 类型 | 说明 |
| ---- | ---- | --------------- |
| `f` | expr | 函数表达式,指标 |
| `n` | int | 整数,日期偏移 |
返回:any
返回:float
### 示例
范例01:调用函数
```tsl
SetSysParam(pn_stock(), 'SZ000001');
SetSysParam(pn_date(), 20180801T);
return Derivative1(@close(), 0); // 指标值为收盘价
```
## `derivative2(a)`
声明:function
指标技术加速度,返回4个周期的指标Expr变化趋势,与当前系统参数(股票,日期,周期,复权)相关
| 参数 | 类型 | 说明 |
| ---- | ---- | ---------- |
| `a` | expr | 函数表达式 |
返回:float
### 示例
范例01:调用函数
```tsl
SetSysParam(pn_stock(), 'SZ000001');
SetSysParam(pn_date(), 20180801T);
return Derivative2(@close()); // 指标值为收盘价
```
## `growthWithLowestOfPeriod(exp, beg_date, end_date, return_type)`
声明:function
返回表达式Exp在区间BegDate到EndDate中的最小值与在EndDate的值的偏离,ReturnType决定返回偏离值(增加值)还是偏离率(增速%)。。
返回表达式Exp在区间BegDate到EndDate中的最小值与在EndDate的值的偏离,ReturnType决定返回偏离值(增加值)还是偏离率(增速%)
| 参数 | 类型 | 说明 |
| ------------- | -------- | -------------------- |
| `exp` | Expr | 函数表达式 |
| `exp` | expr | 函数表达式 |
| `beg_date` | datetime | 日期,开始日 |
| `end_date` | datetime | 日期,截止日 |
| `return_type` | int | 用户自定义,返回类型 |
@@ -45,69 +90,68 @@
### 示例
范例01:调用函数
```tsl
SetSysParam(pn_stock(),'SZ000001');
return GrowthWithLowestOfPeriod(@close(),20180801T,20180903T,0);
SetSysParam(pn_stock(), 'SZ000001');
return GrowthWithLowestOfPeriod(@close(), 20180801T, 20180903T, 0);
```
## `isNull(arg1)`
## `positionOfSector(exp, sector)`
声明:function
判断条件是否成立。
从大到小排名。板块Sector中成分股按个券指标EXP大小排序,返回指定股票pn_stock()的排名,该函数与系统参数(股票,日期,复权,周期)相关
| 参数 | 类型 | 说明 |
| ------ | ---- | ---- |
| `arg1` | int | |
返回:bool
## `occuredRepIdOfRepPeriod(expr, beg_report, end_year)`
声明:function
在区间BegReport到EndYear年中,与BegReport报告期同比的报告期中返回表达式exp为真的报告期。
| 参数 | 类型 | 说明 |
| ------------ | ---- | ------------------ |
| `expr` | any | 布尔公式表达式 |
| `beg_report` | any | 开始期,开始报告期 |
| `end_year` | any | 年份,截止年份 |
返回:any
## `positionOfIndustry()`
声明:function
向导函数相关函数。
返回:any
## `ratioValueByType(v1, v2, _type, n)`
声明:function
依据返回类型type,返回初值V1到末值V2的增长/增长率/复合增长率。
| 参数 | 类型 | 说明 |
| ------- | ---- | ------------------------ |
| `v1` | int | 实数,初值 |
| `v2` | int | 实数,末值 |
| `_type` | int | 用户自定义,返回数据类型 |
| `n` | int | 整数,期数或交易天数 |
| 参数 | 类型 | 说明 |
| -------- | ------ | ---------------- |
| `exp` | expr | 函数表达式 |
| `sector` | string | 市场和板块,板块 |
返回:float
### 示例
范例01:调用函数
```tsl
SetSysParam(pn_stock(), 'SZ000001');
SetSysParam(pn_date(), 20180801T);
return PositionOfSector(@close(), 'A股');
```
## `positionOfSectorDesc(exp, sector)`
声明:function
从小到大排名。板块Sector中按指标EXP大小排序,返回指定股票的排名,与系统参数(股票,日期,复权,周期)相关
| 参数 | 类型 | 说明 |
| -------- | ------ | ---------------- |
| `exp` | expr | 函数表达式 |
| `sector` | string | 市场和板块,板块 |
返回:float
### 示例
范例01:调用函数
```tsl
SetSysParam(pn_stock(), 'SZ000001');
SetSysParam(pn_date(), 20180801T);
return PositionOfSectorDesc(@close(), 'A股');
```
## `reduceWithHighestOfPeriod(exp, beg_date, end_date, return_type)`
声明:function
返回表达式Exp在区间BegDate到EndDate中的最大值与在EndDate的值的偏离,ReturnType决定返回偏离值(增加值)还是偏离率(增速%)
返回表达式Exp在区间BegDate到EndDate中的最大值与在EndDate的值的偏离,ReturnType决定返回偏离值(增加值)还是偏离率(增速%)
| 参数 | 类型 | 说明 |
| ------------- | -------- | -------------------- |
| `exp` | Expr | 函数表达式 |
| `exp` | expr | 函数表达式 |
| `beg_date` | datetime | 日期,开始日 |
| `end_date` | datetime | 日期,截止日 |
| `return_type` | int | 用户自定义,返回类型 |
@@ -116,99 +160,86 @@ return GrowthWithLowestOfPeriod(@close(),20180801T,20180903T,0);
### 示例
范例01:调用函数
```tsl
SetSysParam(pn_stock(),'SZ000001');
return ReduceWithHighestOfPeriod(@close(),20180801T,20180803T,0);
SetSysParam(pn_stock(), 'SZ000001');
return ReduceWithHighestOfPeriod(@close(), 20180801T, 20180803T, 0);
```
## `relativeStrengthOfIndustry()`
## `relativeStrengthOfSector(exp, sector)`
声明:function
向导函数相关函数。
系统当前证券在板块中的相对强弱(%)。系统当前证券pn_stock()在指定板块Sector中的指标Exp值的从大到小的排位百分比。该函数与系统参数(股票,日期,复权,周期)相关
返回:any
## `reportOfListed(id, report_id)`
声明:function
返回指定报告期ReportID的基本面ID数据。如果该证券未上市,则返回0,函数与系统参数(股票、时间)相关。
| 参数 | 类型 | 说明 |
| ----------- | ------ | ---------------- |
| `id` | string | 基本面,基本面ID |
| `report_id` | string | 报告期 |
返回:any
## `reportPerShareOfListed(id, report_id)`
声明:function
指定报告期ReportID的基本面ID数据/总股本。如果该证券未上市,则返回0,函数与系统参数(股票、时间)相关。
| 参数 | 类型 | 说明 |
| ----------- | ------ | -------------- |
| `id` | string | 基本面,数据ID |
| `report_id` | string | 报告期 |
返回:any
## `reportValueOfPeriod(exp, beg_report, end_report, report_type, reportvalue)`
声明:function
区间财务数据
| 参数 | 类型 | 说明 |
| ------------- | ------ | ----------------- |
| `exp` | string | 字符串,函数表达式 |
| `beg_report` | int | 整数,开始报告期 |
| `end_report` | int | 整数,截止报告期 |
| `report_type` | int | 整数,报告期类型 |
| `reportvalue` | array | 数组,报告期数据 |
返回:array
## `simplyRatioValue(v1, v2)`
声明:function
返回初值V1到末值V2的增长率。若V1<0,则直接返回0。
| 参数 | 类型 | 说明 |
| ---- | ---- | ---------- |
| `v1` | int | 实数,初值 |
| `v2` | int | 实数,末值 |
| 参数 | 类型 | 说明 |
| -------- | ------ | ---------------- |
| `exp` | expr | 函数表达式 |
| `sector` | string | 市场和板块,板块 |
返回:float
### 示例
范例01:调用函数
```tsl
SetSysParam(pn_stock(), 'SH000300');
SetSysParam(pn_date(), 20180801T);
return RelativeStrengthOfSector(@stockzf3(), 'A股');
```
## `relativeStrengthOfSectorDesc(exp, sector)`
声明:function
系统当前证券在板块中的相对强弱(%)。系统当前证券pn_stock()在指定板块Sector中的指标Exp值的从小到大的排位百分比。该函数与系统参数(股票,日期,复权,周期)相关
| 参数 | 类型 | 说明 |
| -------- | ------ | ---------------- |
| `exp` | expr | 函数表达式 |
| `sector` | string | 市场和板块,板块 |
返回:float
### 示例
范例01:调用函数
```tsl
SetSysParam(pn_stock(), 'SZ000001');
SetSysParam(pn_date(), 20180801T);
return RelativeStrengthOfSectorDesc(@close(), 'A股');
```
## `stockTrailingAvgByEndT(endt, ref_type, exp, is_exclude_ipo, n)`
声明:function
获取基于指定日推移阶段的日均指标
| 参数 | 类型 | 说明 |
| ---------------- | ---------- | --------------------------------------------- |
| `endt` | datetime | 日期,截止日 |
| `ref_type` | UserDefine | 用户自定义,选择所推移类型,取值如下: |
| `exp` | string | 字符串, 指标表达式,如"close()","stockzdf3()" |
| `is_exclude_ipo` | bool | object |
| `n` | int | 整数, 剔除天数 |
| 参数 | 类型 | 说明 |
| ---------------- | ----------- | --------------------------------------------- |
| `endt` | datetime | 日期,截止日 |
| `ref_type` | user_define | 用户自定义,选择所推移类型,取值如下: |
| `exp` | string | 字符串, 指标表达式,如"close()","stockzdf3()" |
| `is_exclude_ipo` | bool | 真假, 是否剔除上市日区间行情 |
| `n` | int | 整数, 剔除天数 |
返回:float
### 示例
范例01:调用函数
```tsl
获取万科A过去1年的日均成交金额
setsysparam(pn_stock(),"SZ000002");
setsysparam(pn_stock(), "SZ000002");
endt := 20210714t;
RefType := 4;//过去1年
RefType := 4; // 过去1年
exp := "Amount()";
return StockTrailingAvgByEndT(Endt,RefType,Exp);
return StockTrailingAvgByEndT(Endt, RefType, Exp);
```
## `stockTrailingStdByEndT(endt, ref_type, exp, is_exclude_ipo, n)`
@@ -217,35 +248,53 @@ return StockTrailingAvgByEndT(Endt,RefType,Exp);
获取基于指定日推移阶段的指标标准差
| 参数 | 类型 | 说明 |
| ---------------- | ---------- | --------------------------------------------- |
| `endt` | datetime | 日期,截止日 |
| `ref_type` | UserDefine | 用户自定义,选择所推移类型,取值如下: |
| `exp` | string | 字符串, 指标表达式,如"close()","stockzdf3()" |
| `is_exclude_ipo` | bool | object |
| `n` | int | 整数, 剔除天数 |
| 参数 | 类型 | 说明 |
| ---------------- | ----------- | --------------------------------------------- |
| `endt` | datetime | 日期,截止日 |
| `ref_type` | user_define | 用户自定义,选择所推移类型,取值如下: |
| `exp` | string | 字符串, 指标表达式,如"close()","stockzdf3()" |
| `is_exclude_ipo` | bool | 真假, 是否剔除上市日区间行情 |
| `n` | int | 整数, 剔除天数 |
返回:float
### 示例
范例01:调用函数
```tsl
获取万科A过去1年的日收益率标准差
setsysparam(pn_stock(),"SZ000002");
setsysparam(pn_stock(), "SZ000002");
endt := 20210714t;
RefType := 4;//过去1年
RefType := 4; // 过去1年
exp := "stockzf3()";
return StockTrailingStdByEndT(Endt,RefType,Exp); // 1.69
return StockTrailingStdByEndT(Endt, RefType, Exp); // 1.69
```
## `TechCal_Unit(expression)`
## `sumOfSector(exp, shares_day, list_day, s_type, sample_select, eps_criterion, except_no_trade)`
声明:function
向导函数相关函数。
对指定板块按照一定标准进行选股后,对板块下每一只股票Exp表达式的指标值求和. 选股标准由SType、SampleSelect与EPSCriterion确定。 其中亏损股为当前时间之前最近一期报告期每股收益(摊薄)\*12/报告期所在月份<0; 停牌股为当前时间之前最近一期报告期每股收益(摊薄)\*12/报告期所在月份<EPSCriterion,与系统参数(板块,周期,时间)相关
| 参数 | 类型 | 说明 |
| ------------ | ------ | ---- |
| `expression` | object | |
| 参数 | 类型 | 说明 |
| ----------------- | -------- | ------------------------------------------------------------ |
| `exp` | expr | 函数表达式 |
| `shares_day` | datetime | 日期,收益计算日 |
| `list_day` | datetime | 日期,在之前上市 |
| `s_type` | int | 用户自定义,股票类型 |
| `sample_select` | int | 用户自定义,样本股选择 |
| `eps_criterion` | float | 实数,绩差股标准。每股收益(摊薄)<EPSCriterion即表示绩差股 |
| `except_no_trade` | bool | 真假,剔除停牌股 |
返回:any
返回:float
### 示例
范例01:调用函数
```tsl
setsysparam(pn_bk(), "上证A股");
setsysparam(Pn_date(), 20180801T);
return SumOfSector(@close(), 20180801T, 20180801T, 1, 0, 0, 0);
```