Files
playbook/docs/tsl/codegen/dotnet/bond/basic_info.md
T

375 lines
9.3 KiB
Markdown

# 债券 / 基本信息
## `bd_ActualIssueAmount()`
实际发行总额(元),与系统证券pn_stock()有关。
返回:float
## `bd_CouponRate()`
票面利率(%/年),与系统证券pn_stock()有关。
返回:float
## `bd_CouponType()`
息票品种,与系统股票pn_stock()有关。
返回:string
## `bd_CouponTypeOfLido(bond_id)`
息票品种。专用函数,仅个别Lido数据用户适用。
| 参数 | 类型 | 说明 |
| --------- | ------ | ------------------ |
| `bond_id` | string | 证券类型,债券代码 |
返回:string
## `bd_DatedDate()`
计息日,与系统证券pn_stock()有关。
返回:datetime
## `bd_ExpireDate()`
摘牌日,即获取债券的到期日。与系统证券pn_stock()有关。
返回:datetime
## `bd_GoalDate()`
到期日,与系统证券pn_stock()有关。
返回:datetime
## `bd_IfInDuration(bond_id, end_t)`
判断债券是否在存续期
| 参数 | 类型 | 说明 |
| --------- | -------- | -------------- |
| `bond_id` | string | 证券, 债券代码 |
| `end_t` | datetime | 日期,截止日 |
返回:bool
## `bd_InterestRateType()`
附息利率品种,与系统证券pn_stock()有关。
返回:string
## `bd_InterestRateTypeData()`
补充的附息利率品种数据。专用函数,仅个别Lido数据用户适用
返回:array
## `bd_InterestRateTypeOfLido(bond_id)`
附息利率品种。专用函数,仅个别Lido数据用户适用
| 参数 | 类型 | 说明 |
| --------- | ------ | ---------- |
| `bond_id` | string | 字符串类型 |
返回:string
## `bd_ListDate()`
上市日,与系统证券pn_stock()有关。
返回:any
## `bd_Maturity()`
偿还期限(年),与系统证券pn_stock()有关。
返回:float
## `bd_PayTimes()`
付息频率(次/年),与系统证券pn_stock()有关。
返回:any
## `bd_PayTimesData()`
补充的付息频率数据。专用函数,仅个别Lido数据用户适用
返回:array
## `bd_PayTimesOfLido(bond_id)`
付息频率,专用函数,仅个别Lido数据用户适用。
| 参数 | 类型 | 说明 |
| --------- | ------ | ---------- |
| `bond_id` | string | 字符串类型 |
返回:any
## `bd_Shares()`
债券流通股,与系统证券pn_stock()有关。
返回:float
## `bondExtraDataExist(t, bond_id)`
判断BondId是否在数据表t中。如果存在,则返回BondId在表t中的行下标;如果不存在,则返回-1。
| 参数 | 类型 | 说明 |
| --------- | ------ | ---------- |
| `t` | array | 数据表类型 |
| `bond_id` | string | 证券类型 |
返回:int
## `bondInterBankIds2()`
所有的银行间债券(包含退市)。
返回:array
## `bondRatingByEndt(endt)`
指定日最新债券评级,与系统参数(证券代码)相关。
| 参数 | 类型 | 说明 |
| ------ | -------- | ------------ |
| `endt` | datetime | 日期。截止日 |
返回:string
### 示例
```tsl
setsysparam(pn_stock(),'SH110073');
return BondRatingByEndt(20240819T);
```
## `bondRatingByEndtByInstitution(endt, institution)`
指定日指定评级机构的债券评级,与系统参数(证券代码)相关。如果无该评级机构的评级,则返回""。
| 参数 | 类型 | 说明 |
| ------------- | -------- | -------------------- |
| `endt` | datetime | 日期。截止日 |
| `institution` | string | 字符串。评级机构名称 |
返回:string
### 示例
```tsl
setsysparam(pn_stock(),'SH110073');
return BondRatingByEndtByInstitution(20240819T,"联合评级");
```
## `isBankBond(stock_id)`
是否银行间债券。如果是,返回1,否则返回0 用stocktype(stockid)函数进行判断,type=18表示是银行间债券。
| 参数 | 类型 | 说明 |
| ---------- | ------ | ---------------- |
| `stock_id` | string | 字符串,证券代码 |
返回:bool
## `isConvertibleBond(bond_id)`
判断BondId是否为可转债,与系统证券pn_stock()有关。
| 参数 | 类型 | 说明 |
| --------- | ------ | -------------------- |
| `bond_id` | string | 证券类型,可转债代码 |
返回:bool
## `isCorporationBond(stock_id)`
判断StockID是否是企业债券,与系统证券pn_stock()有关。
| 参数 | 类型 | 说明 |
| ---------- | ------ | ---------------------- |
| `stock_id` | String | 证券类型,企业债券代码 |
返回:Boolean
### 示例
```tsl
//判断 97国电债是否是企业债券
return isCorporationBond('SH129801');
//结果:1
```
## `isBond(stock_id)`
判断StockID是否是债券,与系统证券pn_stock()有关。
| 参数 | 类型 | 说明 |
| ---------- | ------ | -------- |
| `stock_id` | String | 证券类型 |
返回:Boolean
### 示例
```tsl
//返回” SH110003”是否是债券
return isBond("SH110003");
//结果:1
```
## `isGovBond(stock_id)`
判断StockID是否是国债,与系统证券pn_stock()有关。
| 参数 | 类型 | 说明 |
| ---------- | ------ | ------------------ |
| `stock_id` | String | 证券类型,国债代码 |
返回:Boolean
### 示例
```tsl
//返回” BK000201”是否是国债
return isGovBond("BK000201");
//结果:0
```
## `bondConvertibleBonds2()`
所有的可转债。
返回:Array
### 示例
```tsl
// 所有的可转债
return bondConvertibleBonds2();
```
## `bondFutureCtdByEndt(end_t, return_option, market_id, dbtype)`
国债期货品种对应的指定日最便宜交割券,与系统证券代码相关。
| 参数 | 类型 | 说明 |
| --------------- | ---------- | ----------------------------- |
| `end_t` | Date | 日期,截止日 |
| `return_option` | UserDefine | 用户自定义, 返回结果选项 |
| `market_id` | UserDefine | 用户自定义, 国债市场选项 |
| `dbtype` | UserDefine | 用户自定义, 国债估值数据来源: |
返回:String
### 示例
```tsl
//获得TF1809在20180913对应的IRR最便宜交割券
setSysParam(pn_Stock(),"TF1809");
endt:=20180819T;
return bondFutureCtdByEndt(endt,0,1,0);
//结果:SH019542
```
## `bondFutureBasicFunc(end_t, return_option, market_id, dbtype)`
国债期货品种对应的指定日基本指标函数,与系统证券代码相关。
| 参数 | 类型 | 说明 |
| --------------- | ---------- | ----------------------------- |
| `end_t` | Date | 日期,截止日 |
| `return_option` | UserDefine | 用户自定义, 返回结果选项 |
| `market_id` | UserDefine | 用户自定义, 国债市场选项 |
| `dbtype` | UserDefine | 用户自定义, 国债估值数据来源: |
返回:String
### 示例
```tsl
//获得TF1809在20180913对应的IRR所有的指标信息数据
setSysParam(pn_Stock(),"TF1809");
endt:=20180819T;
return bondFutureBasicFunc(endt,-1,1,0);
//结果:
```
## `bondFutureBondBasicValue(end_t, bond_id, return_option, market_id, dbtype)`
国债期货品种对应的单个个券指定日指标,与系统证券代码相关。
| 参数 | 类型 | 说明 |
| --------------- | ---------- | ----------------------------- |
| `end_t` | Date | 日期,截止日 |
| `bond_id` | string | 字符串,债券代码 |
| `return_option` | UserDefine | 用户自定义, 返回结果选项 |
| `market_id` | UserDefine | 用户自定义, 国债市场选项 |
| `dbtype` | UserDefine | 用户自定义, 国债估值数据来源: |
返回:Real
### 示例
```tsl
//获得TF1809在20180913对应的基差值
setSysParam(pn_Stock(),"TF1809");
endt:=20180819T;
bond_id:="SH019553";
return bondFutureBondBasicValue(endt,bond_id,0,0);
//结果:0.822400000000002
```
## `bondFutureBasicindicators(end_t, market_id, dbtype, return_option)`
国债期货指定品种代码指定日对应的基本指标数据,与证券代码相关。
| 参数 | 类型 | 说明 |
| --------------- | ---------- | ----------------------------- |
| `end_t` | Date | 日期,截止日 |
| `market_id` | UserDefine | 用户自定义, 国债市场选项 |
| `dbtype` | UserDefine | 用户自定义, 国债估值数据来源: |
| `return_option` | UserDefine | 用户自定义, 返回结果选项 |
返回:Array
### 示例
```tsl
setSysParam(pn_Stock(),"TF1809");
endt:=20180819T;
return bondFutureBasicindicators(endt,1,0);
```
## `bondFutureBasicindicators2(end_t, return_option, market_id, dbtype)`
国债期货指定品种代码指定日对应的基本指标数据,与证券代码相关。
| 参数 | 类型 | 说明 |
| --------------- | ---------- | ----------------------------- |
| `end_t` | Date | 日期,截止日 |
| `return_option` | UserDefine | 用户自定义, 返回结果选项 |
| `market_id` | UserDefine | 用户自定义, 国债市场选项 |
| `dbtype` | UserDefine | 用户自定义, 国债估值数据来源: |
返回:array
### 示例
```tsl
TF1809在20180819日对应的国债指标信息
setSysParam(pn_Stock(),"TF1809");
endt:=20180819T;
return bondFutureBasicindicators2(endt,-1,1,0);
//结果:
```