feat(tsl-api-reference): add class and framework API lookup

This commit is contained in:
csh
2026-08-20 13:49:55 +08:00
parent 7233646398
commit 651c1f68d2
637 changed files with 25498 additions and 36673 deletions
@@ -0,0 +1,246 @@
# 应用专题 / 债券研究 / 可转债价格分区统计
## `cb_PriceAndDeadlineData`
声明:class
统计到期可转债的价格、期限、持有收益和价格分区数据,并生成频数与透视分析结果
<!-- tags: 可转债 价格分区 期限统计 收益分析 -->
### `FBegT`
声明:field
统计开始日,默认 20060101T
可见性:`public`
类型:datetime
### `FEndT`
声明:field
统计截止日,默认 20201231T
可见性:`public`
类型:datetime
### `FPriceType`
声明:field
统计最高价和最低价时使用的价格类型;0 为收盘价,1 为当日最高价或最低价
可见性:`public`
类型:integer
### `FMRPriceArr`
声明:field
买入价格区间边界数组,默认 `array(0,90,100,110,120,130)`
可见性:`public`
类型:array
### `FMCPriceArr`
声明:field
卖出价格阈值数组,默认 `array(130,140,150,160,170)`
可见性:`public`
类型:array
### `FYearStep`
声明:field
期限频数分布步长,单位为年,默认 0.25
可见性:`public`
类型:real
### `FPriceStep`
声明:field
价格频数分布步长,单位为元,默认 10
可见性:`public`
类型:real
### `FNDay`
声明:field
持有收益率统计使用的交易日数组,默认 `array(5,10,20,30,60,120,240)`
可见性:`public`
类型:array
### `FRLTType`
声明:field
统计维度名称,默认 `median`
可见性:`public`
类型:string
### `Main()`
声明:function
依次执行类中的数据获取、统计与分析流程
可见性:`public`
返回:nil
### `GetMaturityCB(beg_t, end_t)`
声明:function
返回指定区间内有交易数据的到期可转债代码;可重写
可见性:`public`
| 参数 | 类型 | 说明 |
| ------- | -------- | ------------ |
| `beg_t` | datetime | 统计开始日期 |
| `end_t` | datetime | 统计截止日期 |
返回:array
### `DatePriceData(cb_arr, ptype)`
声明:function
返回指定可转债的期限和价格明细
可见性:`public`
| 参数 | 类型 | 说明 |
| -------- | ------- | -------------------------------- |
| `cb_arr` | array | 要统计的可转债代码数组 |
| `ptype` | integer | 最高价和最低价使用的价格类型选项 |
返回:array
### `MRtoMCData(cb_arr, mr_price_arr, mc_price_arr)`
声明:function
统计首次达到买入区间后持有至卖出阈值的期限和收益率
可见性:`public`
| 参数 | 类型 | 说明 |
| -------------- | ----- | -------------------- |
| `cb_arr` | array | 要统计的可转债代码 |
| `mr_price_arr` | array | 买入价格区间边界数组 |
| `mc_price_arr` | array | 卖出价格阈值数组 |
返回:array
### `BeforeMCData(cb_arr, mc_price_arr)`
声明:function
统计达到卖出阈值前的价格分区、持有期限和收益率
可见性:`public`
| 参数 | 类型 | 说明 |
| -------------- | ----- | ------------------ |
| `cb_arr` | array | 要统计的可转债代码 |
| `mc_price_arr` | array | 卖出价格阈值数组 |
返回:array
### `NDayRateData(cb_arr, n_arr)`
声明:function
统计可转债存续期内持有指定交易日数的收益率
可见性:`public`
| 参数 | 类型 | 说明 |
| -------- | ----- | ------------------ |
| `cb_arr` | array | 要统计的可转债代码 |
| `n_arr` | array | 持有交易日数数组 |
返回:array
### `CBondPriceDetail(beg_t, end_t)`
声明:function
返回可转债在指定期间内的日期、收盘价、最高价和最低价明细
可见性:`public`
| 参数 | 类型 | 说明 |
| ------- | -------- | ------------ |
| `beg_t` | datetime | 明细开始日期 |
| `end_t` | datetime | 明细截止日期 |
返回:array
### `PriceOrDateHis(data, step_1, option)`
声明:function
计算价格或期限数据的频数分布
可见性:`public`
| 参数 | 类型 | 说明 |
| -------- | ------- | ---------------------- |
| `data` | array | 要处理的数据 |
| `step_1` | real | 频数分布步长 |
| `option` | integer | 0 统计价格,1 统计期限 |
返回:array
### `RatePivotTable(data, ctype, option)`
声明:function
按价格区间和卖出阈值或持有天数生成收益率、持有期限统计表
可见性:`public`
| 参数 | 类型 | 说明 |
| -------- | ------- | ------------------------------------- |
| `data` | array | 要处理的数据 |
| `ctype` | string | 统计方式,例如 `median``avg` |
| `option` | integer | 0 处理持有期限和收益,1 处理 n 日收益 |
返回:array
### `GetData(option)`
声明:function
按编号返回原始价格期限、交易收益或统计分析结果
可见性:`public`
| 参数 | 类型 | 说明 |
| -------- | ------- | ---------------- |
| `option` | integer | 要返回的数据类型 |
返回:array
@@ -0,0 +1,53 @@
# 应用专题 / 债券研究
## `convertBondBacktest01(begt, endt, ini_cash, index_id, zf_limit, feerate)`
声明:function
可转债区间回测结果
<!-- tags: 转换 格式化 历史模拟 策略验证 可转债 债券 风险管理 -->
| 参数 | 类型 | 说明 |
| ---------- | -------- | ----------- |
| `begt` | datetime | 起始日 |
| `endt` | datetime | 截止日 |
| `ini_cash` | any | 初始资金 |
| `index_id` | string | 基准指数 |
| `zf_limit` | any | 涨幅阈值(%) |
| `feerate` | any | 费率(%) |
返回:array
## `convertBondWinDataByEndt(endt, zf_limit, r_option)`
声明:function
指定日有套利空间的可转债数据信息,二维数组
<!-- tags: 转换 格式化 列表 集合 可转债 债券 风险管理 -->
| 参数 | 类型 | 说明 |
| ---------- | -------- | ---------------------------------------------------- |
| `endt` | datetime | 截止日 |
| `zf_limit` | any | 涨幅阈值(%),筛选条件 |
| `r_option` | any | 融资融券选项: 0:融资融券(缺省) 1:不考虑融资融券 |
返回:array
## `convertBondWinTradeDataByEndt(endt, ini_cash, zf_limit, fee_rate)`
声明:function
指定日可转债交易数据信息,二维数组
<!-- tags: 转换 格式化 买卖 交易策略 列表 集合 可转债 债券 -->
| 参数 | 类型 | 说明 |
| ---------- | -------- | ----------- |
| `endt` | datetime | 截止日 |
| `ini_cash` | any | 初始资金 |
| `zf_limit` | any | 涨幅阈值(%) |
| `fee_rate` | any | 费率(%) |
返回:array
@@ -0,0 +1,144 @@
# 应用专题 / 债券研究 / 二叉树可转债估值
## `cb_BinaryTree`
声明:class
基于正股波动率、贴现率和可转债条款构建二叉树,计算可转债及其期权价值
<!-- tags: 可转债 二叉树 债券估值 -->
### `CBCode`
声明:field
可转债代码
可见性:`public`
类型:string
### `EndDate`
声明:field
估值截止日,也作为估值起始日
可见性:`public`
类型:datetime
### `FN`
声明:field
二叉树步数,默认 100
可见性:`public`
类型:integer
### `PriceType`
声明:field
正股初始价类型;0 表示截止日平均价,1 表示截止日收盘价
可见性:`public`
类型:integer
### `VolatilityType`
声明:field
正股波动率计算方式;-1 时通过重写 `GetVolatility` 提供,0 时使用历史波动率
可见性:`public`
类型:integer
### `NVolatility`
声明:field
历史波动率计算天数,默认 90
可见性:`public`
类型:integer
### `RateType`
声明:field
贴现率计算方式;-1 时通过重写 `GetDiscountRate` 提供,0 时使用利率结构曲线
可见性:`public`
类型:integer
### `BTSID`
声明:field
贴现率使用的利率结构曲线代码,默认采用 10 年国债利率结构曲线
可见性:`public`
类型:string
### `GetVolatility()`
声明:function
返回正股年化波动率;当 `VolatilityType=-1` 时由用户重写
可见性:`public`
返回:numeric
### `GetDiscountRate()`
声明:function
返回二叉树各期限贴现率;当 `RateType=-1` 时由用户重写
可见性:`public`
返回:array
### `CBValuation()`
声明:function
计算可转债理论价值
可见性:`public`
返回:numeric
### `CBOptionValue()`
声明:function
在完成可转债估值后返回转债期权价值
可见性:`public`
返回:numeric
## `tsFl_cb_binayTree_01(ccode, initial_date)`
声明:function
以缺省参数构造二叉树估值对象,并返回可转债估值与期权价值
<!-- tags: 可转债 二叉树 调用范例 -->
| 参数 | 类型 | 说明 |
| -------------- | -------- | ------------ |
| `ccode` | string | 可转债代码 |
| `initial_date` | datetime | 估值截止日期 |
返回:array
@@ -0,0 +1,11 @@
# 应用专题 / 债券研究
## `testValuation()`
声明:function
提供应用专题-可转债估值-基于BSM模型探究中的 `testValuation` 功能
<!-- tags: 可转债 债券 -->
返回:any
@@ -0,0 +1,273 @@
# 应用专题 / 债券研究 / CCB 可转债完全分解估值
## `cb_CompleteDecompose`
声明:class
获取可转债、正股和赎回数据,以 CCB 完全分解模型计算估值、风险指标和路径明细
<!-- tags: 可转债 CCB 完全分解 债券估值 风险指标 -->
### `FCBID`
声明:field
可转债代码,不可缺省
可见性:`public`
类型:string
### `FEndT`
声明:field
估值截止日期,不可缺省
可见性:`public`
类型:datetime
### `FStockVolatilityN`
声明:field
正股波动率计算天数,默认 90
可见性:`public`
类型:integer
### `FBenchmarkRateID`
声明:field
基准利率曲线类型;0 为中短票据,1 为公司债,2 为企业债
可见性:`public`
类型:integer
### `FCBFaceValue`
声明:field
可转债面值,默认从转债基本信息获取
可见性:`public`
类型:real
### `FCBConversionPrice`
声明:field
可转债转股价
可见性:`public`
类型:real
### `FCBRemainTerm`
声明:field
可转债剩余期限,单位为年
可见性:`public`
类型:real
### `FRiskFreeRate`
声明:field
无风险年利率,单位为百分比
可见性:`public`
类型:real
### `FStockPrice`
声明:field
可转债正股价格
可见性:`public`
类型:real
### `FStockVolatility`
声明:field
正股年化波动率,单位为百分比
可见性:`public`
类型:real
### `FCBNoRedemptionT`
声明:field
赎回保护期剩余期限,单位为年
可见性:`public`
类型:real
### `FCBRedemptionH`
声明:field
赎回线倍数,取值大于 1
可见性:`public`
类型:real
### `create()`
声明:function
初始化 CCB 完全分解对象
可见性:`public`
返回:nil
### `CompleteDecompose()`
声明:function
执行 CCB 完全分解主流程;该方法不允许重写
可见性:`public`
返回:nil
### `GetCBBaseData()`
声明:function
获取可转债面值、转股价、剩余期限和无风险利率;可重写
可见性:`public`
返回:nil
### `GetStockBaseData()`
声明:function
获取正股价格和年化波动率;可重写
可见性:`public`
返回:nil
### `GetRedemptionData()`
声明:function
获取赎回保护期和赎回线信息;可重写
可见性:`public`
返回:nil
### `CalCBValue()`
声明:function
使用 CCB 完全分解模型计算可转债估值
可见性:`public`
返回:nil
### `CalCBRiskTarget()`
声明:function
使用 CCB 完全分解模型计算风险指标
可见性:`public`
返回:nil
### `GetCBCashFlow()`
声明:function
获取包含剩余期限、本期付息和本期付本金的可转债现金流;可重写
可见性:`public`
返回:array
### `GetCBCreditSpread()`
声明:function
获取包含剩余期限和信用利差的可转债信用利差数据;可重写
可见性:`public`
返回:array
### `GetBaseData()`
声明:function
返回可转债、正股和赎回基本信息表
可见性:`public`
返回:array
### `GetRiskTarget()`
声明:function
返回 CCB 模型风险指标表
可见性:`public`
返回:array
### `GetValuationDetail()`
声明:function
返回各估值路径的明细
可见性:`public`
返回:array
## `CB_CCB(return_type)`
声明:function
根据当前系统证券和日期参数,用 CCB 模型返回可转债估值或估值详情
<!-- tags: 可转债 CCB 指标模型 -->
| 参数 | 类型 | 说明 |
| ------------- | ------- | ---------------------------- |
| `return_type` | integer | 0 返回估值,1 返回估值详情表 |
返回:real\|array
## `CB_GetRiskTarget_CCB()`
声明:function
根据当前系统证券和日期参数,用 CCB 模型计算并返回可转债风险指标
<!-- tags: 可转债 CCB 风险指标 -->
返回:array
@@ -0,0 +1,176 @@
# 应用专题 / 债券研究 / 行权概率蒙特卡洛可转债估值
## `cb_MonteCarloSimulation_Extend`
声明:class
在蒙特卡洛可转债估值基础上加入赎回、回售和下修概率规则,并提供行权路径查询
<!-- tags: 可转债 蒙特卡洛 行权概率 赎回 回售 下修 -->
父类:`cb_MonteCarloSimulation`
### `CBCode`
声明:field
可转债代码
可见性:`public`
类型:string
### `EndDate`
声明:field
估值截止日,也作为估值起始日
可见性:`public`
类型:datetime
### `FRedemptPerLimit`
声明:field
赎回概率阈值,默认 0.8
可见性:`public`
类型:real
### `FResalePerLimit`
声明:field
回售概率阈值,默认 0.3
可见性:`public`
类型:real
### `FDownReviseLimit`
声明:field
下修概率阈值,默认 0.85
可见性:`public`
类型:real
### `FFloatBL`
声明:field
下修价格浮动比率,默认 1.05
可见性:`public`
类型:real
### `FPreN`
声明:field
历史回溯天数,默认 29
可见性:`public`
类型:integer
### `FRepDelayDay`
声明:field
不赎回延期交易日数,默认 60
可见性:`public`
类型:integer
### `FSalDelayDay`
声明:field
不回售延期交易日数,默认 250
可见性:`public`
类型:integer
### `FRepInterDay`
声明:field
强赎公布到强赎处理的间隔交易日数,默认 20
可见性:`public`
类型:integer
### `FRevInterDay`
声明:field
触发下修到实际下修处理的间隔交易日数,默认 30
可见性:`public`
类型:integer
### `FSalInterDay`
声明:field
回售触发到回售开始的间隔交易日数,默认 5
可见性:`public`
类型:integer
### `MonteCarloValuation()`
声明:function
模拟含概率行权规则的正股路径,返回理论价值、上下限、波动和路径分布
可见性:`public`
返回:array
### `Get_CBExePathInfo()`
声明:function
返回各模拟路径的触发节点、行权节点、操作类型、概率、日期和价格
可见性:`public`
返回:array
### `Get_CBStockPriceMatrix()`
声明:function
返回蒙特卡洛估值生成的正股价格矩阵
可见性:`public`
返回:array
### `GetStockFeature(code, initial_date)`
声明:function
返回正股初始价格、无风险年化收益率和年化波动率
可见性:`public`
| 参数 | 类型 | 说明 |
| -------------- | -------- | ------------ |
| `code` | string | 正股代码 |
| `initial_date` | datetime | 估值截止日期 |
返回:array
@@ -0,0 +1,41 @@
# 应用专题 / 债券研究
## `cb_iv_deviation(n)`
声明:function
可转债波动率(%)估值偏离度
<!-- tags: 风险波动 可转债 债券 -->
| 参数 | 类型 | 说明 |
| ---- | ------- | --------------------------------------------------- |
| `n` | integer | 整数,历史波动率(N)计算天数,缺省时从上市日开始计算 |
返回:real
## `cb_taxYTM(end_t, o_ption, tax_rate)`
声明:function
指定日可转债税后 YTM(%)
<!-- tags: 可转债 债券 -->
| 参数 | 类型 | 说明 |
| ---------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `end_t` | datetime | 截止日 |
| `o_ption` | datetime | 该参数缺省条件下由系统参数 Pn_BondCashFlowType()决定,在发生强赎时会对到期 日和现金流产生影响 取值 名称 含义 说明 0 持有到期(公布日) 考虑强赎 若发生强赎,且当前日期在强赎公布日之后,则实际到期日为强赎 公布日;否则实际到期日为债券发行到期日 3,nil 持有到期(发行) 不考虑强 赎 无论是否发生强赎,实际到期日均为债券发行到期日(持有到期) |
| `tax_rate` | any | 税率(%),默认 20 |
返回:real
## `cb_twoLow()`
声明:function
可转债双低
<!-- tags: 可转债 债券 -->
返回:real
@@ -0,0 +1,104 @@
# 应用专题 / 债券研究 / 蒙特卡洛可转债估值
## `cb_MonteCarloSimulation`
声明:class
模拟正股未来价格和可转债行权路径,计算可转债理论价值及估值区间
<!-- tags: 可转债 蒙特卡洛 债券估值 -->
### `CBCode`
声明:field
可转债代码
可见性:`public`
类型:string
### `EndDate`
声明:field
估值截止日,也作为估值起始日
可见性:`public`
类型:datetime
### `FNode`
声明:field
每条蒙特卡洛路径的节点数,默认 200
可见性:`public`
类型:integer
### `FPath`
声明:field
蒙特卡洛模拟路径数,默认 1000
可见性:`public`
类型:integer
### `GetStockFeature(code, initial_date)`
声明:function
返回正股初始价、年化收益率和年化波动率平方;可重写以提供自定义参数
可见性:`public`
| 参数 | 类型 | 说明 |
| -------------- | -------- | ------------ |
| `code` | string | 正股代码 |
| `initial_date` | datetime | 估值截止日期 |
返回:array
### `MonteCarloValuation()`
声明:function
模拟正股路径和行权节点,并返回转债理论价值及估值区间
可见性:`public`
返回:array
## `tsFl_cb_monteCarlo_01(c_bcode, initial_date)`
声明:function
以缺省参数构造蒙特卡洛估值对象并返回估值结果
<!-- tags: 可转债 蒙特卡洛 调用范例 -->
| 参数 | 类型 | 说明 |
| -------------- | -------- | ------------ |
| `c_bcode` | string | 可转债代码 |
| `initial_date` | datetime | 估值截止日期 |
返回:array
## `tsFl_cb_monteCarlo_02(c_bcode, initial_date)`
声明:function
通过派生类重写正股参数获取方法,并返回自定义参数下的蒙特卡洛估值结果
<!-- tags: 可转债 蒙特卡洛 自定义参数 调用范例 -->
| 参数 | 类型 | 说明 |
| -------------- | -------- | ------------ |
| `c_bcode` | string | 可转债代码 |
| `initial_date` | datetime | 估值截止日期 |
返回:array
@@ -0,0 +1,11 @@
# 应用专题 / 债券研究
## `pn_bondCashFlowType()`
声明:function
债券现金流类型,影响债券现金流与到期日的计算
<!-- tags: 可转债 债券 -->
返回:string
@@ -0,0 +1,142 @@
# 应用专题 / 债券研究
## `cb_benefitBreakdownbyEquityDebt(bond_id, end_t, return_type, zf_type)`
声明:function
执行 `cb_BenefitBreakdownbyEquityDebt` 对应的模块功能
<!-- tags: 调用 可转债 债券 投资收益 -->
| 参数 | 类型 | 说明 |
| ------------- | -------- | ----------------------------------------------------- |
| `bond_id` | string | String,债券代码 |
| `end_t` | datetime | date,截止日 |
| `return_type` | array | Int,返回类型,0:一维数组(默认)1:带下标的一维数组 |
| `zf_type` | integer | Int,收益类型,0:涨幅(%)(默认)1:对数涨幅(%) |
返回:array
## `cbIndex_benefitBreakdown_multiPeriod(begt, endt, index_id, cal_type, attr_type, r_type)`
声明:function
执行 `cbIndex_BenefitBreakdown_MultiPeriod` 对应的模块功能
<!-- tags: 调用 可转债 债券 投资收益 -->
| 参数 | 类型 | 说明 |
| ----------- | -------- | ------------------------------------------------------------------------------ |
| `begt` | datetime | date,开始日 |
| `endt` | datetime | date,截止日 |
| `index_id` | string | String,指数代码 |
| `cal_type` | integer | Int,可转债分解方式,1:四维全要素分解法(默认) |
| `attr_type` | integer | Int,多期收益分解方法,0:收益贡献法(默认),1:算术几何法 |
| `r_type` | integer | Int,返回类型,-1:返回全部,0:最后一期累计(默认),1:每期累计,2:每日详情 |
返回:any
## `cbIndex_benefitBreakdown_singlePeriod(index_id, end_t, cal_type)`
声明:function
执行 `cbIndex_BenefitBreakdown_SinglePeriod` 对应的模块功能
<!-- tags: 调用 可转债 债券 投资收益 -->
| 参数 | 类型 | 说明 |
| ---------- | -------- | ------------------------------------------------ |
| `index_id` | string | String,指数代码 |
| `end_t` | datetime | date,截止日 |
| `cal_type` | integer | Int,可转债分解方式,1:四维全要素分解法(默认) |
返回:any
## `cBonds_benefitBreakdown_multiPeriod(begt, endt, t, cal_type, attr_type, r_type)`
声明:function
执行 `cBonds_BenefitBreakdown_MultiPeriod` 对应的模块功能
<!-- tags: 调用 可转债 债券 投资收益 -->
| 参数 | 类型 | 说明 |
| ----------- | -------- | -------------------------------------------------------------------------------- |
| `begt` | datetime | date,开始日 |
| `endt` | datetime | date,截止日 |
| `t` | array | Array,个券信息,包含"代码"、"比例(%)"、"截止日"列 可转债系列 12:可转债收益分解 |
| `cal_type` | integer | Int,可转债分解方式,1:四维全要素分解法(默认) |
| `attr_type` | integer | Int,多期收益分解方法,0:收益贡献法(默认),1:算术几何法 |
| `r_type` | integer | Int,返回类型,-1:返回全部,0:最后一期累计(默认),1:每期累计,2:每日详情 |
返回:any
## `cBonds_benefitBreakdown_singlePeriod(t, end_t, cal_type)`
声明:function
执行 `cBonds_BenefitBreakdown_SinglePeriod` 对应的模块功能
<!-- tags: 调用 可转债 债券 投资收益 -->
| 参数 | 类型 | 说明 |
| ---------- | -------- | ------------------------------------------------ |
| `t` | array | Array,个券信息,包含"代码"、"比例(%)"列 |
| `end_t` | datetime | date,截止日 |
| `cal_type` | integer | Int,可转债分解方式,1:四维全要素分解法(默认) |
返回:any
## `tsFl_benefitBreakdown_cbid(begt, endt, cbid, cal_type, attr_type)`
声明:function
执行 `tsfl_BenefitBreakdown_CBID` 对应的模块功能
<!-- tags: 调用 可转债 债券 投资收益 -->
| 参数 | 类型 | 说明 |
| ----------- | -------- | ----------------------------------------------------------- |
| `begt` | datetime | date,开始日 |
| `endt` | datetime | date,截止日 |
| `cbid` | string | String,代码 |
| `cal_type` | integer | Int,可转债分解方式,1:四维全要素分解法(默认) |
| `attr_type` | integer | Int,多期收益分解方法,0:收益贡献法(默认),1:算术几何法 |
返回:any
## `tsFl_benefitBreakdown_cbIndex(begt, endt, cb_index, cal_type, attr_type)`
声明:function
执行 `tsfl_BenefitBreakdown_CBIndex` 对应的模块功能
<!-- tags: 调用 可转债 债券 投资收益 -->
| 参数 | 类型 | 说明 |
| ----------- | -------- | ----------------------------------------------------------- |
| `begt` | datetime | date,开始日 |
| `endt` | datetime | date,截止日 |
| `cb_index` | string | String,代码 |
| `cal_type` | integer | Int,可转债分解方式,1:四维全要素分解法(默认) |
| `attr_type` | integer | Int,多期收益分解方法,0:收益贡献法(默认),1:算术几何法 |
返回:any
## `tsFl_benefitBreakdown_cBonds(begt, endt, t, cal_type, attr_type)`
声明:function
执行 `tsfl_BenefitBreakdown_CBonds` 对应的模块功能
<!-- tags: 调用 可转债 债券 投资收益 -->
| 参数 | 类型 | 说明 |
| ----------- | -------- | ----------------------------------------------------------- |
| `begt` | datetime | date,开始日 |
| `endt` | datetime | date,截止日 |
| `t` | array | Array,个券信息,包含"代码"、"比例(%)"、"截止日"列 |
| `cal_type` | integer | Int,可转债分解方式,1:四维全要素分解法(默认) |
| `attr_type` | integer | Int,多期收益分解方法,0:收益贡献法(默认),1:算术几何法 |
返回:any
@@ -0,0 +1,35 @@
# 应用专题 / 债券研究
## `getBondHQCashFlow(cash_flow, h_qinfo, period)`
声明:function
含权现金流--底层函数
<!-- tags: 查询 债券 投资收益 -->
| 参数 | 类型 | 说明 |
| ----------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `cash_flow` | array | 债券现金流,必须包含以下字段: 字段 类型 含义 计息起始日 Tdatetime 付息开始日期 付息日 Tdatetime 付息日期 本期付息 Float 付息数据 本期付本金 Float 兑付本金 现金流 Float |
| `h_qinfo` | array | 含权信息数据,必须包含以下数据 字段 类型 含义 行权类型 String 期权的类型 行权日期 Integer 执行期权的时间 行权价格 Float 执行期权的价格,包含利息 |
| `period` | integer | 付息频率 |
返回:array
## `pf_evaluteBondDirtyPrice(endt, cash_flow, period, rates, method)`
声明:function
指定日债券估值全价—底层函数
<!-- tags: 投资组合 资产组合 价格数据 行情 债券 投资收益 -->
| 参数 | 类型 | 说明 |
| ----------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `endt` | datetime | 指定日期 |
| `cash_flow` | array | 债券指定日未来现金流(持有到期或行权),至少包含如下字段 字段 类型 含义 计息起始日 TdateTime 付息开始周期 付息日 Tdatetime 付息日 现金流 Float 付息+付本金 |
| `period` | integer | 付息频率 |
| `rates` | array | 利率数据,至少包含如下字段: 字段 类型 含义 期限 Float 年限 利率(%) Float 年限对应的利率(%)数据 |
| `method` | string | 插值方法,取值如下: "nearest":临近插值法 "linear" 线性插值法 "Spline" 样条插值法(缺省) "pchip" 分段三次 hermite 插值 |
返回:any
@@ -0,0 +1,16 @@
# 应用专题 / 债券研究
## `getBondTermStructure(type, t)`
声明:function
提取收益率曲线数据
<!-- tags: 查询 回报率 投资收益 债券 -->
| 参数 | 类型 | 说明 |
| ------ | ------- | -------------------------------------- |
| `type` | integer | 控制计算方法、数据口径或返回格式的选项 |
| `t` | array | 收益率曲线返回结果 |
返回:boolean