23 KiB
数据仓库 / N期
accOfNReport(exp, report_id, n, report_type, if_stand, return_type)
N期加速度算子
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,如TTM归属母公司净利润:@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N期 |
report_type |
int | 报告期类型 |
if_stand |
bool | 布尔类型,回归数据是否标准化 |
return_type |
int | 整型,返回类型 |
返回:float
示例
setsysparam(pn_stock(),"SH600519");?
return ACCOfNReport(@Last12MData(DefaultRepID(),46078),20201231,8,1);
accOfNReport2(exp, report_id, n)
N季加速度,与ACCOfNReport的区别在于仅支持季度数据计算,与系统证券相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,;如TTM归属母公司净利润为@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N季 |
返回:float
示例
setsysparam(pn_stock(),"SH600000");
Exp:=@reportofall(9900002,GetSysParam('DefaultRepID'));
ReportID:=20211231;
N:=8;
return RobustACCOfNReport2(Exp,ReportID,N); //-0.2568
avgOfNReport(exp, report_id, n, report_type)
当前时间ReportID向前推N年,返回从ReportID-N到ReportID时间报告期Exp指标平均值,与系统参数(股票)相关。
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
Expr | 函数表达式 |
report_id |
int | 报告期 |
n |
int | 整数,期数 |
report_type |
int | 整数,0:年度,1:季度,默认年度 |
返回:float
avgOfNReport2(exp, report_id, n)
N个季度报告期数据的平均值,与系统证券相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,;如TTM归属母公司净利润为@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N季 |
返回:float
示例
setsysparam(pn_stock(),"SH600000");
Exp:=@reportofall(46002,GetSysParam('DefaultRepID'));
ReportID:=20211231;
N:=8;
return AvgOfNReport2(Exp,ReportID,N); //122912375000
continuedMatchOfNReport(exp, report_id, n)
当前时间ReportID向前推N年,若从ReportID-N到ReportID时间均存在报告Exp则返回1,否则返回0,与系统参数(股票)相关。
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
Expr | 布尔公式表达式 |
report_id |
int | 报告期 |
n |
int | 整数 |
返回:bool
示例
判断2014到2015这两年平安银行年报是否全部存在
SetSysParam(pn_stock(),'SZ000001');
return ContinuedMatchOfNReport(@reportofall(46002,GetSysParam('DefaultRepID')),20151231,2);
eaaOfNReport(exp, report_id, last_report_type)
N期加速度EAA
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,如TTM归属母公司净利润:@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
last_report_type |
int | 整数,上期报告期类型 |
返回:float
示例
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)
N期加速度EAV
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,如TTM归属母公司净利润:@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N期 |
report_type |
int | 报告期类型 |
last_report_type |
int | 整数,上期报告期类型 |
返回:float
示例
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)
当前时间ReportID向前推N年,返回从ReportID-N与ReportID表达式Exp指标的增长比例,其中returntype决定增长模式,与系统参数(股票)相关。
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
Expr | 函数表达式 |
report_id |
int | 报告期 |
n |
int | 整数 |
return_type |
int | 用户自定义,返回类型 |
返回:float
示例
返回平安银行2014年与2015年报营业收入增长比例
SetSysParam(pn_stock(),'SZ000001');
return GrowthOfNReport(@reportofall(46002,GetSysParam('DefaultRepID')),20151231,1,1);
highestOfNReport(exp, report_id, n, report_type)
表达式N期最高
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
string | 字符串,函数表达式 |
report_id |
int | 整数,报告期 |
n |
int | 整数,期数 |
report_type |
int | 整数,报告期类型 |
返回:float
示例
SetSysParam(pn_stock(),"SH600585");
return HighestOfNReport(@ReportOfAll(46080,DefaultRepID()),20221231,5,0);
highGrowthOfNReport(exp, report_id, n, report_type, range)
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
示例
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)
表达式N期最低
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
string | 字符串,函数表达式 |
report_id |
int | 整数,报告期 |
n |
int | 整数,期数 |
report_type |
int | 整数,报告期类型 |
返回:float
示例
SetSysParam(pn_stock(),"SH600585");
return lowestOfNReport(@ReportOfAll(46080,DefaultRepID()),20221231,5,0);
occuredOfNReport(exp, report_id, n)
当前时间ReportID向前推N年,返回从ReportID-N到ReportID时间发生报告Exp的次数,与系统参数(股票)相关。
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
Expr | 布尔公式表达式 |
report_id |
int | 报告期 |
n |
int | 整数 |
返回:int
示例
返回平安银行截止到2015年12月31日的所有年报数量
SetSysParam(pn_stock(),'SZ000001');
returnOccuredOfNReport(@reportofall(46002,GetSysParam('DefaultRepID')),20151231,100);
occuredRepIdOfNReport(exp, report_id, n)
当前时间ReportID向前推N年,若从ReportID-N到ReportID时间存在报告Exp则返回报告期,与系统参数(股票)相关。
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
any | 布尔公式表达式 |
report_id |
string | 报告期 |
n |
any | 整数,期数 |
返回:any
refReportValue(exp, report_id, n)
当前时间ReportID向前推N年,返回ReportID-N时间点表达式 Exp指标值,与系统参数(股票)相关。
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
Expr | 函数表达式 |
report_id |
int | 报告期 |
n |
int | 整数 |
返回:float
示例
返回平安银行2015年年报营业收入额
SetSysParam(pn_stock(),'SZ000001');
return RefReportValue(@reportofall(46002,GetSysParam('DefaultRepID')),20161231,1);
robustAccOfNReport(exp, report_id, n, report_type, last_report_type)
N期稳健加速度
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,通常以增长率来表示增速。;如TTM净利润增长率(%)表达式为@Last12MData(DefaultRepID(),9900604) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N期 |
report_type |
int | 报告期类型 |
last_report_type |
int | 整数,上期报告期类型,默认与ReportType取值相同(兼容历史) |
返回:float
示例
setsysparam(pn_stock(),"SH600519");
return RobustACCOfNReport(@Last12MData(DefaultRepID(),9900604),20201231,8,0); // -0.0878801178157446
robustAccOfNReport2(exp, report_id, n)
N季稳健加速度,与RobustACCOfNReport的区别在于仅支持季度数据计算,与系统证券相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,;如TTM归属母公司净利润为@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N季 |
返回:float
示例
setsysparam(pn_stock(),"SH600000");
Exp:=@reportofall(9900002,GetSysParam('DefaultRepID'));
ReportID:=20211231;
N:=8;
return RobustACCOfNReport2(Exp,ReportID,N); //-0.2568
robustGrowthOfNReport2(exp, report_id, n)
N季稳健增速,与RobustGrowthOfNReport的区别在于仅支持季度数据计算,与系统证券相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,;如TTM归属母公司净利润为@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N季 |
返回:float
示例
setsysparam(pn_stock(),"SH600000");
Exp:=@reportofall(9900002,GetSysParam('DefaultRepID'));
ReportID:=20211231;
N:=8;
return RobustGrowthOfNReport2(Exp,ReportID,N); //-0.3269
secondOrderGrowthOfNReport(exp, report_id, n, report_type)
N期二阶增长拐点:最近N期中,前N-1期逐渐下降,第N期数据上升 l 参数: Exp:表达式类型,计算相关财务指标,一般与报告期相关,如TTM归属母公司净利润:@Last12MData(DefaultRepID(),46078) ReportID:报告期 N:整数,最近N期 ReportType:报告期类型 取值 含义 备注 0 年度标准(默认) 假设ReportID:=20200930,N=2,对应最近N个报告期为20190930、20200930 1 季度标准 假设ReportID:=20200930,N=2,对应最近N个报告期为20200630、20200930
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | |
report_id |
datetime | |
n |
int | |
report_type |
int |
返回:bool
示例
setsysparam(pn_stock(),"SZ000636");
Exp:=@LastQuarterData(GetSysParam('DefaultRepID'),9900604);
ReportID:=20200331;
N:=5;
ReportType:=1; //0:年度,1:季度
t:=SecondOrderGrowthOfNReport(Exp,ReportID,N,ReportType);
return t; //1
standGrowthOfNReport(exp, report_id, n, report_type)
N期标准化增长率
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,如TTM归属母公司净利润:@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N期 |
report_type |
int | 报告期类型 |
返回:float
示例
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
stdOfNReport2(exp, report_id, n)
N个季度报告期数据的标准差,与系统证券相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,;如TTM归属母公司净利润为@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N季 |
返回:float
示例
setsysparam(pn_stock(),"SH600000");
Exp:=@reportofall(46002,GetSysParam('DefaultRepID'));
ReportID:=20211231;
N:=8;
return StdOfNReport2(Exp,ReportID,N); //56286669451.8528
sumOfNReport(exp, report_id, n)
当前时间ReportID向前推N年,返回从ReportID-N到ReportID时间报告期Exp指标和,与系统参数(股票)相关。
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
Expr | 函数表达式 |
report_id |
int | 报告期 |
n |
int | 整数,期数 |
返回:float
示例
计算平安银行2015年报与2014年报营业收入的和
SetSysParam(pn_stock(),'SZ000001');
return SumOfNReport(@reportofall(46002,GetSysParam('DefaultRepID')),20151231,2);
sumOfNReport2(exp, report_id, n)
N个季度报告期数据之和,与系统证券相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,;如TTM归属母公司净利润@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N季 |
返回:float
示例
setsysparam(pn_stock(),"SH600000");
Exp:=@reportofall(46002,GetSysParam('DefaultRepID'));
ReportID:=20211231;
N:=8;
return SumOfNReport2(Exp,ReportID,N); //983299000000
turnPositiveOfNReport(exp, report_id, n, report_type)
N期转正拐点:最近N期中,前N-1期数据小于0,第N期数据大于0
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
expr | 表达式类型,计算相关财务指标,一般与报告期相关,如TTM归属母公司净利润:@Last12MData(DefaultRepID(),46078) |
report_id |
datetime | 报告期 |
n |
int | 整数,最近N期 |
report_type |
int | 报告期类型 |
返回:bool
示例
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
robustGrowthOfNReport(exp, report_id, n, report_type)
过去N期稳健增速,与系统证券相关
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
TExpression | 表达式类型,计算相关财务指标,一般与报告期相关,通常以增长率来表示增速. |
report_id |
RDate | 报告期 |
n |
Int | 整数,最近N期 |
report_type |
Int | 报告期类型 |
返回:Real
示例
setSysParam(pn_stock(),"SH600519");
return robustGrowthOfNReport(@last12MData(defaultRepId(),9900604),
20201231,8,0); // 0.916987656203954