📝 docs(tsl-api): add missing financial API codegen entries
This commit is contained in:
@@ -53,6 +53,7 @@ addStockBigBargainDetail dotnet financial addStockBigBargainDetail(s_id, s_name,
|
||||
addStrings builtin object addStrings(strings) builtin/object/tstringlist.md addstringsstrings Object TStringList 字符串列表 添加 追加 数组 列表 array list 字符串 文本 string 将Strings里的字符串批量添加 method instance public TStringList TStringList.addStrings
|
||||
addText builtin object addText() builtin/object/mailmsg.md addtext Object MailMsg 邮件消息 添加 追加 对象 实例 邮件 SMTP POP3 IMAP 添加一个文本格式的消息部分 method instance public MailMsg MailMsg.addText
|
||||
adjustLineBreaks builtin string adjustLineBreaks(s, style) builtin/string.md adjustlinebreaks 字符串 文本 string text 统一字符串中的换行符。`style` 为 0 时使用换行符,为 1 时使用回车加换行符;也支持数组批量处理 function adjustLineBreaks
|
||||
adjustmentFactor dotnet financial adjustmentFactor(rate_day) dotnet/financial/market-specified_date.md adjustmentfactor 金融 行情 指定日 复权 复权因子 股票 ETF LOF 可转债 返回从复权基准日到系统时间的比例复权因子,与系统参数中的证券代码和系统时间相关。支持股票、ETF、LOF 和可转债;模型考虑股权分置改革的分红送股,不考虑权证。复权价格等于收盘价乘以复权因子 function adjustmentFactor
|
||||
adjustSampleByAny dotnet financial adjustSampleByAny(bk_name, beg_t, money, eval_exp, sort_dir, range_type, range_beg, range_end, percent_type, condition) dotnet/financial/financial_engineering-portfolio-common.md adjustsamplebyany 金融 金融工程 投资组合 Common 排序 sort 计算 求解 计算满足条件Condition的股票的EvalExp,选取值在RangeBeg跟RangeEnd之间,按照不同的RangeType类型选择股票,并分配资金 function adjustSampleByAny
|
||||
adjustSmaple dotnet financial adjustSmaple(bk_name, beg_t, money, from_no, to_no, percent_type) dotnet/financial/financial_engineering-portfolio-correlation_beta_alpha.md adjustsmaple 金融 金融工程 投资组合 相关系数 Beta Alpha 样本调整 选股 市盈率 资金分配 权重 按市盈率名次从指定板块选股,再按指定权重分配资金并计算可购买股数 function adjustSmaple
|
||||
adl dotnet financial adl(m) dotnet/financial/technical_analysis-market_trend_indicators-chart.md adl 金融 技术分析 大势指标 图形 返回 获取 图表 graph ADL ADR OBOS 返回腾落指标 1.ADL与指数顶背离时,指数向下反转机会大; 2.ADL与指数底背离时,指数向上反转机会大; 3.ADL须与ADR 、OBOS等指标配合使用 function adl
|
||||
@@ -2858,6 +2859,13 @@ fi_k_ratio dotnet financial fi_k_ratio(r) dotnet/financial/special_topics-strate
|
||||
fi_maxDrawdown dotnet financial fi_maxDrawdown(r) dotnet/financial/special_topics-strategy_evaluation-performance_analysis-return_evaluation-risk.md fi_maxdrawdown 金融 专题函数 策略评价 绩效分析 收益率评价 风险 返回 获取 返回最大回撤(%) function fi_maxDrawdown
|
||||
fi_price_to_rt dotnet financial fi_price_to_rt(ljz) dotnet/financial/special_topics-strategy_evaluation-performance_analysis-return_evaluation-intermediate-return_series_conversion.md fi_price_to_rt 金融 专题函数 策略评价 绩效分析 收益率评价 中间函数 收益率序列转换 返回 获取 类型转换 转换 conversion 返回价格序列转换为收益率(%)序列 处理说明:首期为0 function fi_price_to_rt
|
||||
fi_r2 dotnet financial fi_r2(r, br) dotnet/financial/special_topics-strategy_evaluation-performance_analysis-return_evaluation-regression_statistics.md fi_r2 金融 专题函数 策略评价 绩效分析 收益率评价 回归统计 返回 获取 统计 概率 statistics R2 返回R2 function fi_r2
|
||||
fi_report_corrAnalysis dotnet financial fi_report_corrAnalysis(rt_data, fname_date) dotnet/financial/financial_engineering-factor_research-performance_analysis-return_evaluation-intermediate-common_reports.md fi_report_corranalysis 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 相关性 分析 生成收益率评价的相关性分析报表 function fi_report_corrAnalysis
|
||||
fi_report_excessYields dotnet financial fi_report_excessYields(rt_data, fname_pf, fname_bm, fname_date, plot_type) dotnet/financial/financial_engineering-factor_research-performance_analysis-return_evaluation-intermediate-common_reports.md fi_report_excessyields 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 超额收益 回撤 相对净值 分析组合与基准的超额收益,计算超额收益率、累计收益、相对净值和回撤指标;可返回完整数据集或生成多子图 function fi_report_excessYields
|
||||
fi_report_historicalPerformance dotnet financial fi_report_historicalPerformance(rt_data, fname_bm, fname_date, cycle, factor_roll_n_year) dotnet/financial/financial_engineering-factor_research-performance_analysis-return_evaluation-intermediate-common_reports.md fi_report_historicalperformance 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 历史行情 走势 生成收益率评价的历史行情走势报表 function fi_report_historicalPerformance
|
||||
fi_report_periodReturn dotnet financial fi_report_periodReturn(rt_data, fname_date) dotnet/financial/financial_engineering-factor_research-performance_analysis-return_evaluation-intermediate-common_reports.md fi_report_periodreturn 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 阶段收益 业绩查询 生成收益率评价的阶段收益报表 function fi_report_periodReturn
|
||||
fi_report_returnAndRisk dotnet financial fi_report_returnAndRisk(rt_data, fname_date, qk_type, cycle, days_in_1_y) dotnet/financial/financial_engineering-factor_research-performance_analysis-return_evaluation-intermediate-common_reports.md fi_report_returnandrisk 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 收益 风险 阶段 生成收益率评价的阶段收益风险特征报表 function fi_report_returnAndRisk
|
||||
fi_report_riskFeature dotnet financial fi_report_riskFeature(rt_data, fname_bm, fname_date, days_in_1_y) dotnet/financial/financial_engineering-factor_research-performance_analysis-return_evaluation-intermediate-common_reports.md fi_report_riskfeature 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 收益 风险 特征 生成收益率评价的收益风险特征报表 function fi_report_riskFeature
|
||||
fi_report_rollReturn dotnet financial fi_report_rollReturn(rt_data, fname_date, cycle) dotnet/financial/financial_engineering-factor_research-performance_analysis-return_evaluation-intermediate-common_reports.md fi_report_rollreturn 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 滚动收益 业绩查询 生成收益率评价的滚动收益报表 function fi_report_rollReturn
|
||||
fi_reportDateField dotnet financial fi_reportDateField() dotnet/financial/fundamentals-database_provider-data_table_field_mapping-financial_database_fields-financial_indicators.md fi_reportdatefield 金融 基本面 数据库提供商 数据表字段对照 财务库字段 财务指标 返回 获取 数据库 SQL database 返回财务指标-报告期。根据不同的数据库提供商返回对应的字段 function fi_reportDateField
|
||||
fi_rt_to_cumReturn dotnet financial fi_rt_to_cumReturn(r) dotnet/financial/special_topics-strategy_evaluation-performance_analysis-return_evaluation-intermediate-return_series_conversion.md fi_rt_to_cumreturn 金融 专题函数 策略评价 绩效分析 收益率评价 中间函数 收益率序列转换 获取 查询 类型转换 转换 conversion 获取累计收益率(%)序列(先转对数) function fi_rt_to_cumReturn
|
||||
fi_rt_to_drawdownUnderwater dotnet financial fi_rt_to_drawdownUnderwater(r) dotnet/financial/special_topics-strategy_evaluation-performance_analysis-return_evaluation-intermediate-return_series_conversion.md fi_rt_to_drawdownunderwater 金融 专题函数 策略评价 绩效分析 收益率评价 中间函数 收益率序列转换 返回 获取 类型转换 转换 conversion 返回高点回撤序列(%) function fi_rt_to_drawdownUnderwater
|
||||
@@ -2969,6 +2977,7 @@ financialIndexPerShare dotnet financial financialIndexPerShare(report_date, info
|
||||
financialItem dotnet financial financialItem(r_date, info_id) dotnet/financial/financial_analysis-intermediate.md financialitem 金融 财务分析 中间函数 计算 求解 计算指定报告期RDate的基本面id为InfoId的财务指标 function financialItem
|
||||
financialItemIn12Month dotnet financial financialItemIn12Month(r_date, info_id) dotnet/financial/financial_analysis-common.md financialitemin12month 金融 财务分析 常用 返回 获取 返回最近12个月财务指标 function financialItemIn12Month
|
||||
financialItemIn12Month2 dotnet financial financialItemIn12Month2(r_date, info_id, info_id_2) dotnet/financial/financial_analysis-common.md financialitemin12month2 金融 财务分析 常用 返回 获取 返回最近12个月财务指标,与系统参数(证券代码)相关。如果指定报告期不存在时,则返回0 function financialItemIn12Month2
|
||||
financialItemIn12Month_HK dotnet financial financialItemIn12Month_HK(r_date, info_id, if_to_func_currency) dotnet/financial/financial_analysis-extended_fundamental_data.md financialitemin12month_hk 金融 财务分析 扩展基本面数据 港股 HK TTM 最近12个月 财务指标 返回港股最近 12 个月财务指标,与系统参数中的证券代码相关。指定报告期不存在时返回 0;港股财务数据仅支持半年报和年报 function financialItemIn12Month_HK
|
||||
financialItemPs dotnet financial financialItemPs(r_date, info_id) dotnet/financial/financial_analysis-intermediate.md financialitemps 金融 财务分析 中间函数 计算 求解 计算每股财务指标,公式为财务指标/总股本 function financialItemPs
|
||||
financialItemPsIn12Month dotnet financial financialItemPsIn12Month(r_date, info_id) dotnet/financial/financial_analysis-common.md financialitempsin12month 金融 财务分析 常用 返回 获取 返回最近12个月财务指标(每股) function financialItemPsIn12Month
|
||||
financialItemPsIn12Month2 dotnet financial financialItemPsIn12Month2(r_date, info_id, info_id_2) dotnet/financial/financial_analysis-common.md financialitempsin12month2 金融 财务分析 常用 返回 获取 返回最近12个月财务指标(每股),与系统参数(股票)相关 function financialItemPsIn12Month2
|
||||
@@ -5488,6 +5497,7 @@ GetError module pdf-file GetError() module/pdf-file.md geterror 查询 错误码
|
||||
GetError module pdf-file GetError() module/pdf-file.md geterror-1 查询 页码 错误码 异常诊断 文档 文件 获取当前 PDF 页面对象的最后一个错误代码 method instance public pdfPage pdfPage.GetError
|
||||
GetErrorDistribution module fund-research GetErrorDistribution(vBegT, vEndT) module/fund-research/position-estimation.md geterrordistributionvbegtvendt 返回不同日期下基金测算仓位与真实仓位的误差分布 method instance public ts_SameTypeFundEquityPercent ts_SameTypeFundEquityPercent.GetErrorDistribution
|
||||
getEstSize builtin runtime getEstSize(value) builtin/runtime.md getestsize 运行时 获取 查询 获取估算变量占用的内存空间 function getEstSize
|
||||
getEtfListByDate dotnet financial getEtfListByDate(bk_name, end_t) dotnet/financial/fund-etf.md getetflistbydate 金融 基金 ETF 指定日 运作 交易代码 列表 返回指定日期仍在运作的 ETF 基金交易代码列表 function getEtfListByDate
|
||||
GetEvaluate module ts-trading-evaluation GetEvaluate() module/ts-trading-evaluation.md getevaluate 查询 交易评价 绩效指标 执行交易策略分层评价并返回汇总、个券及逐笔交易评价结果 method instance public tsTradingEvaluation tsTradingEvaluation.GetEvaluate
|
||||
GetEventInfo module ts-ed-event-generator GetEventInfo() module/ts-ed-event-generator.md geteventinfo 查询 事件驱动 事件研究 获取天软事件库数据信息 method instance public tsedEventGenerator tsedEventGenerator.GetEventInfo
|
||||
GetEventReturn module ts-factor-attribution GetEventReturn(v_end_t) module/ts-factor-attribution.md geteventreturnv_end_t 查询 回报率 投资收益 收益分解 贡献分析 因子分析 因子指标 事件驱动 返回指定日最新的事件收益数据,事件因子归因专用 method instance public tsrm_FactorAttribution tsrm_FactorAttribution.GetEventReturn
|
||||
@@ -5594,6 +5604,7 @@ GetInDebtandAssetHold module ts-backtesting GetInDebtandAssetHold() module/ts-ba
|
||||
GetInDebtandAssetHold module ts-backtesting GetInDebtandAssetHold(v_beg_t, v_end_t) module/ts-backtesting.md getindebtandassetholdv_beg_tv_end_t 查询 负债持仓 持仓明细 获取负债与资产相关的持仓明细 method instance public tsBackTesting tsBackTesting.GetInDebtandAssetHold
|
||||
GetInDebtandAssetHold module ts-backtesting GetInDebtandAssetHold(v_end_t) module/ts-backtesting.md getindebtandassetholdv_end_t 查询 负债持仓 持仓明细 获取负债与资产相关的持仓明细 method instance public tsBackTesting tsBackTesting.GetInDebtandAssetHold
|
||||
GetInDebtandAssetTradeData module ts-backtesting GetInDebtandAssetTradeData(v_beg_t, v_end_t) module/ts-backtesting.md getindebtandassettradedatav_beg_tv_end_t 查询 负债交易 交易明细 获取负债与资产相关的交易明细 method instance public tsBackTesting tsBackTesting.GetInDebtandAssetTradeData
|
||||
getIndexAdjustDate dotnet financial getIndexAdjustDate(index_id, beg_t, end_t) dotnet/financial/index-index_info.md getindexadjustdate 金融 指数 指数情况 调整日 调仓 日期 序列 返回指定指数在起止日期区间内的全部调整日序列 function getIndexAdjustDate
|
||||
GetIndexByEndT module ts-event-statistical-analysis GetIndexByEndT(stock_id, end_t) module/ts-event-statistical-analysis.md getindexbyendtstock_idend_t 查询 证券 个股 指数产品 行业分类 板块 比较基准 业绩基准 此方法用于获取基准指数代码(支持股票所属行业指数作为基准指数),与成员变量 method instance public tsEventStatisticalAnalysis tsEventStatisticalAnalysis.GetIndexByEndT
|
||||
GetIndexDailyHQPerf module ts-index-back-testing-base GetIndexDailyHQPerf(begt, endt, src_cycle) module/ts-index-back-testing-base.md getindexdailyhqperfbegtendtsrc_cycle 查询 绩效 业绩表现 市场数据 价格数据 区间日线行情信息 method instance public tsIndexBackTesting_base tsIndexBackTesting_base.GetIndexDailyHQPerf
|
||||
getIndexes dotnet financial getIndexes(market_id) dotnet/financial/index-basic_information.md getindexes 金融 指数 基本信息 获取 查询 获取指定市场的最新的指数代码列表,与sp_time()无关,不能获取历史数据 function getIndexes
|
||||
@@ -7784,6 +7795,7 @@ optionZLId2 dotnet financial optionZLId2(end_t, option_type, check_type) dotnet/
|
||||
ord builtin string ord(value) builtin/string.md ord 字符串 文本 string text ASCII WIDESTRING UNICODE 如果是STRING类型返回value\[1\]的ASCII序号,就是value字符串的第一个字符的ASCII序号,如果为WIDESTRING,则为UNICODE码 function ord
|
||||
Organization builtin object Organization builtin/object/mailmsg.md organization Object MailMsg 邮件消息 获取 查询 对象 实例 邮件 SMTP POP3 IMAP 获取或设置作者的从属组织 property instance public MailMsg MailMsg.Organization
|
||||
organTypeToName dotnet financial organTypeToName(type) dotnet/financial/stock-institutional_holdings-intermediate.md organtypetoname 金融 股票 机构持股 中间函数 返回 获取 返回通过机构类别的选择,返回机构对应类型的名称 function organTypeToName
|
||||
originalToFunctionalCurrency_HK dotnet financial originalToFunctionalCurrency_HK(end_t, original_value, original_currency) dotnet/financial/financial_analysis-extended_fundamental_data.md originaltofunctionalcurrency_hk 金融 财务分析 扩展基本面数据 港股 HK 汇率 原币 本币 港元 币种转换 使用天软汇率数据将港股财务数据从原币币种换算为本币币种,港股本币为港元 function originalToFunctionalCurrency_HK
|
||||
orth dotnet math orth(a) dotnet/math/numerical_calculation-matrix.md orth 矩阵范围内的标准正交基向量 function orth
|
||||
OrthData module ts-multi-factor OrthData(factor_table) module/ts-multi-factor.md orthdatafactor_table 正交化 因子处理 数据预处理 对因子表执行历史正交化处理;新代码优先使用 OrthDataCore method instance public tsMultiFactor tsMultiFactor.OrthData
|
||||
OrthDataCore module ts-multi-factor OrthDataCore(factor_table, factors) module/ts-multi-factor.md orthdatacorefactor_tablefactors 正交化 因子处理 数据预处理 按配置对因子表执行正交化,支持分组正交;可重写 method instance public tsMultiFactor tsMultiFactor.OrthDataCore
|
||||
@@ -8486,6 +8498,7 @@ reportSource module factor-research reportSource(id, r_date) module/factor-resea
|
||||
reportSourceRelease module factor-research reportSourceRelease(r_date, return_type) module/factor-research/real-time-financial-data.md reportsourcerelease 查询 释放 清理 时间处理 日期时间 因子 财务数据 获取指定报告期的数据源及公布日,与系统证券、时间、系统参数pn_ReportType相关 function reportSourceRelease
|
||||
reportSourceValue module factor-research reportSourceValue(id, r_date) module/factor-research/real-time-financial-data.md reportsourcevalue 查询 时间处理 日期时间 因子 财务数据 获取指定报告期 ID的不同数据源取值详情,与系统证券、时间相关,帮助用户掌握ID的发布 function reportSourceValue
|
||||
reportTableExists module factor-research reportTableExists(rdate, table_id) module/factor-research/real-time-financial-data.md reporttableexists 检查 判定 验证 表数据 二维表 因子 财务数据 判断指定报告期的报表是否公布,与系统证券相关 function reportTableExists
|
||||
reportType_HK dotnet financial reportType_HK(r_date, r_type) dotnet/financial/financial_analysis-extended_fundamental_data.md reporttype_hk 金融 财务分析 扩展基本面数据 港股 HK 报告期 报告类型 半年报 年报 根据报告期返回港股报告类型,或判断报告期与报告类型是否匹配,与系统参数中的证券代码相关。港股仅支持半年报和年报 function reportType_HK
|
||||
reportValueOfPeriod dotnet datawarehouse reportValueOfPeriod(exp, beg_report, end_report, report_type, reportvalue) dotnet/datawarehouse/wizard-intermediate.md reportvalueofperiod 数据仓库 向导函数 中间函数 区间财务数据 function reportValueOfPeriod
|
||||
repoZf dotnet financial repoZf(beg_t, endt) dotnet/financial/market-range.md repozf 金融 行情 区间 返回 获取 返回回购区间收益率(%),与系统参数(股票)相关 function repoZf
|
||||
repoZf2 dotnet financial repoZf2() dotnet/financial/market-current_day.md repozf2 金融 行情 当日 返回 获取 返回回购收益率(%),与系统函数(证券代码,时间)相关 function repoZf2
|
||||
@@ -10862,6 +10875,7 @@ stockZTLBNumByEndt module data-models-and-applications stockZTLBNumByEndt(end_t)
|
||||
stockZtLBNumByEndt2 dotnet financial stockZtLBNumByEndt2(endt) dotnet/financial/market-current_day.md stockztlbnumbyendt2 金融 行情 当日 返回 获取 返回证券指定日最近的连板次数统计 function stockZtLBNumByEndt2
|
||||
stockZtOpen dotnet financial stockZtOpen(beg_t_time, end_t_time, trade_time) dotnet/financial/market-specified_date.md stockztopen 金融 行情 指定日 涨停 打开涨停 开板 次数 limit up reopen 统计指定时段内涨停持续达到给定分钟数后价格回落的次数,与系统参数中的证券代码相关 function stockZtOpen
|
||||
stockztordtclose dotnet financial stockztordtclose(flag) dotnet/financial/market-specified_date.md stockztordtclose 金融 行情 指定日 日期时间 日期 时间 datetime ETF LOF 支持品种:A股,基金(ETF;LOF;Reits),可转债,期货,期权 function stockztordtclose
|
||||
stockZtOrDtCloseOfMD dotnet financial stockZtOrDtCloseOfMD(flag) dotnet/financial/market-specified_date.md stockztordtcloseofmd 金融 行情 指定日 涨停 跌停 涨跌停价 交易所 返回交易所提供的涨停价或跌停价,与系统参数中的证券代码和系统时间相关 function stockZtOrDtCloseOfMD
|
||||
str builtin string str(x, s) builtin/string.md str 字符串 转换 编码 文本 string text 将一个实数X转换成字符串,存到参数S中 function str
|
||||
str2Array builtin string str2Array(value, aps) builtin/string.md str2array 字符串 文本 string text 按分隔符把字符串拆成一维字符串数组。省略 `aps` 时使用分号 function str2Array
|
||||
strCmp builtin string strCmp(s1, s2) builtin/string.md strcmp 字符串 文本 string text 比较s1与s2的ascii码值的大小,若s1较大,则返回正数,若相等,则返回0,若s2较大,则返回负数。返回值的绝对值大小无实际意义 function strCmp
|
||||
|
||||
|
Can't render this file because it is too large.
|
+140
@@ -418,3 +418,143 @@ v := reportOfEndT(46, 20150101T, "营业收入");
|
||||
return v;
|
||||
// 输出:146388004498.44
|
||||
```
|
||||
|
||||
## `financialItemIn12Month_HK(r_date, info_id, if_to_func_currency)`
|
||||
|
||||
声明:function
|
||||
|
||||
返回港股最近 12 个月财务指标,与系统参数中的证券代码相关。指定报告期不存在时返回 0;港股财务数据仅支持半年报和年报
|
||||
|
||||
<!-- tags: 金融 财务分析 扩展基本面数据 港股 HK TTM 最近12个月 财务指标 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --------------------- | ------- | ------------------------------------------------- |
|
||||
| `r_date` | integer | 报告期。官网定义中的类型原文拼作 `Ingeter` |
|
||||
| `info_id` | integer | 基本面数据 ID。官网定义中的类型原文拼作 `Ingeter` |
|
||||
| `if_to_func_currency` | bool | 可选。是否转为本币,默认 0,即保留原币记账 |
|
||||
|
||||
if_to_func_currency 取值
|
||||
|
||||
- `0` — 不转为本币,使用原币币种记账
|
||||
- `1` — 使用天软汇率数据转为本币币种;港股本币为港元
|
||||
|
||||
返回:real
|
||||
|
||||
若报告类型为年报,TTM 数据等于本报告期数据;若报告类型为半年报,TTM 数据等于本报告期数据加上“往前推两期数据减同比报告期数据”
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:按原币取得港股 TTM 数据
|
||||
|
||||
```tsl
|
||||
end_t := 20260611T;
|
||||
stock_id := 'HK00659';
|
||||
setSysParam(pn_stock(), stock_id);
|
||||
setSysParam(pn_date(), end_t);
|
||||
r_date := 20250630;
|
||||
return financialItemIn12Month_HK(r_date, 46002);
|
||||
// 输出:24285300000
|
||||
```
|
||||
|
||||
范例02:将港股 TTM 数据转为港元
|
||||
|
||||
```tsl
|
||||
end_t := 20260611T;
|
||||
stock_id := 'HK00005';
|
||||
setSysParam(pn_stock(), stock_id);
|
||||
setSysParam(pn_date(), end_t);
|
||||
r_date := 20250630;
|
||||
return financialItemIn12Month_HK(r_date, 46002, 1);
|
||||
// 输出:587736013816.547
|
||||
```
|
||||
|
||||
## `reportType_HK(r_date, r_type)`
|
||||
|
||||
声明:function
|
||||
|
||||
根据报告期返回港股报告类型,或判断报告期与报告类型是否匹配,与系统参数中的证券代码相关。港股仅支持半年报和年报
|
||||
|
||||
<!-- tags: 金融 财务分析 扩展基本面数据 港股 HK 报告期 报告类型 半年报 年报 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| -------- | ------- | ------------------------------------------------ |
|
||||
| `r_date` | integer | 报告期。官网定义中的类型原文拼作 `Ingeter` |
|
||||
| `r_type` | integer | 可选。返回结果类型,默认 0。官网定义中的类型原文拼作 `Ingeter` |
|
||||
|
||||
r_type 取值
|
||||
|
||||
- `0` — 返回报告类型字符串:`年报` 或 `半年报`
|
||||
- `1` — 返回 0 或 1,表示报告期与报告类型是否匹配
|
||||
- `-1` — 返回包含报告期、报告类型和是否匹配的数组
|
||||
|
||||
返回:string|integer|array
|
||||
|
||||
匹配规则为:半年报的报告期应为 `****0630`,年报的报告期应为 `****1231`;其他组合均不匹配
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:返回报告类型
|
||||
|
||||
```tsl
|
||||
setSysParam(pn_stock(), 'HK00659');
|
||||
r_date := 20251231;
|
||||
return reportType_HK(r_date, 0);
|
||||
// 输出:半年报
|
||||
```
|
||||
|
||||
范例02:判断报告期与报告类型是否匹配
|
||||
|
||||
```tsl
|
||||
setSysParam(pn_stock(), 'HK00659');
|
||||
r_date := 20251231;
|
||||
return reportType_HK(r_date, 1);
|
||||
// 输出:0
|
||||
```
|
||||
|
||||
范例03:返回报告期、报告类型和是否匹配
|
||||
|
||||
```tsl
|
||||
setSysParam(pn_stock(), 'HK00659');
|
||||
r_date := 20251231;
|
||||
return reportType_HK(r_date, -1);
|
||||
// 输出:array('报告期':20251231,'报告类型':'半年报','是否匹配':0)
|
||||
```
|
||||
|
||||
## `originalToFunctionalCurrency_HK(end_t, original_value, original_currency)`
|
||||
|
||||
声明:function
|
||||
|
||||
使用天软汇率数据将港股财务数据从原币币种换算为本币币种,港股本币为港元
|
||||
|
||||
<!-- tags: 金融 财务分析 扩展基本面数据 港股 HK 汇率 原币 本币 港元 币种转换 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------------------- | ------ | ----------------------------------------- |
|
||||
| `end_t` | date | 截止日期 |
|
||||
| `original_value` | real | 按原币记账的数据值 |
|
||||
| `original_currency` | string | 原币币种,使用大写代码,如 HKD、CNY、USD |
|
||||
|
||||
返回:real
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:将美元换算为港元
|
||||
|
||||
```tsl
|
||||
return originalToFunctionalCurrency_HK(20251231T, 1, 'USD');
|
||||
// 输出:7.78
|
||||
```
|
||||
|
||||
范例02:将人民币换算为港元
|
||||
|
||||
```tsl
|
||||
return originalToFunctionalCurrency_HK(20251231T, 1, 'CNY');
|
||||
// 输出:1.11
|
||||
```
|
||||
|
||||
范例03:将泰铢换算为港元
|
||||
|
||||
```tsl
|
||||
return originalToFunctionalCurrency_HK(20251231T, 1, 'THB');
|
||||
// 输出:0.25
|
||||
```
|
||||
|
||||
+203
@@ -0,0 +1,203 @@
|
||||
# 金融 / 金融工程 / 因子研究 / 绩效分析 / 收益率评价 / 中间函数 / 常用报表
|
||||
|
||||
## `fi_report_excessYields(rt_data, fname_pf, fname_bm, fname_date, plot_type)`
|
||||
|
||||
声明:function
|
||||
|
||||
分析组合与基准的超额收益,计算超额收益率、累计收益、相对净值和回撤指标;可返回完整数据集或生成多子图
|
||||
|
||||
<!-- tags: 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 超额收益 回撤 相对净值 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------------ | ----------- | ------------------------------ |
|
||||
| `rt_data` | array | 二维数组,净值收益率百分比序列 |
|
||||
| `fname_pf` | string | 组合字段名称 |
|
||||
| `fname_bm` | string | 基准字段名称 |
|
||||
| `fname_date` | string | 日期字段名称 |
|
||||
| `plot_type` | user_define | 返回类型 |
|
||||
|
||||
plot_type 取值
|
||||
|
||||
- `0` — 返回包含超额、累计、回撤和相对净值的完整数据集
|
||||
- `1` — 返回 `tssubplot_lines` 生成的多子图数组
|
||||
|
||||
返回:array
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:生成组合与基准的超额收益图表
|
||||
|
||||
```tsl
|
||||
rt_data := TSUT_Data_ZSZF();
|
||||
return fi_report_excessYields(rt_data, '沪深300', '中证500', '截止日', 1);
|
||||
```
|
||||
|
||||
## `fi_report_corrAnalysis(rt_data, fname_date)`
|
||||
|
||||
声明:function
|
||||
|
||||
生成收益率评价的相关性分析报表
|
||||
|
||||
<!-- tags: 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 相关性 分析 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------------ | ------- | ------------------------------ |
|
||||
| `rt_data` | db_data | 收益率数据表 |
|
||||
| `fname_date` | string | 日期字段名称,通常为“截止日” |
|
||||
|
||||
返回:array
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:生成相关性分析报表
|
||||
|
||||
```tsl
|
||||
rt_data := tsindexs_get_rQK2('TSI010001', 20250601T, 20260601T, '日线', 1);
|
||||
fname_date := '截止日';
|
||||
return fi_report_corrAnalysis(rt_data, fname_date);
|
||||
```
|
||||
|
||||
## `fi_report_historicalPerformance(rt_data, fname_bm, fname_date, cycle, factor_roll_n_year)`
|
||||
|
||||
声明:function
|
||||
|
||||
生成收益率评价的历史行情走势报表
|
||||
|
||||
<!-- tags: 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 历史行情 走势 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| -------------------- | ---------- | -------------------- |
|
||||
| `rt_data` | db_data | 收益率数据表 |
|
||||
| `fname_bm` | string | 基准字段名称 |
|
||||
| `fname_date` | string | 日期字段名称 |
|
||||
| `cycle` | cycle_list | 滚动周期;官网范例未传入,定义未说明默认值 |
|
||||
| `factor_roll_n_year` | integer | 滚动年数;官网范例未传入,定义未说明默认值 |
|
||||
|
||||
返回:array
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:生成历史行情走势报表
|
||||
|
||||
```tsl
|
||||
rt_data := tsindexs_get_rQK('TSI010001', 20250601T, 20260601T, '日线', 'SH000300');
|
||||
fname_bm := 'SH000300';
|
||||
fname_date := '截止日';
|
||||
return fi_report_historicalPerformance(rt_data, fname_bm, fname_date);
|
||||
```
|
||||
|
||||
## `fi_report_periodReturn(rt_data, fname_date)`
|
||||
|
||||
声明:function
|
||||
|
||||
生成收益率评价的阶段收益报表
|
||||
|
||||
<!-- tags: 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 阶段收益 业绩查询 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------------ | ------- | ---------------------------- |
|
||||
| `rt_data` | db_data | 收益率数据表 |
|
||||
| `fname_date` | string | 日期字段名称,通常为“截止日” |
|
||||
|
||||
返回:array
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:生成阶段收益报表
|
||||
|
||||
```tsl
|
||||
rt_data := tsindexs_get_rQK('TSI010001', 20250601T, 20260601T, '日线');
|
||||
fname_date := '截止日';
|
||||
return fi_report_periodReturn(rt_data, fname_date);
|
||||
```
|
||||
|
||||
## `fi_report_returnAndRisk(rt_data, fname_date, qk_type, cycle, days_in_1_y)`
|
||||
|
||||
声明:function
|
||||
|
||||
生成收益率评价的阶段收益风险特征报表
|
||||
|
||||
<!-- tags: 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 收益 风险 阶段 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------------- | ----------- | ---------------------------- |
|
||||
| `rt_data` | db_data | 收益率数据表 |
|
||||
| `fname_date` | string | 日期字段名称,通常为“截止日” |
|
||||
| `qk_type` | user_define | 采样类型 |
|
||||
| `cycle` | cycle_list | 采样周期 |
|
||||
| `days_in_1_y` | integer | 年化系数;官网范例未传入,定义未说明默认值 |
|
||||
|
||||
qk_type 取值
|
||||
|
||||
- `0` — 固定周期
|
||||
- `1` — 滚动周期
|
||||
|
||||
返回:array
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:按固定季度生成阶段收益风险特征报表
|
||||
|
||||
```tsl
|
||||
rt_data := tsindexs_get_rQK(
|
||||
array('TSI010001', 'TSI010002'), 20250601T, 20260601T, '日线');
|
||||
fname_date := '截止日';
|
||||
qk_type := 0;
|
||||
cycle := '季线';
|
||||
return fi_report_returnAndRisk(rt_data, fname_date, qk_type, cycle);
|
||||
```
|
||||
|
||||
## `fi_report_riskFeature(rt_data, fname_bm, fname_date, days_in_1_y)`
|
||||
|
||||
声明:function
|
||||
|
||||
生成收益率评价的收益风险特征报表
|
||||
|
||||
<!-- tags: 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 收益 风险 特征 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------------- | ------- | ------------ |
|
||||
| `rt_data` | db_data | 收益率数据表 |
|
||||
| `fname_bm` | string | 基准字段名称 |
|
||||
| `fname_date` | string | 日期字段名称 |
|
||||
| `days_in_1_y` | integer | 年化系数;官网范例未传入,定义未说明默认值 |
|
||||
|
||||
返回:array
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:生成收益风险特征报表
|
||||
|
||||
```tsl
|
||||
rt_data := tsindexs_get_rQK('TSI010001', 20250601T, 20260601T, '日线', 'SH000300');
|
||||
fname_bm := 'SH000300';
|
||||
fname_date := '截止日';
|
||||
return fi_report_riskFeature(rt_data, fname_bm, fname_date);
|
||||
```
|
||||
|
||||
## `fi_report_rollReturn(rt_data, fname_date, cycle)`
|
||||
|
||||
声明:function
|
||||
|
||||
生成收益率评价的滚动收益报表
|
||||
|
||||
<!-- tags: 金融 金融工程 因子研究 绩效分析 收益率评价 常用报表 滚动收益 业绩查询 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------------ | ---------- | ---------------------------- |
|
||||
| `rt_data` | db_data | 收益率数据表 |
|
||||
| `fname_date` | string | 日期字段名称,通常为“截止日” |
|
||||
| `cycle` | cycle_list | 滚动周期 |
|
||||
|
||||
返回:array
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:生成季度滚动收益报表
|
||||
|
||||
```tsl
|
||||
rt_data := tsindexs_get_rQK('TSI010001', 20250601T, 20260601T, '日线');
|
||||
fname_date := '截止日';
|
||||
cycle := '季线';
|
||||
return fi_report_rollReturn(rt_data, fname_date, cycle);
|
||||
```
|
||||
@@ -74,3 +74,26 @@ else
|
||||
result := array(); // 获取失败
|
||||
return result;
|
||||
```
|
||||
|
||||
## `getEtfListByDate(bk_name, end_t)`
|
||||
|
||||
声明:function
|
||||
|
||||
返回指定日期仍在运作的 ETF 基金交易代码列表
|
||||
|
||||
<!-- tags: 金融 基金 ETF 指定日 运作 交易代码 列表 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --------- | ----------- | ---------------------------------- |
|
||||
| `bk_name` | string | 市场和板块名称,多个名称以分号分隔 |
|
||||
| `end_t` | t_date_time | 截止日期 |
|
||||
|
||||
返回:array
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:取得指定日仍在运作的沪深 ETF 交易代码
|
||||
|
||||
```tsl
|
||||
return getEtfListByDate('上证ETF;深证ETF', 20200924T);
|
||||
```
|
||||
|
||||
@@ -168,6 +168,31 @@ return GetBKGoMarketByDate("SZ399102", 20201201T, 1);
|
||||
return GetBKNameToId("A股", 20201201T);
|
||||
```
|
||||
|
||||
## `getIndexAdjustDate(index_id, beg_t, end_t)`
|
||||
|
||||
声明:function
|
||||
|
||||
返回指定指数在起止日期区间内的全部调整日序列
|
||||
|
||||
<!-- tags: 金融 指数 指数情况 调整日 调仓 日期 序列 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ---------- | ---------- | -------- |
|
||||
| `index_id` | index_list | 指数代码 |
|
||||
| `beg_t` | date | 开始日期 |
|
||||
| `end_t` | date | 截止日期 |
|
||||
|
||||
返回:array
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:取得沪深 300 在 2025 年内的全部调整日
|
||||
|
||||
```tsl
|
||||
return getIndexAdjustDate('SH000300', 20250101T, 20251231T);
|
||||
// 输出:array(20250304,20250616,20250905,20251215)
|
||||
```
|
||||
|
||||
## `stock_hsgEligibleInfo(bkid, stockid)`
|
||||
|
||||
声明:function
|
||||
|
||||
@@ -1995,6 +1995,89 @@ return StockZtOrDtClose(0);
|
||||
// 输出:26.62
|
||||
```
|
||||
|
||||
## `adjustmentFactor(rate_day)`
|
||||
|
||||
声明:function
|
||||
|
||||
返回从复权基准日到系统时间的比例复权因子,与系统参数中的证券代码和系统时间相关。支持股票、ETF、LOF 和可转债;模型考虑股权分置改革的分红送股,不考虑权证。复权价格等于收盘价乘以复权因子
|
||||
|
||||
<!-- tags: 金融 行情 指定日 复权 复权因子 股票 ETF LOF 可转债 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ---------- | ----------- | ---------------------------- |
|
||||
| `rate_day` | t_date_time | 可选。复权基准日,默认上市日 |
|
||||
|
||||
返回:real
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:以上市日为基准日取得复权因子
|
||||
|
||||
```tsl
|
||||
setSysParam(pn_stock(), 'SH603117');
|
||||
setSysParam(pn_date(), 20180702T);
|
||||
return adjustmentFactor();
|
||||
// 输出:1.01472183639756
|
||||
```
|
||||
|
||||
范例02:计算以上市日为基准的复权价格
|
||||
|
||||
```tsl
|
||||
setSysParam(pn_stock(), 'SH603117');
|
||||
setSysParam(pn_date(), 20191112T);
|
||||
return simpleRoundTo(close() * adjustmentFactor(), -2);
|
||||
// 输出:5.31
|
||||
```
|
||||
|
||||
范例03:指定复权基准日
|
||||
|
||||
```tsl
|
||||
setSysParam(pn_stock(), 'SH603117');
|
||||
setSysParam(pn_date(), 20191112T);
|
||||
rate_day := 20200721T;
|
||||
return adjustmentFactor(rate_day);
|
||||
// 输出:0.98989898989899
|
||||
```
|
||||
|
||||
## `stockZtOrDtCloseOfMD(flag)`
|
||||
|
||||
声明:function
|
||||
|
||||
返回交易所提供的涨停价或跌停价,与系统参数中的证券代码和系统时间相关
|
||||
|
||||
<!-- tags: 金融 行情 指定日 涨停 跌停 涨跌停价 交易所 -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------ | ------- | -------------- |
|
||||
| `flag` | integer | 涨停或跌停标志 |
|
||||
|
||||
flag 取值
|
||||
|
||||
- `0` — 涨停
|
||||
- `1` — 跌停
|
||||
|
||||
返回:real
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:取得科创板股票上市第二天的涨停价
|
||||
|
||||
```tsl
|
||||
setSysParam(pn_stock(), 'SH688067');
|
||||
setSysParam(pn_date(), 20210622T);
|
||||
return stockZtOrDtCloseOfMD(0);
|
||||
// 输出:0
|
||||
```
|
||||
|
||||
范例02:取得深市股票的涨停价
|
||||
|
||||
```tsl
|
||||
setSysParam(pn_stock(), 'SZ000002');
|
||||
setSysParam(pn_date(), 20210622T);
|
||||
return stockZtOrDtCloseOfMD(0);
|
||||
// 输出:26.62
|
||||
```
|
||||
|
||||
## `zlToFuturesId(zlid, end_t)`
|
||||
|
||||
声明:function
|
||||
|
||||
Reference in New Issue
Block a user