feat(tsl-api-reference): expand API and module coverage

This commit is contained in:
csh
2026-08-14 17:12:55 +08:00
parent 8f1056130d
commit 3d3036ebe1
571 changed files with 47842 additions and 14458 deletions
@@ -26,8 +26,11 @@
范例01:返回:12.27
```tsl
return AvgOfSector(@close(), 2, 20180801T, 20180801T, 1, 0, 0, 0);
// 输出:12.27
setSysParam(pn_bk(), "沪深300");
setSysParam(pn_stock(), "SH600000");
setSysParam(pn_cycle(), cy_day());
return avgOfSector(@close(), 2, 20180801T, 20180801T, 1, 0, 0, 0);
// 输出:53.354628
```
## `derivative1(f, n)`
@@ -231,66 +234,70 @@ SetSysParam(pn_date(), 20180801T);
return RelativeStrengthOfSectorDesc(@close(), 'A股');
```
## `stockTrailingAvgByEndT(endt, ref_type, exp, is_exclude_ipo, n)`
## `stockTrailingAvgByEndT(end_t, ref_type, exp, is_exclude_ipo, n)`
声明:function
获取基于指定日推移阶段的日均指标
返回指定证券截至 `end_t` 的推移区间日均指标
<!-- tags: 数据仓库 向导函数 获取 查询 -->
<!-- tags: 数据仓库 向导函数 证券 推移区间 日均值 成交金额 历史统计 -->
| 参数 | 类型 | 说明 |
| ---------------- | ----------- | --------------------------------------------- |
| `endt` | datetime | 日期,截止日 |
| `ref_type` | user_define | 用户自定义,选择所推移类型,取值如下: |
| `exp` | string | 字符串, 指标表达式,如"close()","stockzdf3()" |
| `is_exclude_ipo` | bool | 真假, 是否剔除上市区间行情 |
| `n` | int | 整数, 剔除天数 |
| 参数 | 类型 | 说明 |
| ---------------- | ----------- | ------------------------------------ |
| `end_t` | datetime | 截止日 |
| `ref_type` | user_define | 推移区间类型;`4` 表示过去 1 年 |
| `exp` | string | 指标表达式字符串,如 `'amount()'` |
| `is_exclude_ipo` | bool | 是否剔除上市初期区间行情 |
| `n` | int | 剔除的上市初期天数;不剔除时可传 `0` |
返回:float
依赖系统参数:`pn_stock()`
### 示例
范例01调用函数
范例01计算万科 A 截至 2021-07-14 过去 1 年的日均成交金额
```tsl
获取万科A过去1年的日均成交金额
setsysparam(pn_stock(), "SZ000002");
endt := 20210714t;
RefType := 4; // 过去1年
exp := "Amount()";
return StockTrailingAvgByEndT(Endt, RefType, Exp);
setSysParam(pn_stock(), 'SZ000002');
end_t := 20210714T;
ref_type := 4;
exp := 'amount()';
return stockTrailingAvgByEndT(end_t, ref_type, exp, false, 0);
// 输出:2172484158.52107
```
## `stockTrailingStdByEndT(endt, ref_type, exp, is_exclude_ipo, n)`
## `stockTrailingStdByEndT(end_t, ref_type, exp, is_exclude_ipo, n)`
声明:function
获取基于指定日推移阶段的指标标准差
返回指定证券截至 `end_t` 的推移区间指标标准差
<!-- tags: 数据仓库 向导函数 获取 查询 -->
<!-- tags: 数据仓库 向导函数 证券 推移区间 标准差 收益率 波动 历史统计 -->
| 参数 | 类型 | 说明 |
| ---------------- | ----------- | --------------------------------------------- |
| `endt` | datetime | 日期,截止日 |
| `ref_type` | user_define | 用户自定义,选择所推移类型,取值如下: |
| `exp` | string | 字符串, 指标表达式,如"close()","stockzdf3()" |
| `is_exclude_ipo` | bool | 真假, 是否剔除上市区间行情 |
| `n` | int | 整数, 剔除天数 |
| 参数 | 类型 | 说明 |
| ---------------- | ----------- | ------------------------------------ |
| `end_t` | datetime | 截止日 |
| `ref_type` | user_define | 推移区间类型;`4` 表示过去 1 年 |
| `exp` | string | 指标表达式字符串,如 `'stockzf3()'` |
| `is_exclude_ipo` | bool | 是否剔除上市初期区间行情 |
| `n` | int | 剔除的上市初期天数;不剔除时可传 `0` |
返回:float
依赖系统参数:`pn_stock()`
### 示例
范例01调用函数
范例01计算万科 A 截至 2021-07-14 过去 1 年的日收益率标准差
```tsl
获取万科A过去1年的日收益率标准差
setsysparam(pn_stock(), "SZ000002");
endt := 20210714t;
RefType := 4; // 过去1年
exp := "stockzf3()";
return StockTrailingStdByEndT(Endt, RefType, Exp); // 1.69
setSysParam(pn_stock(), 'SZ000002');
end_t := 20210714T;
ref_type := 4;
exp := 'stockzf3()';
return stockTrailingStdByEndT(end_t, ref_type, exp, false, 0);
// 输出:1.687273
```
## `sumOfSector(exp, shares_day, list_day, s_type, sample_select, eps_criterion, except_no_trade)`