Files
playbook/skills/tsl-api-reference/references/codegen/dotnet/datawarehouse/trading_calendar.md
T
csh e1f7ce052c feat(skills): add tsl api reference skill
Bundle the TSL API index and markdown references under the skill, route TSL docs to use it, and update the codegen index generator to maintain the bundled data.
2026-07-07 16:36:15 +08:00

3.1 KiB

数据仓库 / 交易日历

continuedMatchOfNDay(exp, n)

判断Exp在过去N个交易日是否取得指标值,若取得返回1,否则返回0,与系统参数(股票,日期)相关。

参数 类型 说明
exp Expr 表达式,函数表达式
n int 整数,天数

返回:bool

示例

SetSysParam(pn_stock(),'SH000001');
SetSysParam(pn_date(),20180801t);
return ContinuedMatchOfNDay(@close(),3);

correlOfNDay(exp1, exp2, n, cache_str)

过去N日相关系数,其中N日表示市场交易日。注:剔除非交易日,例如求过去20天开盘价与成交量的相关系数,但是期间有10天停牌,则取非停牌日10天的相关系数。

参数 类型 说明
exp1 string 字符串。统计表达式1
exp2 string 字符串。统计表达式2
n int 整数。天数
cache_str string 字符串。缓存串

返回:float

示例

SetSysParam(pn_stock(),"SH600585");
SetSysParam(pn_date(),20231010T);
return CorrelOfNDay(@stockpjcj3(),@RefValue(@close(),5),10,"");

covarOfNDay(exp1, exp2, n, cache_str)

过去N日协方差。N日表示市场交易日。注:剔除非交易日,例如求过去20天开盘价与成交量的协方差,但是期间有10天停牌,则取非停牌日10天的协方差。

参数 类型 说明
exp1 string 字符串。统计表达式1
exp2 string 字符串。统计表达式2
n int 整数。天数
cache_str string 字符串。缓存串

返回:float

示例

SetSysParam(pn_stock(),"SH600585");
SetSysParam(pn_date(),20231030T);
return CovarOfNDay(@close(),@open(),30,"");

productOfNDay(exp, n, cache_str)

过去N日乘积。N日表示市场交易日。注:剔除非交易日(停牌或未上市)数据指标。

参数 类型 说明
exp string 字符串。统计表达式
n int 整数。天数
cache_str string 字符串。缓存串

返回:float

示例

SetSysParam(pn_stock(),"SH600585");
SetSysParam(pn_date(),20231030T);
return ProductOfNDay(@close(),3,"");

smaofNDay(exp, n, m, cache_str)

过去N日平滑移动平均。N日表示市场交易日。注:剔除非交易日(停牌或未上市)数据指标。

参数 类型 说明
exp string 字符串。统计表达式
n int 整数。最近N日
m float 实数。权重
cache_str string 字符串。缓存串

返回:float

示例

SetSysParam(pn_stock(),"SH600585");
SetSysParam(pn_date(),20231030T);
return SmaofNDay(@open(),30,1,"");