♻️ 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.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
# 衍生品 / 创设
|
||||
|
||||
### `warrantCCirculation1(beg_t, end_t)`
|
||||
|
||||
区间创设规模(万),与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | -------- | ------------ |
|
||||
| `beg_t` | datetime | 日期,开始日 |
|
||||
| `end_t` | datetime | 日期,截止日 |
|
||||
|
||||
返回:float
|
||||
|
||||
### `warrantCCirculation2(beg_t, end_t)`
|
||||
|
||||
区间创设剩余规模(万),与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | -------- | ------------ |
|
||||
| `beg_t` | datetime | 日期,开始日 |
|
||||
| `end_t` | datetime | 日期,截止日 |
|
||||
|
||||
返回:float
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
# 衍生品 / 行权变动
|
||||
|
||||
### `warrantECirculation(end_t)`
|
||||
|
||||
指定日权证规模(万),若股票类型为权证,则将表402(权证.权证行权变动)按生效日逆序排列,提取当生效日小于等于截止日时的第一条记录的权证规模/10000;若股票类型不为权证,则返回0,与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | -------- | ------------------ |
|
||||
| `end_t` | datetime | 日期类型,截止日期 |
|
||||
|
||||
返回:float
|
||||
|
||||
### `warrantEPrice(end_t)`
|
||||
|
||||
指定日行权价,若股票类型为权证,则将表402(权证.权证行权变动)按生效日逆序排列,提取当生效日小于等于截止日时的第一条记录的行权价;若股票类型不为权证,则返回0,与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | -------- | ------------------ |
|
||||
| `end_t` | datetime | 日期类型,截止日期 |
|
||||
|
||||
返回:float
|
||||
|
||||
### `warrantERate(end_t)`
|
||||
|
||||
指定日行权比例,当股票类型为权证,则将表402(权证.权证行权变动)按生效日逆序排列,提取当生效日小于等于截止日时的第一条记录的行权比例;若股票类型不为权证,则返回0,与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | -------- | ---- |
|
||||
| `end_t` | datetime | |
|
||||
|
||||
返回:float
|
||||
|
||||
### `warrantExerciseQk(end_t, beg_t)`
|
||||
|
||||
区间行权变动,将表402(权证.权证行权变动)按生效日逆序排列,当生效日等于开始日且小于等于截止日,且变更原因不为权证创设时,从表中提取股票代码、名称、信息发布日、生效日、权证规模(万)、行权价、行权比例和变更原因,与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | -------- | ------------------ |
|
||||
| `end_t` | datetime | 日期类型,截止日期 |
|
||||
| `beg_t` | datetime | 日期类型,开始日期 |
|
||||
|
||||
返回:float
|
||||
|
||||
### `optionEsiExerciseAmount(end_t, datatype)`
|
||||
|
||||
指定日行权数量,与系统参数(证券代码)相关。如果指定日有行权交收信息,返回指定日期认购/认沽行权数量;如果指定日没有行权交收信息,返回0。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `end_t` | TDateTime | 日期。截止日期 |
|
||||
| `datatype` | Integer | 用户自定义。取值如下: |
|
||||
|
||||
返回:Real
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
setSysParam(PN_Stock(),'SH510050');
|
||||
return optionEsiExerciseAmount(20231227T,0);
|
||||
//结果:20893
|
||||
```
|
||||
|
||||
### `optionEsiGetdata(stock_id, end_t)`
|
||||
|
||||
指定日的行权交收信息。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `stock_id` | String | 字符串。股票代码 |
|
||||
| `end_t` | TDateTime | 日期。截止日期 |
|
||||
|
||||
返回:Array
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
return optionEsiGetdata('SH510050',20231227T);
|
||||
结果:
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
# 衍生品
|
||||
|
||||
函数数:243
|
||||
|
||||
| 叶子 | 文件 | 函数数 |
|
||||
| --- | --- | ---: |
|
||||
| 衍生品 / 基本信息 | [衍生品 / 基本信息](basic_info.md) | 218 |
|
||||
| 衍生品 / 创设 | [衍生品 / 创设](creation.md) | 2 |
|
||||
| 衍生品 / 行权变动 | [衍生品 / 行权变动](exercise.md) | 6 |
|
||||
| 衍生品 / 定价 | [衍生品 / 定价](pricing.md) | 17 |
|
||||
@@ -0,0 +1,247 @@
|
||||
# 衍生品 / 定价
|
||||
|
||||
### `warrantBenchClose(endt)`
|
||||
|
||||
标的收盘价,与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------ | -------- | ------ |
|
||||
| `endt` | datetime | 指定日 |
|
||||
|
||||
返回:float
|
||||
|
||||
### `warrantBenchId()`
|
||||
|
||||
标的代码。
|
||||
|
||||
返回:string
|
||||
|
||||
### `warrantBenchVolatility(endt)`
|
||||
|
||||
标的证券年波动率(%),标的证券去年到今年截止日(刚好一年)的指定日波动率(%),周期为日线。与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------ | -------- | ------ |
|
||||
| `endt` | datetime | 指定日 |
|
||||
|
||||
返回:float
|
||||
|
||||
### `warrantDurationMonth(end_t)`
|
||||
|
||||
剩余存续期限(月),即当前日与行权截止日之间相距的月数。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | -------- | ------------------ |
|
||||
| `end_t` | datetime | 日期类型,截止日期 |
|
||||
|
||||
返回:float
|
||||
|
||||
### `warrantGearing(end_t)`
|
||||
|
||||
杠杆倍数,标的证券价格/(权证价格/行权比例),与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | -------- | ------------ |
|
||||
| `end_t` | datetime | 日期,截止日 |
|
||||
|
||||
返回:float
|
||||
|
||||
### `warrantNzjz(end_t)`
|
||||
|
||||
内在价值,与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | -------- | ------------------ |
|
||||
| `end_t` | datetime | 日期类型,截止日期 |
|
||||
|
||||
返回:float
|
||||
|
||||
### `warrantOptionTypeByBs(v1, v2)`
|
||||
|
||||
B-S理论价值,若v1为认购,则返回0,若v2为认沽,则返回1。与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ---- | ---- | ---- |
|
||||
| `v1` | any | |
|
||||
| `v2` | any | |
|
||||
|
||||
返回:bool
|
||||
|
||||
### `warrantPriceByBs(end_t)`
|
||||
|
||||
B-S理论价值,若权证性质为认购,则返回0,若权证性质为认沽,则返回1。与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | -------- | ------------ |
|
||||
| `end_t` | datetime | 日期,截止日 |
|
||||
|
||||
返回:bool
|
||||
|
||||
### `warrantSjjz(end_t)`
|
||||
|
||||
时间价值,即权证价格 - 内在价值,与系统证券pn_stock()有关。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | -------- | ------------------ |
|
||||
| `end_t` | datetime | 日期类型,截止日期 |
|
||||
|
||||
返回:float
|
||||
|
||||
### `warrantYhbdl(end_t, rf)`
|
||||
|
||||
隐含波动率(%),利用权证性质认沽、标的收盘、权证行权价、无风险收益率(%)、权证现价和剩余存续期限来求出隐含波动率(%)。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | -------- | ----------------- |
|
||||
| `end_t` | datetime | 日期,截止日期 |
|
||||
| `rf` | float | 无风险收益率(%) |
|
||||
|
||||
返回:float
|
||||
|
||||
### `warrantYjl(end_t)`
|
||||
|
||||
溢价率(%),
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| ------- | -------- | ------------------ |
|
||||
| `end_t` | datetime | 日期类型,截止日期 |
|
||||
|
||||
返回:float
|
||||
|
||||
### `warrantDurationDay(end_t)`
|
||||
|
||||
剩余存续期限(天),即当前日与行权截止日之间相距的天数。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `end_t` | DateTime | 日期类型,截止日期 |
|
||||
|
||||
返回:Real
|
||||
|
||||
### `optionBlackScholesPrice2(contract_type, option_type, s, x, r, std, t, rf)`
|
||||
|
||||
依据BS定价模型计算期权的价值
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `contract_type` | UserDefine | 用户自定义,期权品种类型 |
|
||||
| `option_type` | UserDefine | 用户自定义,期权类型 |
|
||||
| `s` | Real | 标的现价,实数类型 |
|
||||
| `x` | Real | 期权的行权价,实数类型 |
|
||||
| `r` | Real | 无风险年利率(%),实数类型 |
|
||||
| `std` | Real | 年化波动率(%),实数类型 |
|
||||
| `t` | Real | 剩余存续期(月),到期权到期日前的剩余的有效期限,实数类型 |
|
||||
| `rf` | Real | 标的年化股息率(%),实数类型 |
|
||||
|
||||
返回:Real
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
//依据BS定价模型计算期权的价值
|
||||
return optionBlackScholesPrice2(0,0,9,10,5,20,12,0);
|
||||
//0.509121755321823
|
||||
```
|
||||
|
||||
### `optionImpliedVolatilitylu2(contract_type, option_type, s, x, r, close, t, rf, lb, ub)`
|
||||
|
||||
由期权交易价格依据BS定价模型倒推出的隐含波动率(%),采用二分法优化
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `contract_type` | UserDefine | 用户自定义,期权品种类型 |
|
||||
| `option_type` | UserDefine | 用户自定义,期权类型 |
|
||||
| `s` | Real | 标的现价,实数类型 |
|
||||
| `x` | Real | 期权的行权价,实数类型 |
|
||||
| `r` | Real | 无风险年利率(%),实数类型 |
|
||||
| `close` | Real | 期权交易价格,实数类型 |
|
||||
| `t` | Real | 剩余存续期(月),到期权到期日前的剩余的有效期限,实数类型 |
|
||||
| `rf` | Real | 标的年化股息率(%),实数类型 |
|
||||
| `lb` | Real | 二分法求解的下界(%),实数类型 |
|
||||
| `ub` | Real | 二分法求解的上界(%),实数类型 |
|
||||
|
||||
返回:Real
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
//计算股票期权的隐含波动率
|
||||
return optionImpliedVolatilitylu2(0,0,9,11,2,2,36,0,0,100);
|
||||
//40.0842725685217
|
||||
```
|
||||
|
||||
### `optionImpliedVolatility2(contract_type, option_type, s, x, r, close, t, rf)`
|
||||
|
||||
返回期权的隐含波动率
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `contract_type` | Integer | 用户自定义,期权品种类型 |
|
||||
| `option_type` | Integer | 用户自定义,期权类型 |
|
||||
| `s` | Real | 标的现价,实数类型 |
|
||||
| `x` | Real | 期权的行权价,实数类型 |
|
||||
| `r` | Real | 无风险年利率(%),实数类型 |
|
||||
| `close` | Real | 期权交易价格,实数类型 |
|
||||
| `t` | Real | 剩余存续期(月),到期权到期日前的剩余的有效期限,实数类型 |
|
||||
| `rf` | Real | 标的年化股息率(%),实数类型 |
|
||||
|
||||
返回:Real
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
//依据BS定价模型计算隐含波动率
|
||||
return optionImpliedVolatility2(0,0,9,11,2,2,36,0);
|
||||
//40.0842468473625
|
||||
备注:与二分法求解1的区别在于,此函数优化上下界已固定,上界(%)为1%,下界为500%
|
||||
```
|
||||
|
||||
### `optionBlackScholesRi2(contract_type, option_type, s, x, r, std, t, rf)`
|
||||
|
||||
返回期权相关的风险指标
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `contract_type` | Integer | 用户自定义,期权品种类型 |
|
||||
| `option_type` | Integer | 用户自定义,期权类型 |
|
||||
| `s` | Real | 标的现价,实数类型 |
|
||||
| `x` | Real | 期权的行权价,实数类型 |
|
||||
| `r` | Real | 无风险年利率(%),实数类型 |
|
||||
| `std` | Real | 年化波动率(%),实数类型 |
|
||||
| `t` | Real | 剩余存续期(月),到期权到期日前的剩余的有效期限,实数类型 |
|
||||
| `rf` | Real | 标的年化股息率(%),实数类型 |
|
||||
|
||||
返回:Array
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
//依据BS定价模型计算期权风险指标
|
||||
return optionBlackScholesRi2(0,0,2.365,2.2,2.75,25,12,0);
|
||||
//结果:
|
||||
```
|
||||
|
||||
### `optionBlackScholesDelta2(contract_type, option_type, s, x, r, std, t, rf)`
|
||||
|
||||
返回期权相关的风险指标
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| `contract_type` | Integer | 用户自定义,期权品种类型 |
|
||||
| `option_type` | Integer | 用户自定义,期权类型 |
|
||||
| `s` | Real | 标的现价,实数类型 |
|
||||
| `x` | Real | 期权的行权价,实数类型 |
|
||||
| `r` | Real | 无风险年利率(%),实数类型 |
|
||||
| `std` | Real | 年化波动率(%),实数类型 |
|
||||
| `t` | Real | 剩余存续期(月),到期权到期日前的剩余的有效期限,实数类型 |
|
||||
| `rf` | Real | 标的年化股息率(%),实数类型 |
|
||||
|
||||
返回:Real
|
||||
|
||||
#### 示例
|
||||
|
||||
```tsl
|
||||
//依据BS定价模型计算Delta值
|
||||
return optionBlackScholesDelta2(0,0,2.365,2.2,2.75,25,12,0);
|
||||
//结果:0.699959022086454
|
||||
```
|
||||
Reference in New Issue
Block a user