♻️ refactor(tsl): rebuild codegen taxonomy

Move generated builtin and dotnet function docs into the upgraded taxonomy, remove legacy route pages, and regenerate function_index.tsv from markdown headings.
This commit is contained in:
csh
2026-07-07 16:36:08 +08:00
parent 54c1c11e77
commit b6160676b4
763 changed files with 179921 additions and 154583 deletions
@@ -0,0 +1,269 @@
# 数据仓库 / 时间序列统计
### `spMedian(arg1, arg2)`
时间序列统计相关函数。
| 参数 | 类型 | 说明 |
| ------ | -------- | ---- |
| `arg1` | any | |
| `arg2` | datetime | |
返回:any
### `spMode(arg1, arg2)`
时间序列统计相关函数。
| 参数 | 类型 | 说明 |
| ------ | -------- | ---- |
| `arg1` | any | |
| `arg2` | datetime | |
返回:any
### `spNorm(stock_id, arg2)`
时间序列统计相关函数。
| 参数 | 类型 | 说明 |
| ---------- | ------ | ---- |
| `stock_id` | string | |
| `arg2` | any | |
返回:any
### `spProduct(stock_id, arg2)`
时间序列统计相关函数。
| 参数 | 类型 | 说明 |
| ---------- | ------ | ---- |
| `stock_id` | string | |
| `arg2` | any | |
返回:any
### `spRank(arg1, arg2, arg3)`
时间序列统计相关函数。
| 参数 | 类型 | 说明 |
| ------ | ---- | ---- |
| `arg1` | any | |
| `arg2` | any | |
| `arg3` | any | |
返回:any
### `hhv(exp, n, cache_string)`
返回N日最高的Exp的值,与系统参数(股票、时间、周期等相关),查看相关行情数据说明。
| 参数 | 类型 | 说明 |
| ------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `exp` | TExpression | TExpression型表达式 |
| `n` | integer | 整数,天数。N为0时,从上市日算起;注意,计算上市以来的最高/最低时,0必须用常量。比如hhv(high(),0)。不能以变量的方式传递:N:=0; hhv(high(),N),会报错。 |
| `cache_string` | string | 可选参数,字符串类型,缓存标志串。参见:时间序列统计缓存标志与性能加速 |
返回:real
#### 示例
```tsl
//获取万科A(SZ000002)截止2011-09-09日14个交易日内的最高,最低的收盘价以及
//发生日期。
setSysParam(pn_stock(),'SZ000002');
setSysParam(pn_date(),intToDate(20110909));
n := 14;
r := array('h_value':hhv(close(),n),
'h_date':dateToStr(getSysParam('hhvtime')),
'l_value':llv(close(),n),
'l_date':dateToStr(getSysParam('llvtime'))
);
return r;
结果:
```
### `llv(exp, n, cache_string)`
返回N日最低的Exp的值,与系统参数(股票、时间、周期等相关),查看相关行情数据说明。
| 参数 | 类型 | 说明 |
| ------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `exp` | TExpression | TExpression型表达式 |
| `n` | integer | 整数,天数。N为0时,从上市日算起;N为负数时无效。注意,计算上市以来的最高/最低时,0必须用常量。比如llv(close(),0)。不能以变量的方式:N:=0; llv(close(),N),会报错。 |
| `cache_string` | string | 可选参数,字符串类型,缓存标志串。参见:时间序列统计缓存标志与性能加速 |
返回:real
### `ma(exp, n, cache_string)`
返回N日Exp的平均值,与系统参数(股票、时间、周期等相关)。
| 参数 | 类型 | 说明 |
| ------------- | ----------- | --------------------------------------------------------------------- |
| `exp` | TExpression | TExpression型表达式 |
| `n` | integer | 整数,天数。N为0时,返回当天值;N为-1时无效。 |
| `cache_string` | string | 可选参数,字符串类型,缓存标志串。参见:时间序列统计缓存标志与性能加速 |
返回:real
#### 示例
```tsl
范例一:
//获得万科A(SZ000002)在2011-09-09日的10日均价
setSysParam(pn_stock(),'SZ000002');
setSysParam(pn_date(),intToDate(20110909));
n := 10;
return ma(close(),n);
//返回8.103
范例二:
//获取万科A一段时间的10日均价
setSysParam(pn_stock(),"SZ000002");
setSysParam(pn_date(),strToDate("2014-01-15"));
t := nDay(100,'time',sp_time(),'close',close(),'ma10',ma(close(),10),'ma20',ma(close(),20));
return t;
结果:
```
### `ema(exp, n, cache_string)`
返回N日Exp的移动平均,与系统参数(股票、时间、周期等相关)。
| 参数 | 类型 | 说明 |
| ------------- | ----------- | --------------------------------------------------------------------- |
| `exp` | TExpression | TExpression型表达式; |
| `n` | integer | 整数,天数;N为-1,0时无效。 |
| `cache_string` | string | 可选参数,字符串类型,缓存标志串。参见:时间序列统计缓存标志与性能加速 |
返回:real
#### 示例
```tsl
//获得万科A(SZ000002)在2011-09-09日的10日平滑移动均价
setSysParam(pn_stock(),'SZ000002');
setSysParam(pn_date(),intToDate(20110909));
n := 10;
return ema(close(),n);
// 结果:8.1158
```
### `sma(exp, n, m, cache_string)`
求Exp的N日平滑移动平均,M为权重。
| 参数 | 类型 | 说明 |
| ------------- | ----------- | --------------------------------------------------------------------- |
| `exp` | TExpression | TExpression型表达式 |
| `n` | integer | 整数,天数 |
| `m` | integer | 整数,权重 |
| `cache_string` | string | 可选参数,字符串类型,缓存标志串。参见:时间序列统计缓存标志与性能加速 |
返回:real
#### 示例
```tsl
//获得万科A(SZ000002)在2011-09-09日的10日平滑移动均价,3为权重
setSysParam(pn_stock(),'SZ000002');
setSysParam(pn_date(),intToDate(20110909));
n := 10;
m := 3;
return sma(close(),n,m);//返回8.0914
```
### `count(exp, n, cache_string)`
统计N天中表达式Exp值为真的天数。
| 参数 | 类型 | 说明 |
| ------------- | ----------- | --------------------------------------------------------------------- |
| `exp` | TExpression | 表达式类型 |
| `n` | integer | 整数,交易日天数,如果为-1表示从上市第一天起统计 |
| `cache_string` | string | 可选参数,字符串类型,缓存标志串。参见:时间序列统计缓存标志与性能加速 |
返回:integer
#### 示例
```tsl
//上证指数在最近100天内的上涨天数;
setSysParam(pn_stock(),'SH000001');
setSysParam(pn_date(),intToDate(20140122));
return count(isUp(),100);
//返回47。
```
### `sumN(exp, n, cache_string)`
求Exp的N日累加和。
| 参数 | 类型 | 说明 |
| ------------- | ----------- | --------------------------------------------------------------------- |
| `exp` | TExpression | TExpression型表达式 |
| `n` | integer | 整数,交易日天数,如果为-1表示从上市第一天起统计 |
| `cache_string` | string | 可选参数,字符串类型,缓存标志串。参见:时间序列统计缓存标志与性能加速 |
返回:real
#### 示例
```tsl
//获得万科A(SZ000002)在2011-09-09日的5日总成交量
setSysParam(pn_stock(),'SZ000002');
setSysParam(pn_date(),intToDate(20110909));
return sumN(vol(),5); // 返回152502152
```
### `cross(a, b)`
A线从下面穿越B线时返回1,从A上面向下穿越B时返回-1,否则返回0。与系统参数(股票、时间、周期等相关)
| 参数 | 类型 | 说明 |
| ---- | ----------- | ------------------- |
| `a` | TExpression | TExpression型表达式 |
| `b` | TExpression | TExpression型表达式 |
返回:integer
#### 示例
```tsl
//万科在指定区间内的均线穿越情况;
setSysParam(pn_stock(),'SZ000002');
end_date := intToDate(20110829);
beg_date := incWeek(end_date,-1); //end_date 前推一个
r := array();
i := 0;
for d := end_date downto beg_date do
begin
if not isTradeDay(d) then continue;
setSysParam(pn_date(),d);
r[i]['date'] := dateToStr(d);
case cross(close(),ma(close(),5)) of
1:begin
r[i]['cross_state'] := '突破5日均线';
end
-1:begin
r[i]['cross_state'] := '跌破5日均线';
end
0:begin
r[i]['cross_state'] := '';
end
end;
i++;
end;
return r;
返回结果:
```