Mirror docs/tsl/codegen into the bundled tsl-api-reference skill and rebuild the function index. Remove invalid duplicate API entries for cb_delistedbydate, createhttpsession, exportJsonString, and Anova_Bartlett so exact lookup returns the canonical entries.
466 lines
12 KiB
Markdown
466 lines
12 KiB
Markdown
# 基金 / 基金净值
|
||
|
||
## `calculateComplexRightQj(nawarr, forefhcf, rateday)`
|
||
|
||
复杂复权单位净值序列,与系统参数无关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ---------- | ----- | ------------------ |
|
||
| `nawarr` | table | table,净值序列 |
|
||
| `forefhcf` | table | table,分红送股情况 |
|
||
| `rateday` | int | integer,复权基准日 |
|
||
|
||
返回:array
|
||
|
||
## `fund7DaysAnnualRate(fundid, endt)`
|
||
|
||
7日折算的年化收益率(%) 返回指定基金指定日的7日折算的年化收益率(%),非货币型返回0
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| -------- | ---- | -------- |
|
||
| `fundid` | any | 基金代码 |
|
||
| `endt` | any | 截止日期 |
|
||
|
||
返回:float
|
||
|
||
## `fundIpov()`
|
||
|
||
时点净值(ETF/LOF),与系统证券pn_stock()、系统时间pn_date()相关
|
||
|
||
返回:float
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
Setsysparam(pn_stock(),'SZ160215') ;
|
||
SetSysParam(pn_date(),inttodate(20121019));
|
||
Return FundIPOV();
|
||
```
|
||
|
||
## `fundMaxMinNaw(beg_t, end_t, _type, return_type)`
|
||
|
||
取区间内单位(累计)净值的最大或最小值,与系统证券pn_stock()相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------------- | -------- | ---------- |
|
||
| `beg_t` | datetime | 开始日期 |
|
||
| `end_t` | datetime | 截止日期 |
|
||
| `_type` | int | 返回内容 |
|
||
| `return_type` | int | 返回的类型 |
|
||
|
||
返回:float
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
Setsysparam(pn_stock(),'OF040001') ;
|
||
ReturnFundMaxMinNAW(inttodate(20040930),inttodate(20121018),0,0);
|
||
```
|
||
|
||
## `fundNawByRateBegtEndt(begt, endt)`
|
||
|
||
区间复权单位净值,与系统参数基金代码、复权方式、复权基准日相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------ | -------- | ------------- |
|
||
| `begt` | datetime | date,开始日期 |
|
||
| `endt` | datetime | date,截止日期 |
|
||
|
||
返回:array
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
setsysparam(pn_stock(),"OF000001");
|
||
SetSysParam(PN_Rate(),1) ;
|
||
SetSysParam(PN_RateDay(),-1);
|
||
return FundNAWByRateBegtEndt(20210501T,20210514T);
|
||
```
|
||
|
||
## `fundNawByRateEndT(endt)`
|
||
|
||
指定日复权单位净值,与系统参数基金代码、复权方式、复权基准日相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------ | -------- | ----------- |
|
||
| `endt` | datetime | date,截止日 |
|
||
|
||
返回:float
|
||
|
||
## `fundNawlAccumulativeNetAsset(end_t)`
|
||
|
||
基金指定日累计净值,数据取自基金.净值(328)。与系统股票pn_stock()相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------- | -------- | ------------------ |
|
||
| `end_t` | datetime | 日期类型,截止日期 |
|
||
|
||
返回:float
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
setsysparam(pn_stock(),"OF162714");
|
||
Return FundNAWLAccumulativeNetAsset(20180822T);
|
||
```
|
||
|
||
## `fundNawlj()`
|
||
|
||
最新累计净值,与系统证券pn_stock()和系统时间pn_date()相关。
|
||
|
||
返回:float
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
Setsysparam(pn_stock(),'OF040001') ;
|
||
ReturnFundNAWLJ();
|
||
```
|
||
|
||
## `fundNawlNetAsset(end_t)`
|
||
|
||
基金截止日单位净值,数据取自基金.净值(328)。与系统股票pn_stock()相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------- | -------- | ------------------ |
|
||
| `end_t` | datetime | 日期类型,截止日期 |
|
||
|
||
返回:float
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
setsysparam(pn_stock(),"OF162714");
|
||
Return FundNAWLNetAsset(20180822T);
|
||
```
|
||
|
||
## `fundNawZf3()`
|
||
|
||
最新日收益率(%),与系统证券pn_stock()相关。 对于非货币基金 若无分红 今日净值增长率=(今日净值-昨日净值)/昨日净值 若有分红 今日净值增长率=(今日净值-(昨日净值-分红)/拆分)/((昨日净值-分红)/拆分)。 对于货币基金 今日净值增长率=区间内的复合收益率。
|
||
|
||
返回:float
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
{取华安创新2012年10月19日的最新日收益率(%)
|
||
注意,函数必须先设置当前时间,再设置当前股票。原因是设置当前的时间跟时间序列数据有关,如果先设置股票为'OF040001',而开放式基金是没有二级市场交易数据的,之后再设置时间为指定日,会导致当前的时间为0。从而取不出数据。}
|
||
Setsysparam(pn_date(),inttodate(20121019));
|
||
Setsysparam(pn_stock(),'OF040001') ;
|
||
Return FundNAWZf3();
|
||
```
|
||
|
||
## `fundNetAssetperUnitInReportDate(r_date)`
|
||
|
||
单位净值(报告期),与系统参数(证券代码)相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| -------- | ---- | ------------ |
|
||
| `r_date` | int | 整数。报告期 |
|
||
|
||
返回:float
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
SetSysParam(PN_Stock(),'SH500001');
|
||
return FundNetAssetperUnitInReportDate(20211231);
|
||
```
|
||
|
||
## `fundZjRatio4()`
|
||
|
||
ETF时点折价率,与系统参数(证券代码,时间,周期)相关。
|
||
|
||
返回:float
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
SetSysParam(pn_stock(),"OF512610");
|
||
SetSysParam(PN_Date(),20200924T);
|
||
return FundZjRatio4(); //结果:-0.14
|
||
```
|
||
|
||
## `fundMaxMinNaw2(end_t, _type, return_type)`
|
||
|
||
上市以来至EndT这段时间内单位(累计)净值的最大或最小值,与系统证券pn_stock()相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------------- | ------- | ---------- |
|
||
| `end_t` | Date | 截止日期 |
|
||
| `_type` | Integer | 返回内容 |
|
||
| `return_type` | Integer | 返回的类型 |
|
||
|
||
返回:Real
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
//返回华安创新上市以来到2012年10月18日之间的最大单位净值
|
||
setSysParam(pn_stock(),'OF040001') ;
|
||
ReturnFundMaxMinNAW2(intToDate(20121018),0,0);
|
||
//结果:4.452
|
||
```
|
||
|
||
## `fundNawdw()`
|
||
|
||
最新单位净值,与系统证券pn_stock()和系统时间pn_date()相关。
|
||
|
||
返回:Real
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
//取华安创新在指定日的单位净值
|
||
setSysParam(pn_stock(),'OF040001') ;
|
||
setSysParam(pn_date(),20260528T);
|
||
return fundNawdw();
|
||
//结果:1.86
|
||
```
|
||
|
||
## `fundNawlInfo(beg_t, end_t, _type)`
|
||
|
||
取区间内每天的净值(详情),与系统证券pn_stock()相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------- | ------- | -------- |
|
||
| `beg_t` | Date | 开始日期 |
|
||
| `end_t` | Date | 截止日期 |
|
||
| `_type` | Integer | 返回类型 |
|
||
|
||
返回:Array
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
//取华安创新2012年10月10日到2012年10月19日之间的单位净值和累计净值
|
||
setSysParam(pn_stock(),'OF040001') ;
|
||
ReturnFundNAWLInfo(intToDate(20121010),intToDate(20121019),2);
|
||
结果:
|
||
```
|
||
|
||
## `fundNawlInfo2(end_t, _type)`
|
||
|
||
指定日净值数据,与系统证券pn_stock()相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------- | ------- | -------- |
|
||
| `end_t` | Date | 截止日期 |
|
||
| `_type` | Integer | 返回类型 |
|
||
|
||
返回:Real
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
//取华安创新2012年10月19日的单位净值和累计净值
|
||
setSysParam(pn_stock(),'OF040001') ;
|
||
ReturnFundNAWLInfo2 (intToDate(20121019),2);
|
||
结果:
|
||
```
|
||
|
||
## `fundNawZf(beg_t, end_t)`
|
||
|
||
区间净值增长率(%),与系统证券pn_stock()相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------- | ---- | -------- |
|
||
| `beg_t` | Date | 开始日期 |
|
||
| `end_t` | Date | 截止日期 |
|
||
|
||
返回:Real
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
//取华安创新2012年10月10日到2012年10月19日之间的区间净值增长率(%)
|
||
setSysParam(pn_stock(),'OF040001') ;
|
||
ReturnFundNAWZf(intToDate(20121010),intToDate(20121019));
|
||
//结果:0.17
|
||
```
|
||
|
||
## `fundNawlInfoFromBegT(beg_t, end_t, _type)`
|
||
|
||
区间净值详情(以开始日为基准日计算累计净值),与系统证券pn_stock()相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------- | ------- | -------- |
|
||
| `beg_t` | Date | 开始日期 |
|
||
| `end_t` | Date | 截止日期 |
|
||
| `_type` | Integer | 返回类型 |
|
||
|
||
返回:Real
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
//取华安创新2012年10月10日到2012年10月19日之间的累计净值
|
||
setSysParam(pn_stock(),'OF040001') ;
|
||
return
|
||
fundNawlInfoFromBegT(intToDate(20121010),intToDate(20121019),1);
|
||
结果:
|
||
```
|
||
|
||
## `fundNawZf4(end_t)`
|
||
|
||
指定日收益率(%),与系统证券pn_stock()相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------- | ---- | -------- |
|
||
| `end_t` | Date | 截止日期 |
|
||
|
||
返回:Real
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
//取华安创新2012年10月19日的日收益率(%)
|
||
setSysParam(pn_stock(),'OF040001') ;
|
||
ReturnFundNAWZf4(intToDate(20121019));
|
||
//结果:-0.17
|
||
```
|
||
|
||
## `FundNAWZf_fh(beg_t, end_t)`
|
||
|
||
区间复合收益率(%) , 与系统股票pn_stock()相关。 对于非货币基金 若区间无分红 区间净值增长率=(截止日净值-开始日昨净值)/开始日昨净值。 若区间有分红 区间净值增长率=(1+拆分前的净值增长率)\*(1+分红拆分日的净值增长率)\*(1+分红拆分日后到截止日之间的净值增长率)-1。 对于货币基金 区间净值增长率=区间内的复合收益率。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------- | -------- | -------- |
|
||
| `beg_t` | datetime | 开始日期 |
|
||
| `end_t` | datetime | 截止日期 |
|
||
|
||
返回:float
|
||
|
||
## `fundIpoc()`
|
||
|
||
时点收盘(ETF/LOF),与系统证券pn_stock()与系统时间pn_date()相关
|
||
|
||
返回:Real
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
//取国泰价值最新时点收盘
|
||
setSysParam(pn_stock(),'SZ160215') ;
|
||
setSysParam(pn_date(),intToDate(20121019));
|
||
return fundIpoc();
|
||
//结果:0.72
|
||
```
|
||
|
||
## `fundNawmwfjjdwsy(end_t)`
|
||
|
||
基金截止日每万份基金单位收益,数据取自基金.净值(328)。与系统股票pn_stock()相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------- | -------- | ------------------ |
|
||
| `end_t` | DateTime | 日期类型,截止日期 |
|
||
|
||
返回:Real
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
//基金OF090005在2018年8月22日的每万份基金单位收益。
|
||
setSysParam(pn_stock(),"OF090005");
|
||
return fundNawmwfjjdwsy(20180822T);
|
||
//结果:0.86
|
||
```
|
||
|
||
## `fundNawzjqrsyzsdnsyl(end_t)`
|
||
|
||
基金截止日最近七日收益折算的年收益率(%),数据取自基金.净值(328)。与系统股票pn_stock()相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------- | -------- | ------------------ |
|
||
| `end_t` | DateTime | 日期类型,截止日期 |
|
||
|
||
返回:Real
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
//基金OF090005在2018年8月22日的最近七日收益折算的年收益率。
|
||
setSysParam(pn_stock(),"OF090005");
|
||
return fundNawzjqrsyzsdnsyl (20180822T);
|
||
//结果:3.243
|
||
```
|
||
|
||
## `fundAdjustNaw(end_t, _type)`
|
||
|
||
指定日基金净值,与系统证券PN_Stock()相关,根据分红拆分计算调整前/后净值
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------- | -------- | ---------------------- |
|
||
| `end_t` | Datetime | 日期类型,截止日 |
|
||
| `_type` | Integer | 整数类型,返回净值类型 |
|
||
|
||
返回:Real
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
setSysParam(Pn_Stock(),"OF000001");
|
||
endt:=20230112T;
|
||
return fundAdjustNaw(endt,1); //0.9952
|
||
```
|
||
|
||
## `calculateRatioRightQj(nawarr, forefhcf, rateday)`
|
||
|
||
比例复权单位净值序列,与系统参数无关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ---------- | ------- | ------------------ |
|
||
| `nawarr` | table | table,净值序列 |
|
||
| `forefhcf` | table | table,分红送股情况 |
|
||
| `rateday` | integer | integer,复权基准日 |
|
||
|
||
返回:array
|
||
|
||
## `Fund_NAWLNetAssetField()`
|
||
|
||
基金净值-单位净值。根据数据库提供商返回对应的值
|
||
|
||
返回:string
|
||
|
||
## `Fund_NAWLSumValueField()`
|
||
|
||
基金净值-净值总额。根据数据库提供商返回对应的值
|
||
|
||
返回:string
|
||
|
||
## `Fund_NAWZJQRSYZSDNSYLField()`
|
||
|
||
基金净值-最近七日收益折算的年收益率(%)。根据数据库提供商返回对应的值
|
||
|
||
返回:string
|
||
|
||
## `FundNAW(_type)`
|
||
|
||
净值,与系统证券,时间相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------- | ------- | -------- |
|
||
| `_type` | Integer | 净值类型 |
|
||
|
||
返回:Real,实数
|
||
|
||
## `Fund_NAW(_type)`
|
||
|
||
净值,与系统证券,时间相关。
|
||
|
||
| 参数 | 类型 | 说明 |
|
||
| ------- | ------- | -------- |
|
||
| `_type` | Integer | 净值类型 |
|
||
|
||
返回:Real
|
||
|
||
### 示例
|
||
|
||
```tsl
|
||
//取华安创新的净值截止日期
|
||
setSysParam(pn_stock(),'OF040001') ;
|
||
setSysParam(pn_date(),20240506t) ;
|
||
return fundNaw(5);
|
||
//结果:20240506
|
||
```
|