# 金融 / 财务分析 / 常用 ## `financialIncreaseRatio(rep_1, rep_2, report_id)` 声明:function 财务数据增长比率(%) | 参数 | 类型 | 说明 | | ----------- | ------- | ------------------ | | `rep_1` | ingeter | 整数,开始报告期; | | `rep_2` | ingeter | 整数,截止报告期; | | `report_id` | array | 数组,基本面ID | 返回:real ### 示例 范例01:调用函数 ```tsl o_v := BackUpSystemParameters2(); // 取股票"万科A"2011年报营业收入增长率 setSysParam(pn_stock(), 'SZ000002'); return financialIncreaseRatio(20101231, 20111231, array(dataBaseRatioId(1))); // 输出:41.54 ``` ## `financialIncreaseValue(rep_1, rep_2, report_id)` 声明:function 财务数据增长值 | 参数 | 类型 | 说明 | | ----------- | ------- | ------------------ | | `rep_1` | ingeter | 整数,开始报告期; | | `rep_2` | ingeter | 整数,截止报告期 | | `report_id` | array | 数组,基本面ID | 返回:real/array ### 示例 范例01:调用函数 ```tsl o_v := BackUpSystemParameters2(); // 取股票"万科A"2011年报 setSysParam(pn_stock(), 'SZ000002'); return financialIncreaseValue(20110630, 20111231, array(dataBaseRatioId(1))); // 输出:51793911723.54 ``` ## `financialIndexGrowRatio(report_date, info_id_arr)` 声明:function 财务指标同比增长率(%) | 参数 | 类型 | 说明 | | ------------- | ------- | -------------- | | `report_date` | ingeter | 整数,报告期; | | `info_id_arr` | array | 数组,基本面 | 返回:real/array ### 示例 范例01:调用函数 ```tsl o_v := BackUpSystemParameters2(); // 取股票"万科A"2011年报营业收入同比增长率 setSysParam(pn_stock(), 'SZ000002'); return financialIndexGrowRatio(20111231, array(dataBaseRatioId(1))); // 输出:41.54 ``` ## `financialIndexGrowValue(report_date, info_id_arr)` 声明:function 财务指标同比增长 | 参数 | 类型 | 说明 | | ------------- | ------- | -------------- | | `report_date` | ingeter | 整数,报告期; | | `info_id_arr` | array | 数组,基本面 | 返回:real/array ### 示例 范例01:调用函数 ```tsl o_v := BackUpSystemParameters2(); // 取股票"万科A"2011年报营业收入同比增加值 setSysParam(pn_stock(), 'SZ000002'); return financialIndexGrowValue(20111231, array(dataBaseRatioId(1))); // 输出:21068898358.05 ``` ## `financialIndexPerShare(report_date, info_id_arr)` 声明:function 每股财务指标 | 参数 | 类型 | 说明 | | ------------- | ------- | -------------- | | `report_date` | ingeter | 整数,报告期; | | `info_id_arr` | array | 数组,基本面 | 返回:real ### 示例 范例01:调用函数 ```tsl o_v := BackUpSystemParameters2(); // 取股票"万科A"2011年报每股营业收入 setSysParam(pn_stock(), 'SZ000002'); return financialIndexPerShare(20111231, array(dataBaseRatioId(1))); // 输出:6.53 ``` ## `financialItemIn12Month(r_date, info_id)` 声明:function 最近12个月财务指标 | 参数 | 类型 | 说明 | | --------- | ------- | -------------- | | `r_date` | ingeter | 整数,报告期; | | `info_id` | ingeter | 整数,基本面ID | 返回:real ### 示例 范例01:调用函数 ```tsl o_v := BackUpSystemParameters2(); // 取股票"万科A"2011年报最近12个月营业收入 setSysParam(pn_stock(), 'SZ000002'); return financialItemIn12Month(20111231, dataBaseRatioId(1)); // 输出:71782749800.68 ``` ## `financialItemIn12Month2(r_date, info_id, info_id_2)` 声明:function 最近12个月财务指标,与系统参数(证券代码)相关。如果指定报告期不存在时,则返回0 | 参数 | 类型 | 说明 | | ----------- | ------- | --------------- | | `r_date` | integer | 整数。报告期 | | `info_id` | integer | 整数。基本面ID | | `info_id_2` | integer | 整数。基本面ID2 | 返回:real ### 示例 范例01:调用函数 ```tsl // "SZ000728"在20221231最近12个月的快报归母净利润季度数据 setSysParam(pn_stock(), "SZ000728"); return financialItemIn12Month2(20221231, 41006, 46078); // 输出:1718290700 ``` ## `financialItemPsIn12Month(r_date, info_id)` 声明:function 最近12个月财务指标(每股) | 参数 | 类型 | 说明 | | --------- | ------- | -------------- | | `r_date` | ingeter | 整数,报告期; | | `info_id` | ingeter | 整数,基本面ID | 返回:real ### 示例 范例01:调用函数 ```tsl o_v := BackUpSystemParameters2(); // 取股票"万科A"2011年报最近12个月每股营业收入 setSysParam(pn_stock(), 'SZ000002'); return financialItemPsIn12Month(20111231, dataBaseRatioId(1)); // 输出:6.53 ``` ## `financialItemPsIn12Month2(r_date, info_id, info_id_2)` 声明:function 最近12个月财务指标(每股),与系统参数(股票)相关 | 参数 | 类型 | 说明 | | ----------- | ------- | --------------- | | `r_date` | integer | 整数。报告期 | | `info_id` | integer | 整数。基本面ID | | `info_id_2` | integer | 整数。基本面ID2 | 返回:real ### 示例 范例01:调用函数 ```tsl // SZ000728在20221231的最近12个月的基本每股收益(业绩快报) setSysParam(pn_stock(), "SZ000728"); setSysParam(PN_Date(), 20230327T); return financialItemPsIn12Month2(20221231, 41006, 46078); // 输出:0.393762181055058 ``` ## `financialpercentileofnday(endt, exp, n)` 声明:function 财务指标占N日内该指标的百分位,财务指标(适用估值类)占历史N日内该指标的百分位,与系统参数证券代码相关 | 参数 | 类型 | 说明 | | ------ | ------- | ------------- | | `endt` | date | 日期,截止日期 | | `exp` | integer | 整型,财务指标 | | `n` | integer | 整型,N日 | 返回:real ### 示例 范例01:调用函数 ```tsl // "SZ000001"在20200622指标PE占历史250日内该指标的百分位 setSysParam(pn_stock(), "SZ000001"); return FinancialPercentileOfNYear(20200622T, @stockPe3(0), 250); // 输出:0.03 ``` ## `financialValueRatio(report_date, info_id_1, info_id_2)` 声明:function 财务比率(%) | 参数 | 类型 | 说明 | | ------------- | ------- | --------------- | | `report_date` | ingeter | 整数,报告期; | | `info_id_1` | ingeter | 整数,基本面1; | | `info_id_2` | ingeter | 整数,基本面2; | 返回:real ### 示例 范例01:调用函数 ```tsl o_v := BackUpSystemParameters2(); // 取股票"万科A"2011年报主营净利率(%)=净利润/主营业务收入*100 setSysParam(pn_stock(), 'SZ000002'); return financialValueRatio(20111231, dataBaseRatioId(9), dataBaseRatioId(1)); // 输出:13.41 ``` ## `increaseWithSamePeriod(beg_year, end_year, type, info_id_arr, compare_type, show_type)` 声明:function 指定财务数据的纵向对比 | 参数 | 类型 | 说明 | | -------------- | ------- | ------------------ | | `beg_year` | ingeter | 整数,起始年限; | | `end_year` | ingeter | 整数,截止年限; | | `type` | ingeter | 整数,报告期类型; | | `info_id_arr` | array | 数组,基本面内容; | | `compare_type` | ingeter | 整数,类型; | | `show_type` | ingeter | 整数,显示设置; | 返回:array ### 示例 范例01:调用函数 ```tsl o_v := BackUpSystemParameters2(); // 取股票"万科A"报告期为"年报",类型为"同比分析",显示"结果和同比",财务指标数据取每股指标、每股净资产、净资产收益率 setSysParam(pn_stock(), 'SZ000002'); return increaseWithSamePeriod(2010, 2011, 4, array(dataBaseRatioId(121), dataBaseRatioId(123), dataBaseRatioId(122)), 0, 0); ``` ## `magicSum(items, starty, end_y)` 声明:function 对所有项目总体进行求和 | 参数 | 类型 | 说明 | | -------- | ----- | ---------------- | | `items` | array | 基本面数组,项目 | | `starty` | int | 整数,开始年 | | `end_y` | int | 整数,截止年 | 返回:float ### 示例 范例01:调用函数 ```tsl setsysparam(pn_stock(), "SZ000002"); return MagicSum(array(46033), 0, 2003); ``` ## `magicSum2(items, starty, end_y)` 声明:function 单独对项目求和,返回数组 | 参数 | 类型 | 说明 | | -------- | ------- | ---------------- | | `items` | array | 基本面数组,项目 | | `starty` | integer | 整数,开始年 | | `end_y` | integer | 整数,截止年 | 返回:array ### 示例 范例01:返回万科A上市至2003年利润总额、净利润两科目分别的和 ```tsl setsysparam(pn_stock(), "SZ000002"); return MagicSum2(array(46024, 46033), 0, 2003); // 输出:万科A上市至2003年利润总额、净利润两科目分别的和 ```