Files
playbook/docs/tsl/codegen/dotnet/bond/yield_curve.md
T
csh b6160676b4 ♻️ refactor(tsl): rebuild codegen taxonomy
Move generated builtin and dotnet function docs into the upgraded taxonomy, remove legacy route pages, and regenerate function_index.tsv from markdown headings.
2026-07-07 16:36:08 +08:00

169 lines
5.5 KiB
Markdown

# 债券 / 债券收益率曲线
### `bondTermStructure(end_t)`
指定日债券收益率曲线数据,与系统参数(证券代码)相关。
| 参数 | 类型 | 说明 |
| ------- | -------- | ------------- |
| `end_t` | datetime | 日期,截止日期 |
返回:array
#### 示例
```tsl
获取BTS000033(中证指数国债收益率曲线)在2017-03-01的期限结构
setsysparam(pn_stock(),'BTS000033');
return BondTermStructure(20170301T);
```
### `bondTermStructureOfForwardRate(end_t, remain_duration)`
指定日指定期限的远期利率,与系统参数(证券代码)相关。
| 参数 | 类型 | 说明 |
| ----------------- | -------- | ----------------- |
| `end_t` | datetime | 日期,截止日期 |
| `remain_duration` | float | 实数,剩余期限(年) |
返回:float
#### 示例
```tsl
获取BTS000033(中证指数国债收益率曲线)在2017-03-01的10年期即期利率
setsysparam(pn_stock(),'BTS000033');
return BondTermStructureOfForwardRate(20170301T,10);
```
### `bondTermStructureOfForwardRateCurve(beg_t, end_t, remain_duration)`
指定剩余期限的远期利率曲线,与系统参数(证券代码)相关。
| 参数 | 类型 | 说明 |
| ----------------- | -------- | ----------------- |
| `beg_t` | datetime | 日期,开始日期 |
| `end_t` | datetime | 日期,截止日期 |
| `remain_duration` | float | 实数,剩余期限(年) |
返回:float
### `bondTermStructureOfForwardRateEndT(end_t)`
指定日的远期利率的期限结构,与系统参数(证券代码)相关。
| 参数 | 类型 | 说明 |
| ------- | -------- | ------------- |
| `end_t` | datetime | 日期,截止日期 |
返回:float
### `bondTermStructureOfSpotInterestRateEndT(end_t)`
指定日的即期利率的期限结构,与系统参数(证券代码)相关。
| 参数 | 类型 | 说明 |
| ------- | -------- | ------------- |
| `end_t` | datetime | 日期,截止日期 |
返回:float
### `bondTermStructureOfYieldToMaturity(end_t, remain_duration)`
指定日指定期限的到期收益率,与系统参数(证券代码)相关。
| 参数 | 类型 | 说明 |
| ----------------- | -------- | ----------------- |
| `end_t` | datetime | 日期,截止日期 |
| `remain_duration` | float | 实数,剩余期限(年) |
返回:float
#### 示例
```tsl
获取BTS000033(中证指数国债收益率曲线)在2017-03-01的10年期到期收益率
setsysparam(pn_stock(),'BTS000033');
return BondTermStructureOfYieldToMaturity(20170301T,10);
```
### `bondTermStructureOfYieldToMaturityEndT(end_t)`
指定日的到期收益率的期限结构,与系统参数(证券代码)相关。
| 参数 | 类型 | 说明 |
| ------- | -------- | ------------- |
| `end_t` | datetime | 日期,截止日期 |
返回:float
### `getBondSylqkByTypeAndYears(begt, endt, ayear, p_bond_id)`
区间债券对应年期的到期收益率。
| 参数 | 类型 | 说明 |
| ----------- | -------- | -------------------- |
| `begt` | datetime | 日期。起始日期 |
| `endt` | datetime | 日期。截止日期 |
| `ayear` | float | 实数。年限 |
| `p_bond_id` | string | 字符串。债券种类代码 |
返回:array
### `getBondTermStructure(_type, t, kyear_up, kyear_down, days)`
指定日债券收益率曲线数据,与系统股票相关。
| 参数 | 类型 | 说明 |
| ------------ | ----- | ---------------------------------------------------------------------------- |
| `_type` | int | 用户自定义,收益率曲线类型,其取值如下: |
| `t` | array | 数据表类型,返回参数,债券收益率数据 |
| `kyear_up` | float | 可选参数,指定期限上界 |
| `kyear_down` | array | 可选参数,指定期限下界 |
| `days` | float | 一维日期数组,可选参数,当指定时,则支持取多日数据,否则取当前时间日期的数据 |
返回:bool
#### 示例
```tsl
setsysparam(pn_stock(),"BTS000033");
setsysparam(pn_date(), 20200916T);//当前时间,指定日
r:= GetBondTermStructure(1,t);
if r then return t;
else return "提取失败";
return t;
```
### `getBondTermStructureByRemainDuration(_type, remain_duration)`
指定日指定剩余期限债券收益率数据,与系统股票相关。
| 参数 | 类型 | 说明 |
| ----------------- | ----- | --------------------------------------- |
| `_type` | int | 用户自定义,收益率曲线类型,其取值如下: |
| `remain_duration` | float | 实数,剩余期限(年) |
返回:float
### `bondTermStructureOfSpotInterestRate(end_t, remain_duration)`
指定日指定期限的即期利率,与系统参数(证券代码)相关。
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| `end_t` | TDateTime | 日期,截止日期 |
| `remain_duration` | Real | 实数,剩余期限(年) |
返回:real
#### 示例
```tsl
获取BTS000033(中证指数国债收益率曲线)在2017-03-01的10年期即期利率
setSysParam(pn_stock(),'BTS000033');
return bondTermStructureOfSpotInterestRate(20170301T,10);
//返回:3.36
```