6.9 KiB
6.9 KiB
数据仓库 / 向导函数
compositeRatioValue(v1, v2, n)
返回初值V1到末值V2的复合增长率。
| 参数 | 类型 | 说明 |
|---|---|---|
v1 |
int | 实数,初值 |
v2 |
int | 实数,末值 |
n |
int | 整数,期数 |
返回:float
growthOfRepPeriod(expr, r_date, result_type)
表达式Exp某个指标在报告期Rdate的同比增长,ReturnType决定返回偏离值(增加值)还是偏离率(增速%)。
| 参数 | 类型 | 说明 |
|---|---|---|
expr |
any | 函数表达式 |
r_date |
datetime | 报告期 |
result_type |
any | 用户自定义,返回类型 |
返回:any
growthWithLowestOfPeriod(exp, beg_date, end_date, return_type)
返回表达式Exp在区间BegDate到EndDate中的最小值与在EndDate的值的偏离,ReturnType决定返回偏离值(增加值)还是偏离率(增速%)。。
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
Expr | 函数表达式 |
beg_date |
datetime | 日期,开始日 |
end_date |
datetime | 日期,截止日 |
return_type |
int | 用户自定义,返回类型 |
返回:float
示例
SetSysParam(pn_stock(),'SZ000001');
return GrowthWithLowestOfPeriod(@close(),20180801T,20180903T,0);
isNull(arg1)
判断条件是否成立。
| 参数 | 类型 | 说明 |
|---|---|---|
arg1 |
int |
返回:bool
occuredRepIdOfRepPeriod(expr, beg_report, end_year)
在区间BegReport到EndYear年中,与BegReport报告期同比的报告期中返回表达式exp为真的报告期。
| 参数 | 类型 | 说明 |
|---|---|---|
expr |
any | 布尔公式表达式 |
beg_report |
any | 开始期,开始报告期 |
end_year |
any | 年份,截止年份 |
返回:any
positionOfIndustry()
向导函数相关函数。
返回:any
ratioValueByType(v1, v2, _type, n)
依据返回类型type,返回初值V1到末值V2的增长/增长率/复合增长率。
| 参数 | 类型 | 说明 |
|---|---|---|
v1 |
int | 实数,初值 |
v2 |
int | 实数,末值 |
_type |
int | 用户自定义,返回数据类型 |
n |
int | 整数,期数或交易天数 |
返回:float
reduceWithHighestOfPeriod(exp, beg_date, end_date, return_type)
返回表达式Exp在区间BegDate到EndDate中的最大值与在EndDate的值的偏离,ReturnType决定返回偏离值(增加值)还是偏离率(增速%)。
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
Expr | 函数表达式 |
beg_date |
datetime | 日期,开始日 |
end_date |
datetime | 日期,截止日 |
return_type |
int | 用户自定义,返回类型 |
返回:float
示例
SetSysParam(pn_stock(),'SZ000001');
return ReduceWithHighestOfPeriod(@close(),20180801T,20180803T,0);
relativeStrengthOfIndustry()
向导函数相关函数。
返回:any
reportOfListed(id, report_id)
返回指定报告期ReportID的基本面ID数据。如果该证券未上市,则返回0,函数与系统参数(股票、时间)相关。
| 参数 | 类型 | 说明 |
|---|---|---|
id |
string | 基本面,基本面ID |
report_id |
string | 报告期 |
返回:any
reportPerShareOfListed(id, report_id)
指定报告期ReportID的基本面ID数据/总股本。如果该证券未上市,则返回0,函数与系统参数(股票、时间)相关。
| 参数 | 类型 | 说明 |
|---|---|---|
id |
string | 基本面,数据ID |
report_id |
string | 报告期 |
返回:any
reportValueOfPeriod(exp, beg_report, end_report, report_type, reportvalue)
区间财务数据
| 参数 | 类型 | 说明 |
|---|---|---|
exp |
string | 字符串,函数表达式 |
beg_report |
int | 整数,开始报告期 |
end_report |
int | 整数,截止报告期 |
report_type |
int | 整数,报告期类型 |
reportvalue |
array | 数组,报告期数据 |
返回:array
simplyRatioValue(v1, v2)
返回初值V1到末值V2的增长率。若V1<0,则直接返回0。
| 参数 | 类型 | 说明 |
|---|---|---|
v1 |
int | 实数,初值 |
v2 |
int | 实数,末值 |
返回:float
stockTrailingAvgByEndT(endt, ref_type, exp, is_exclude_ipo, n)
获取基于指定日推移阶段的日均指标
| 参数 | 类型 | 说明 |
|---|---|---|
endt |
datetime | 日期,截止日 |
ref_type |
UserDefine | 用户自定义,选择所推移类型,取值如下: |
exp |
string | 字符串, 指标表达式,如"close()","stockzdf3()" |
is_exclude_ipo |
bool | object |
n |
int | 整数, 剔除天数 |
返回:float
示例
获取万科A过去1年的日均成交金额
setsysparam(pn_stock(),"SZ000002");
endt := 20210714t;
RefType := 4;//过去1年
exp := "Amount()";
return StockTrailingAvgByEndT(Endt,RefType,Exp);
stockTrailingStdByEndT(endt, ref_type, exp, is_exclude_ipo, n)
获取基于指定日推移阶段的指标标准差
| 参数 | 类型 | 说明 |
|---|---|---|
endt |
datetime | 日期,截止日 |
ref_type |
UserDefine | 用户自定义,选择所推移类型,取值如下: |
exp |
string | 字符串, 指标表达式,如"close()","stockzdf3()" |
is_exclude_ipo |
bool | object |
n |
int | 整数, 剔除天数 |
返回:float
示例
获取万科A过去1年的日收益率标准差
setsysparam(pn_stock(),"SZ000002");
endt := 20210714t;
RefType := 4;//过去1年
exp := "stockzf3()";
return StockTrailingStdByEndT(Endt,RefType,Exp); // 1.69
TechCal_Unit(expression)
向导函数相关函数。
| 参数 | 类型 | 说明 |
|---|---|---|
expression |
object |
返回:any