# 数据仓库 / 向导函数 / 区间 ## `avgOfPeriod(exp, begdate, enddate)` 声明:function 返回当前从开始日BegDate到截止日EndDate表达式Exp的指标平均值,与系统参数(股票,日期,周期,复权)相关 | 参数 | 类型 | 说明 | | ---------- | -------- | -------------- | | `exp` | expr | 函数表达式 | | `begdate` | datetime | 日期,开始日期 | | `enddate` | datetime | 日期,截止日期 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), 'SZ000001'); return AvgOfPeriod(@close(), 20180801T, 20180802T); ``` ## `avgOfRepPeriod(exp, begreport, end_year)` 声明:function 返回当前股票从报告期BegReport到EndYear同季度报告期的Expr指标的平均值,与系统参数(股票)相关 | 参数 | 类型 | 说明 | | ------------ | ---- | ------------------ | | `exp` | expr | 函数表达式 | | `begreport` | int | 报告期,开始报告期 | | `end_year` | int | 年份,截止年份 | 返回:int ### 示例 范例01:调用函数 ```tsl 平安银行2015到2018四个一季报营业收入的平均值 SetSysParam(pn_stock(), 'sz000001'); return AvgOfRepPeriod(@reportofall(46002, GetSysParam('DefaultRepID')), 20150331, 2018); ``` ## `avgOfRepPeriod2(exp, beg_report, end_report, report_type)` 声明:function 表达式区间平均 | 参数 | 类型 | 说明 | | ------------- | ------ | ----------------- | | `exp` | string | 字符串,函数表达式 | | `beg_report` | int | 整数,开始报告期 | | `end_report` | int | 整数,截止报告期 | | `report_type` | int | 整数,报告期类型 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SZ000001"); return AvgOfRepPeriod2(@reportofall(46002, GetSysParam('DefaultRepID')), 20201231, 20221231, 0); ``` ## `correlOfPeriod(exp, beg_date, end_date, base_id)` 声明:function 表达式区间相关系数(双序列) | 参数 | 类型 | 说明 | | ---------- | -------- | ------------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | | `base_id` | string | 字符串,基准证券代码 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return CorrelOfPeriod(@close(), 20230901T, 20231010T, "SH000001"); ``` ## `covOfPeriod(exp, beg_date, end_date, base_id)` 声明:function 表达式区间协方差(双序列) | 参数 | 类型 | 说明 | | ---------- | -------- | ------------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | | `base_id` | string | 字符串,基准证券代码 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return CovOfPeriod(@close(), 20230901T, 20231010T, "SH000001"); ``` ## `growthOfPeriod(exp, beg_date, end_date, returntype)` 声明:function 从Begdate到Enddate之间Expr指标的增长,增长模式由Returntype决定,与系统参数(股票,日期,周期,复权)相关 | 参数 | 类型 | 说明 | | ------------ | -------- | -------------------- | | `exp` | expr | 布尔公式表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | | `returntype` | int | 用户自定义,返回类型 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), 'SZ000001'); return GrowthOfPeriod(@close(), 20180801T, 20180803T, 1); ``` ## `growthOfRepPeriod2(exp, beg_report, end_report, return_type, report_type)` 声明:function 表达式区间增长 | 参数 | 类型 | 说明 | | ------------- | ------ | ----------------- | | `exp` | string | 字符串,函数表达式 | | `beg_report` | int | 整数,开始报告期 | | `end_report` | int | 整数,截止报告期 | | `return_type` | int | 整数,返回类型 | | `report_type` | int | 整数,报告期类型 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SZ000001"); return GrowthOfRepPeriod2(@reportofall(46002, GetSysParam('DefaultRepID')), 20201231, 20221231, 1); ``` ## `hhvBarsOfPeriod(exp, beg_date, end_date)` 声明:function 表达式区间最高点到当前的周期数 | 参数 | 类型 | 说明 | | ---------- | -------- | ----------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return HHVBarsOfPeriod(@close(), 20230101T, 20231010T); ``` ## `highestOfPeriod(exp, beg_date, end_date)` 声明:function 返回当前从开始日Begt到截止日Endt表达式Exp的指标的最大值,与系统参数(股票,日期,周期,复权)相关 | 参数 | 类型 | 说明 | | ---------- | -------- | ------------ | | `exp` | expr | 函数表达式 | | `beg_date` | datetime | 日期,开始日 | | `end_date` | datetime | 日期,截止日 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), 'SZ000001'); return HighestOfPeriod(@close(), 20180801T, 20180802T); ``` ## `interceptOfPeriod(exp, beg_date, end_date, base_id)` 声明:function 表达式区间回归截距(双序列) | 参数 | 类型 | 说明 | | ---------- | -------- | ------------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | | `base_id` | string | 字符串,基准证券代码 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return InterceptOfPeriod(@close(), 20230901T, 20231010T, "SH000001"); ``` ## `kurtosisOfPeriod(exp, beg_date, end_date)` 声明:function 表达式区间峰度 | 参数 | 类型 | 说明 | | ---------- | -------- | ----------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return KurtosisOfPeriod(@close(), 20230101T, 20231010T); ``` ## `llvBarsOfPeriod(exp, beg_date, end_date)` 声明:function 表达式区间最低点到当前的周期数 | 参数 | 类型 | 说明 | | ---------- | -------- | ----------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return LLVBarsOfPeriod(@close(), 20230101T, 20231010T); ``` ## `lowestOfRepPeriod2(exp, beg_report, end_report, report_type)` 声明:function 表达式区间最低 | 参数 | 类型 | 说明 | | ------------- | ------ | ----------------- | | `exp` | string | 字符串,函数表达式 | | `beg_report` | int | 整数,开始报告期 | | `end_report` | int | 整数,截止报告期 | | `report_type` | int | 整数,报告期类型 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SZ000001"); return LowestOfRepPeriod2(@reportofall(46002, GetSysParam('DefaultRepID')), 20201231, 20221231, 0); ``` ## `medianOfPeriod(exp, beg_date, end_date)` 声明:function 表达式区间中位数 | 参数 | 类型 | 说明 | | ---------- | -------- | ----------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return MedianOfPeriod(@close(), 20230101T, 20231010T); ``` ## `occuredOfPeriod(exp, beg_date, end_date)` 声明:function 表达式区间发生次数 | 参数 | 类型 | 说明 | | ---------- | -------- | ----------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return OccuredOfPeriod(@IsUp(), 20230101T, 20231010T); ``` ## `occuredOfRepPeriod(exp, begreport, end_year)` 声明:function 返回当前股票从BegReport到EndYear的同季度报告期数,与系统参数(股票)相关 | 参数 | 类型 | 说明 | | ------------ | ---- | ------------------ | | `exp` | expr | 布尔公式表达式 | | `begreport` | int | 报告期,开始报告期 | | `end_year` | int | 年份,截止年份 | 返回:int ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), 'SZ000001'); return OccuredOfRepPeriod(@reportofall(46002, GetSysParam('DefaultRepID')), 20150331, 2018); // 即返回2015年到2018年一季报的数量 ``` ## `percentRankOfPeriod(exp, beg_date, end_date)` 声明:function 表达式区间分位数 | 参数 | 类型 | 说明 | | ---------- | -------- | ----------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return PercentRankOfPeriod(@close(), 20230101T, 20231010T); ``` ## `rsqOfPeriod(exp, beg_date, end_date, base_id)` 声明:function 表达式区间相关系数平方(双序列) | 参数 | 类型 | 说明 | | ---------- | -------- | ------------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | | `base_id` | string | 字符串,基准证券代码 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return RSQOfPeriod(@close(), 20230901T, 20231010T, "SH000001"); ``` ## `skewnessOfPeriod(exp, beg_date, end_date)` 声明:function 表达式区间偏度 | 参数 | 类型 | 说明 | | ---------- | -------- | ----------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return SkewnessOfPeriod(@close(), 20230101T, 20231010T); ``` ## `slopeOfPeriod(exp, beg_date, end_date, base_id)` 声明:function 表达式区间回归斜率(双序列) | 参数 | 类型 | 说明 | | ---------- | -------- | ------------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | | `base_id` | string | 字符串,基准证券代码 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return SlopeOfPeriod(@close(), 20230901T, 20231010T, "SH000001"); ``` ## `stdOfPeriod(exp, beg_date, end_date)` 声明:function 表达式区间标准差 | 参数 | 类型 | 说明 | | ---------- | -------- | ----------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return StdOfPeriod(@close(), 20230101T, 20231010T); ``` ## `stdOfRepPeriod2(exp, beg_report, end_report, report_type)` 声明:function 表达式区间标准差 | 参数 | 类型 | 说明 | | ------------- | ------ | ----------------- | | `exp` | string | 字符串,函数表达式 | | `beg_report` | int | 整数,开始报告期 | | `end_report` | int | 整数,截止报告期 | | `report_type` | int | 整数,报告期类型 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SZ000001"); return StdOfRepPeriod2(@reportofall(46002, GetSysParam('DefaultRepID')), 20201231, 20221231, 0); ``` ## `steyxOfPeriod(exp, beg_date, end_date, base_id)` 声明:function 表达式区间标准偏差(双序列) | 参数 | 类型 | 说明 | | ---------- | -------- | ------------------- | | `exp` | string | 字符串,函数表达式 | | `beg_date` | datetime | 日期,开始日期 | | `end_date` | datetime | 日期,截止日期 | | `base_id` | string | 字符串,基准证券代码 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SH600585"); return SteyxOfPeriod(@close(), 20230901T, 20231010T, "SH000001"); ``` ## `sumOfPeriod(v, beg_t, end_t)` 声明:function 返回当前从开始日Begt到截止日Endt表达式Exp的指标和,与系统参数(股票,日期,周期,复权)相关 | 参数 | 类型 | 说明 | | ------- | -------- | ------------ | | `v` | expr | 函数表达式 | | `beg_t` | datetime | 日期,开始日 | | `end_t` | datetime | 日期,截止日 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), 'SZ000001'); return SumOfPeriod(@close(), 20180801T, 20180802T); ``` ## `sumOfRepPeriod(exp, begreport, end_year)` 声明:function 返回当前股票Expr指标从报告期BegReport到EndYear同季度报告期的和,与系统参数(股票)相关 | 参数 | 类型 | 说明 | | ------------ | ---- | ------------------ | | `exp` | expr | 函数表达式 | | `begreport` | int | 报告期,开始报告期 | | `end_year` | int | 年份,截止年份 | 返回:int ### 示例 范例01:调用函数 ```tsl 平安银行2015到2018四个一季报营业收入的和 SetSysParam(pn_stock(), 'sz000001'); return SumOfRepPeriod(@reportofall(46002, GetSysParam('DefaultRepID')), 20150331, 2018); ``` ## `sumOfRepPeriod2(exp, beg_report, end_report, report_type)` 声明:function 表达式区间和 | 参数 | 类型 | 说明 | | ------------- | ------ | ----------------- | | `exp` | string | 字符串,函数表达式 | | `beg_report` | int | 整数,开始报告期 | | `end_report` | int | 整数,截止报告期 | | `report_type` | int | 整数,报告期类型 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), "SZ000001"); return SumOfRepPeriod2(@reportofall(46002, GetSysParam('DefaultRepID')), 20201231, 20221231, 0); ``` ## `swingOfPeriod(exp, beg_date, end_date, re_turn_type)` 声明:function 返回当前从开始日Begt到截止日Endt表达式Exp的指标区间振幅,与系统参数(股票,日期,周期,复权)相关 | 参数 | 类型 | 说明 | | -------------- | -------- | -------------------- | | `exp` | expr | 函数表达式 | | `beg_date` | datetime | 日期,开始日 | | `end_date` | datetime | 日期,截止日 | | `re_turn_type` | int | 用户自定义,返回类型 | 返回:float ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), 'SZ000001'); return SwingOfPeriod(@close(), 20180801T, 20180802T, 0); ``` ## `timeOfHighestOfPeriod(exp, beg_date, end_date)` 声明:function 返回当前从开始日BegDate到截止日EndDate表达式Exp的指标最大值的时间点,与系统参数(股票,日期,周期,复权)相关 | 参数 | 类型 | 说明 | | ---------- | -------- | ------------ | | `exp` | expr | 函数表达式 | | `beg_date` | datetime | 日期,开始日 | | `end_date` | datetime | 日期,截止日 | 返回:string ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), 'SZ000001'); return TimeOfHighestOfPeriod(@close(), 20180801T, 20180802T); ``` ## `timeOfLowestOfPeriod(exp, beg_t, end_t)` 声明:function 返回当前从开始日Begt到截止日Endt表达式Exp的指标最小值的时间点,与系统参数(股票,日期,周期,复权)相关 | 参数 | 类型 | 说明 | | ------- | -------- | ------------ | | `exp` | expr | 函数表达式 | | `beg_t` | datetime | 日期,开始日 | | `end_t` | datetime | 日期,截止日 | 返回:string ### 示例 范例01:调用函数 ```tsl SetSysParam(pn_stock(), 'SZ000001'); returnTimeOfLowestOfPeriod(@close(), 20180801T, 20180802T); ```