📝 docs(tsl): complete and lint codegen reference
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 债券 / 债券敏感性指标
|
||||
|
||||
### `bondBasisPointValue(settlement_date, market_value, option)`
|
||||
## `bondBasisPointValue(settlement_date, market_value, option)`
|
||||
|
||||
指定日期的债券基点价值 久期的另外一个理解:当到期收益率变化100个bps的时候,久期大致等于债券价格的百分比变化。假设:久期=7.2,表示当到期收益率变化100个bps的时候,债券价格大致变化7.2%。 基点价值,是指利率变动一个基点(1bps)债券价格的变动情况。即:指到期收益率每变化一个基点时引起的债券价格的绝对变动额,也就是0.01个百分点(1个bps)时,债券价格的变动值 其中: Duration:债券Macauley久期 MV: 债券市值 要说明的是:此方法是一种近似算法。稍微准确点算法,应该是按照债券久期计算方法: 按照债券全价PV0、票面利率、剩余期限等,计算债券到期收益率y 假设y+0.01%,计算债券全价PV+和债券价格变动 假设y-0.01%,计算债券全价PV-和债券价格变动 一般而言,当y+/-0.01%时,债券的全价变化不大,且。近似可取 按照基点价值的定义
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
返回:float
|
||||
|
||||
#### 示例
|
||||
### 示例
|
||||
|
||||
```tsl
|
||||
债券SH010107在指定日2018/4/8持有10000市值的基点价值-持有到期
|
||||
@@ -22,7 +22,7 @@ MV:=10000;
|
||||
Return BondBasisPointValue(Endt,MV); //返回3.05
|
||||
```
|
||||
|
||||
### `bondConvexity(settlement_date, option)`
|
||||
## `bondConvexity(settlement_date, option)`
|
||||
|
||||
指定日债券的凸性。在不设置数据供应商的情况下,默认先调用中证数据,没有值时再调用TS算法处理。若直接调用TS算法,设置供应商pn\_ bonddataprovider()为2.
|
||||
|
||||
@@ -33,7 +33,7 @@ Return BondBasisPointValue(Endt,MV); //返回3.05
|
||||
|
||||
返回:float
|
||||
|
||||
#### 示例
|
||||
### 示例
|
||||
|
||||
```tsl
|
||||
债券SH010107在2018/4/8的凸性
|
||||
@@ -43,7 +43,7 @@ Endt:=20180408T;
|
||||
Return BondConvexity(Endt);//持有到期凸性 返回12.23
|
||||
```
|
||||
|
||||
### `bondConvexity1(settlementdate, cashflow, y)`
|
||||
## `bondConvexity1(settlementdate, cashflow, y)`
|
||||
|
||||
最后付息周期、到期一次还本付息、零息债券的凸性指标
|
||||
|
||||
@@ -55,7 +55,7 @@ Return BondConvexity(Endt);//持有到期凸性 返回12.23
|
||||
|
||||
返回:float
|
||||
|
||||
### `bondConvexity2(endt, cash_f_low, pv, f, y)`
|
||||
## `bondConvexity2(endt, cash_f_low, pv, f, y)`
|
||||
|
||||
规则付息且非最后付息周期债券的凸性底层算法函数
|
||||
|
||||
@@ -69,7 +69,7 @@ Return BondConvexity(Endt);//持有到期凸性 返回12.23
|
||||
|
||||
返回:float
|
||||
|
||||
### `bondConvexity2Sub(pv, c, f, y, d, n, m, ts)`
|
||||
## `BondConvexity2_sub(pv, c, f, y, d, n, m, ts)`
|
||||
|
||||
凸性(不处于最后付息周期的定期付息债),与系统证券pn_stock()有关。
|
||||
|
||||
@@ -86,7 +86,7 @@ Return BondConvexity(Endt);//持有到期凸性 返回12.23
|
||||
|
||||
返回:float
|
||||
|
||||
### `bondConvexity3(settlementdate, cash_flow, pv, y)`
|
||||
## `bondConvexity3(settlementdate, cash_flow, pv, y)`
|
||||
|
||||
凸性(不处于最后付息周期的定期付息债)
|
||||
|
||||
@@ -99,7 +99,7 @@ Return BondConvexity(Endt);//持有到期凸性 返回12.23
|
||||
|
||||
返回:float
|
||||
|
||||
### `bondMacaulayDuration1(settlement_date)`
|
||||
## `bondMacaulayDuration1(settlement_date)`
|
||||
|
||||
到期一次还本付息、零息或者最后付息周期的麦考利久期
|
||||
|
||||
@@ -109,7 +109,7 @@ Return BondConvexity(Endt);//持有到期凸性 返回12.23
|
||||
|
||||
返回:float
|
||||
|
||||
### `bondModifiedConvexity(settlement_date, option)`
|
||||
## `bondModifiedConvexity(settlement_date, option)`
|
||||
|
||||
修正凸性,和BondConvexity处理一样,很多函数调用当前这个函数接口,所以保存两个凸性函数。 类似于修正久期计算方法,修正凸性 其中: f: 年付息频率 y : 到期收益率 :凸性
|
||||
|
||||
@@ -120,7 +120,7 @@ Return BondConvexity(Endt);//持有到期凸性 返回12.23
|
||||
|
||||
返回:float
|
||||
|
||||
### `bondModifiedDuration(settlementdate, option)`
|
||||
## `bondModifiedDuration(settlementdate, option)`
|
||||
|
||||
指定日债券的修正久期。在不设置数据供应商的情况下,默认先调用中证数据,没有值时再调用TS算法处理。若直接调用TS算法,设置供应商pn\_ bonddataprovider()为2。
|
||||
|
||||
@@ -131,7 +131,7 @@ Return BondConvexity(Endt);//持有到期凸性 返回12.23
|
||||
|
||||
返回:float
|
||||
|
||||
#### 示例
|
||||
### 示例
|
||||
|
||||
```tsl
|
||||
债券SH010107在2018/4/8的修正久期
|
||||
@@ -141,18 +141,18 @@ Endt:=20180408T;
|
||||
Return BondModifiedDuration(Endt,0);// 返回:3.05
|
||||
```
|
||||
|
||||
### `bondMacaulayDuration(settlement_date, option)`
|
||||
## `bondMacaulayDuration(settlement_date, option)`
|
||||
|
||||
债券麦克劳林久期
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `settlement_date` | TdateTime | 指定日 |
|
||||
| `option` | Int | 是否行权 |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ----------------- | --------- | -------- |
|
||||
| `settlement_date` | TdateTime | 指定日 |
|
||||
| `option` | Int | 是否行权 |
|
||||
|
||||
返回:Real
|
||||
|
||||
#### 示例
|
||||
### 示例
|
||||
|
||||
```tsl
|
||||
获得债券SH010107在2018/4/4的麦考利久期
|
||||
@@ -162,27 +162,27 @@ endt:=20180404T;
|
||||
return bondMacaulayDuration(endt);//麦考利久期,返回3.12
|
||||
```
|
||||
|
||||
### `bondMacaulayDuration2(settlement_date)`
|
||||
## `bondMacaulayDuration2(settlement_date)`
|
||||
|
||||
付息周期规则且非最后周期付息周期的债券的麦考利久期中间函数。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ----------------- | --------- | -------- |
|
||||
| `settlement_date` | TdateTime | 结算日期 |
|
||||
|
||||
返回:Real
|
||||
|
||||
### `finalPayinterestPeriod(settlement_date)`
|
||||
## `finalPayinterestPeriod(settlement_date)`
|
||||
|
||||
判断当前证券是否是最后付息周期的定期付息债或到期一次还本付息债券或零息债券,与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ----------------- | --------- | ---------------- |
|
||||
| `settlement_date` | TDateTime | 日期类型,结算日 |
|
||||
|
||||
返回:Integer
|
||||
|
||||
#### 示例
|
||||
### 示例
|
||||
|
||||
```tsl
|
||||
//返回“BK000000”在2012年7月3日是否是最后付息周期的定期付息债或到期一次还本付息债券或零息债券
|
||||
@@ -191,15 +191,15 @@ return finalPayinterestPeriod(20120703T);
|
||||
//结果:1
|
||||
```
|
||||
|
||||
### `bondMacaulayDuration3(settlementdate, cash_flow, pv, y)`
|
||||
## `bondMacaulayDuration3(settlementdate, cash_flow, pv, y)`
|
||||
|
||||
麦克劳林久期(不处于最后付息周期的定期付息债)_不规则现金流
|
||||
麦克劳林久期(不处于最后付息周期的定期付息债)\_不规则现金流
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `settlementdate` | TDateTime | 日期。指定日期 |
|
||||
| `cash_flow` | Array | 数组。现金流 |
|
||||
| `pv` | Real | 实数。债券全价 |
|
||||
| `y` | Real | 实数。到期收益率 |
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ---------------- | --------- | ---------------- |
|
||||
| `settlementdate` | TDateTime | 日期。指定日期 |
|
||||
| `cash_flow` | Array | 数组。现金流 |
|
||||
| `pv` | Real | 实数。债券全价 |
|
||||
| `y` | Real | 实数。到期收益率 |
|
||||
|
||||
返回:Real
|
||||
|
||||
Reference in New Issue
Block a user