Flatten builtin pages, add third-party and platform scopes, and import financial and data warehouse references. Keep the existing generated index without rebuilding after signature normalization.
90 lines
2.3 KiB
Markdown
90 lines
2.3 KiB
Markdown
# 金融 / 基金 / ETF
|
|
|
|
## `fund_calculatedIOPV()`
|
|
|
|
声明:function
|
|
|
|
获取实时的成分股收盘数据,计算实时的净值数据。 ETF's IOPV(算法计算) 获取实时的成分股收盘数据,计算实时的净值数据。 注意,该函数使用到PCF数据, 天软没有境外ETF的PCF的数据,会返回0,故使用时需注意。 由于自2015-05-04日后交易所的时点净值公布频率提高到3秒一笔, 所以取2015-05-04日之后的时点净值会直接以交易所公布的替代(调用FundIPOV),不再进行取成份股计算。 与当前的系统股票、周期和时间相关
|
|
|
|
返回:float
|
|
|
|
### 示例
|
|
|
|
范例01:调用 Fund_CalculatedIOPV
|
|
|
|
```tsl
|
|
StockID := 'OF159901';
|
|
|
|
BegT := IntToDate(20140430);
|
|
|
|
EndT := BegT+10/24;
|
|
|
|
JYCode := spec(base(302033), StockID);
|
|
|
|
setsysparam(pn_stock(), JYCode);
|
|
|
|
setsysparam(pn_cycle(), cy_5s());
|
|
|
|
setsysparam(pn_date(), endt);
|
|
|
|
days := tradedays(begt, endt);
|
|
|
|
name := stockname(StockID);
|
|
|
|
return nday(days, '代码', StockID,
|
|
|
|
'名称', name,
|
|
|
|
'时间', datetimetostr(sp_time()),
|
|
|
|
'时点净值-计算', Fund_CalculatedIOPV());
|
|
```
|
|
|
|
范例02:提取指定时点交易所公布 IOPV和用基金申赎清单计算的 IOPV
|
|
|
|
```tsl
|
|
// 提取指定时点交易所公布 IOPV和用基金申赎清单计算的 IOPV
|
|
|
|
SetSysParam(PN_Stock(), 'OF510050');
|
|
|
|
SetSysParam(PN_Cycle(), cy_1m());
|
|
|
|
SetSysParam(PN_Date(), 20140430T+10/24);
|
|
|
|
// 交易所公布 IOPV
|
|
|
|
IOPV1 := FundIPOV();
|
|
|
|
// 用基金申赎清单计算的 IOPV
|
|
|
|
IOPV2 := Fund_CalculatedIOPV();
|
|
|
|
return array(IOPV1, IOPV2);
|
|
// 输出:array(1.492,1.4923)
|
|
```
|
|
|
|
## `getfundetfconstituent(fundid, enddate, t)`
|
|
|
|
声明:function
|
|
|
|
获取ETF历史指定日申购赎回-成分股表数据
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| --------- | --------- | ---------------------------------------------- |
|
|
| `fundid` | string | string,股票代码 |
|
|
| `enddate` | tdatetime | tdatetime,截止日 |
|
|
| `t` | array | array,出参,获取到的ETF申购赎回-成分股数据结果 |
|
|
|
|
返回:boolean
|
|
|
|
### 示例
|
|
|
|
范例01:调用函数
|
|
|
|
```tsl
|
|
// 获取基金OF510050在2020-1-10日的成份股表
|
|
ret := getfundetfconstituent('OF510050', 20200110T, t);
|
|
if ret then return t;
|
|
else return array(); // 获取失败
|
|
```
|