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.
16 KiB
数据仓库 / 向导函数 / N期
accOfNReport(exp, report_id, n, report_type, if_stand, return_type)
声明:function
N期加速度算子
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,如TTM归属母公司净利润:@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N期 |
report_type |
int | 报告期类型 |
if_stand |
bool | 布尔类型,回归数据是否标准化 |
return_type |
int | 整型,返回类型 |
返回:float
示例
范例01:调用函数
setsysparam(pn_stock(), "SH600519");?
return ACCOfNReport(@Last12MData(DefaultRepID(), 46078), 20201231, 8, 1);
avgOfNReport(exp, report_id, n, report_type)
声明:function
当前时间ReportID向前推N年,返回从ReportID-N到ReportID时间报告期Exp指标平均值,与系统参数(股票)相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 函数表达式 |
report_id |
int | 报告期 |
n |
int | 整数,期数 |
report_type |
int | 整数,0:年度,1:季度,默认年度 |
返回:float
示例
范例01:返回:84785000000
SetSysParam(pn_stock(), 'SZ000001');
return AvgOfNReport(@reportofall(46002, DefaultRepID()), 20151231, 2);
// 输出:84785000000
范例02:返回:24794000000
SetSysParam(pn_stock(), 'SZ000001');
return AvgOfNReport(@LastQuarterData(DefaultRepID(), 46002, 0), 20151231, 2, 1);
// 输出:24794000000
continuedMatchOfNReport(exp, report_id, n)
声明:function
当前时间ReportID向前推N年,若从ReportID-N到ReportID时间均存在报告Exp则返回1,否则返回0,与系统参数(股票)相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 布尔公式表达式 |
report_id |
int | 报告期 |
n |
int | 整数 |
返回:bool
示例
范例01:调用函数
判断2014到2015这两年平安银行年报是否全部存在
SetSysParam(pn_stock(), 'SZ000001');
return ContinuedMatchOfNReport(@reportofall(46002, GetSysParam('DefaultRepID')), 20151231, 2);
eaaOfNReport(exp, report_id, last_report_type)
声明:function
N期加速度EAA
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,如TTM归属母公司净利润:@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
last_report_type |
int | 整数,上期报告期类型 |
返回:float
示例
范例01:调用函数
setsysparam(pn_stock(), "SH600519");
Exp := @LastQuarterData(DefaultRepID(), 46078);
ReportID := 20211231;
LastReportType := 0;
t := EAAOfNReport(Exp, ReportID, LastReportType);
return t; // -0.016
eavOfNReport(exp, report_id, n, report_type, last_report_type)
声明:function
N期加速度EAV
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,如TTM归属母公司净利润:@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N期 |
report_type |
int | 报告期类型 |
last_report_type |
int | 整数,上期报告期类型 |
返回:float
示例
范例01:调用函数
setsysparam(pn_stock(), "SH600519");
Exp := @LastQuarterData(DefaultRepID(), 46078);
ReportID := 20200930;
N := 8;
ReportType := 1; // 0:年度,1:季度
LastReportType := 0;
t := EAVOfNReport(Exp, ReportID, N, ReportType, LastReportType);
return t; // -0.45
growthOfNReport(exp, report_id, n, return_type)
声明:function
当前时间ReportID向前推N年,返回从ReportID-N与ReportID表达式Exp指标的增长比例,其中returntype决定增长模式,与系统参数(股票)相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 函数表达式 |
report_id |
int | 报告期 |
n |
int | 整数 |
return_type |
int | 用户自定义,返回类型 |
返回:float
示例
范例01:调用函数
返回平安银行2014年与2015年报营业收入增长比例
SetSysParam(pn_stock(), 'SZ000001');
return GrowthOfNReport(@reportofall(46002, GetSysParam('DefaultRepID')), 20151231, 1, 1);
highestOfNReport(exp, report_id, n, report_type)
声明:function
表达式N期最高
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
string | 字符串,函数表达式 |
report_id |
int | 整数,报告期 |
n |
int | 整数,期数 |
report_type |
int | 整数,报告期类型 |
返回:float
示例
范例01:调用函数
SetSysParam(pn_stock(), "SH600585");
return HighestOfNReport(@ReportOfAll(46080, DefaultRepID()), 20221231, 5, 0);
highGrowthOfNReport(exp, report_id, n, report_type, range)
声明:function
N期高速增长拐点:最近N期中,第N期数据上升且大于前N-1期极差的range倍 max=max(前N-1期数据) min=min(前N-1期数据) 第N期>上期+range*(max-min)
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,如TTM归属母公司净利润:@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N期 |
report_type |
int | 报告期类型 |
range |
float | 实数,前N-1期极差的Range倍,用于衡量高速增长的幅度,默认取3 |
返回:bool
示例
范例01:调用函数
setsysparam(pn_stock(), "SZ002340");
Exp := @LastQuarterData(GetSysParam('DefaultRepID'), 9900604);
ReportID := 20210331;
N := 5;
ReportType := 1; // 0:年度,1:季度
Range := 3;
t := HighGrowthOfNReport(Exp, ReportID, N, ReportType, Range);
return t; // 1
lowestOfNReport(exp, report_id, n, report_type)
声明:function
表达式N期最低
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
string | 字符串,函数表达式 |
report_id |
int | 整数,报告期 |
n |
int | 整数,期数 |
report_type |
int | 整数,报告期类型 |
返回:float
示例
范例01:调用函数
SetSysParam(pn_stock(), "SH600585");
return lowestOfNReport(@ReportOfAll(46080, DefaultRepID()), 20221231, 5, 0);
occuredOfNReport(exp, report_id, n)
声明:function
当前时间ReportID向前推N年,返回从ReportID-N到ReportID时间发生报告Exp的次数,与系统参数(股票)相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 布尔公式表达式 |
report_id |
int | 报告期 |
n |
int | 整数 |
返回:int
示例
范例01:调用函数
返回平安银行截止到2015年12月31日的所有年报数量
SetSysParam(pn_stock(), 'SZ000001');
returnOccuredOfNReport(@reportofall(46002, GetSysParam('DefaultRepID')), 20151231, 100);
refReportValue(exp, report_id, n)
声明:function
当前时间ReportID向前推N年,返回ReportID-N时间点表达式 Exp指标值,与系统参数(股票)相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 函数表达式 |
report_id |
int | 报告期 |
n |
int | 整数 |
返回:float
示例
范例01:调用函数
返回平安银行2015年年报营业收入额
SetSysParam(pn_stock(), 'SZ000001');
return RefReportValue(@reportofall(46002, GetSysParam('DefaultRepID')), 20161231, 1);
robustACCOfNReport(exp, report_id, n, report_type, last_report_type)
声明:function
N期稳健加速度
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,通常以增长率来表示增速。;如TTM净利润增长率(%)表达式为@Last12MData(DefaultRepID(),9900604) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N期 |
report_type |
int | 报告期类型 |
last_report_type |
int | 整数,上期报告期类型,默认与ReportType取值相同(兼容历史) |
返回:float
示例
范例01:调用函数
setsysparam(pn_stock(), "SH600519");
return RobustACCOfNReport(@Last12MData(DefaultRepID(), 9900604), 20201231, 8, 0); // -0.0878801178157446
robustGrowthOfNReport(exp, report_id, n, report_type)
声明:function
过去N期稳健增速,与系统证券相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
t_expression | 表达式类型,计算相关财务指标,一般与报告期相关,通常以增长率来表示增速 |
report_id |
r_date | 报告期 |
n |
int | 整数,最近N期 |
report_type |
int | 报告期类型 |
返回:real
示例
范例01:调用函数
setSysParam(pn_stock(), "SH600519");
return robustGrowthOfNReport(@last12MData(defaultRepId(), 9900604),
20201231, 8, 0); // 0.916987656203954
standGrowthOfNReport(exp, report_id, n, report_type)
声明:function
N期标准化增长率
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,如TTM归属母公司净利润:@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N期 |
report_type |
int | 报告期类型 |
返回:float
示例
范例01:调用函数
setsysparam(pn_stock(), "SH600519");
Exp := @LastQuarterData(GetSysParam('DefaultRepID'), 46078);
ReportID := 20211231;
N := 8;
ReportType := 1; // 0:年度,1:季度
t := StandGrowthOfNReport(Exp, ReportID, N, ReportType);
return t; // 1.265
sumOfNReport(exp, report_id, n)
声明:function
当前时间ReportID向前推N年,返回从ReportID-N到ReportID时间报告期Exp指标和,与系统参数(股票)相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 函数表达式 |
report_id |
int | 报告期 |
n |
int | 整数,期数 |
返回:float
示例
范例01:调用函数
计算平安银行2015年报与2014年报营业收入的和
SetSysParam(pn_stock(), 'SZ000001');
return SumOfNReport(@reportofall(46002, GetSysParam('DefaultRepID')), 20151231, 2);
turnPositiveOfNReport(exp, report_id, n, report_type)
声明:function
N期转正拐点:最近N期中,前N-1期数据小于0,第N期数据大于0
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,如TTM归属母公司净利润:@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N期 |
report_type |
int | 报告期类型 |
返回:bool
示例
范例01:调用函数
setsysparam(pn_stock(), "SH600110");
Exp := @LastQuarterData(GetSysParam('DefaultRepID'), 42017); // 季度扣非净利润
ReportID := 20210331;
N := 5;
ReportType := 1; // 0:年度,1:季度
t := TurnPositiveOfNReport(Exp, ReportID, N, ReportType);
return t; // 1