# 金融 / 指数 / 指数成分 ## `getIndexWeightByDate_vw1(end_t)` 声明:function 指数成份与权重(预估:算法VW1)详情参考: | 参数 | 类型 | 说明 | | ------- | ----------- | ------------- | | `end_t` | t_date_time | 日期,截止日期 | 返回:array ### 示例 范例01:"SH000300"在20260417的成分及权重数据 ```tsl // "SH000300"在20260417的成分及权重数据 SetSysParam(pn_stock(), "SH000300"); return GetIndexWeightByDate_VW1(20260417T); ``` ## `getIndexWeightByDate_vw2(end_t)` 声明:function 指数成份与权重(预估:算法VW2),与系统参数(指数代码)相关 算法VW2详情参考: | 参数 | 类型 | 说明 | | ------- | ----------- | ------------- | | `end_t` | t_date_time | 日期,截止日期 | 返回:array ### 示例 范例01:"SH000300"在20260417的成份与权重 ```tsl // "SH000300"在20260417的成份与权重 SetSysParam(pn_stock(), "SH000300"); return GetIndexWeightByDate_VW2(20260417T); ``` ## `getIndexWeightByDate_withEtfPcf(end_t)` 声明:function 指数成份与权重(估算:基于ETFPCF),与系统参数(指数代码)相关 基于ETFPCF预估算法:利用跟踪同一指数的多只ETF的PCF清单数据, 通过成分股在 ETF 篮子中的市值占比来反推指数权重。 详情参考: | 参数 | 类型 | 说明 | | ------- | ----------- | ------------- | | `end_t` | t_date_time | 日期,截止日期 | 返回:array ### 示例 范例01:"SH000300"在20260417的成分及权重数据 ```tsl // "SH000300"在20260417的成分及权重数据 SetSysParam(pn_stock(), "SH000300"); return GetIndexWeightByDate_WithETFPCF(20260417T); ``` ## `indexIndusNoNCode(endt, topn, industype)` 声明:function 返回第N名行业的名称 | 参数 | 类型 | 说明 | | ----------- | -------- | ------------- | | `endt` | datetime | 日期,截止日期 | | `topn` | int | 整型,第N | | `industype` | int | 整型,行业类别 | 返回:string ### 示例 范例01:调用函数 ```tsl setsysparam(pn_stock(), 'SH000300'); return IndexIndusNoNCode(20200924T, 2, 1); // 输出:金融业 ``` ## `indexIndusNoNWeight(endt, topn, industype)` 声明:function 返回指定日第N名行业的权重 | 参数 | 类型 | 说明 | | ----------- | -------- | ------------- | | `endt` | datetime | 日期,截止日期 | | `topn` | int | 整型,第N | | `industype` | int | 整型,行业类别 | 返回:float ### 示例 范例01:调用函数 ```tsl setsysparam(pn_stock(), 'SH000300'); return IndexIndusNoNWeight(20200924T, 2, 1); // 输出:28.686091977063 ``` ## `indexIndusSumNWeight(endt, topn, industype)` 声明:function 获取指定指数前N行业的权重(行业集中度(%)) | 参数 | 类型 | 说明 | | ----------- | -------- | ------------- | | `endt` | datetime | 日期,截止日期 | | `topn` | int | 整型,前N | | `industype` | int | 整型,行业类别 | 返回:float ### 示例 范例01:调用函数 ```tsl setsysparam(pn_stock(), 'SH000300'); return IndexIndusSumNWeight(20200924T, 2, 1); // 输出:28.4782510781865 ``` ## `indexIndusWeightByDate(industryname, endt, industype)` 声明:function 获取指定日指定行业在指定指数中的权重(%) 。 可以获取证监会一级/二级,中证一级/二级,申万一级/二级 的行业权重。其中, 1)证监会和中证只按照当前最新的行业分类统计, 2)申万可根据历史的行业分类统计 | 参数 | 类型 | 说明 | | -------------- | -------- | --------------- | | `industryname` | string | 字符串,行业名称 | | `endt` | datetime | 日期,截止日期 | | `industype` | int | 整型,行业类别 | 返回:float ### 示例 范例01:调用函数 ```tsl setsysparam(pn_stock(), 'SH000300'); return IndexIndusWeightByDate("制造业", 20200924T, 1); ``` ## `indexStockNoNCode(endt, topn)` 声明:function 返回第N名股票的代码 | 参数 | 类型 | 说明 | | ------ | -------- | ------------- | | `endt` | datetime | 日期,截止日期 | | `topn` | int | 整型,第N | 返回:float ### 示例 范例01:调用函数 ```tsl setsysparam(pn_stock(), 'SH000300'); return IndexStockNoNCode(20200924T, 2); // 输出:SH600519 ``` ## `indexStockNoNWeight(endt, topn)` 声明:function 返回指定日第N名股票权重 | 参数 | 类型 | 说明 | | ------ | -------- | ------------- | | `endt` | datetime | 日期,截止日期 | | `topn` | int | 整型,第N | 返回:float ### 示例 范例01:调用函数 ```tsl setsysparam(pn_stock(), 'SH000300'); return IndexStockNoNWeight(20200924T, 2); // 输出:5.0403035260277 ``` ## `indexStockSumNWeight(endt, topn)` 声明:function 返回指定指数前N证券的权重(股票集中度(%)) | 参数 | 类型 | 说明 | | ------ | -------- | ------------- | | `endt` | datetime | 日期,截止日期 | | `topn` | int | 整型,前N | 返回:float ### 示例 范例01:调用函数 ```tsl setsysparam(pn_stock(), 'SH000300'); return IndexStockSumNWeight(20200924T, 2); // 输出:10.2321520830025 ``` ## `indexStockWeightByDate(stockid, endt)` 声明:function 获取指定日指定股票在指定指数中的权重(%) | 参数 | 类型 | 说明 | | --------- | -------- | -------------- | | `stockid` | index | Index,股票代码 | | `endt` | datetime | 日期,截止日期 | 返回:float ### 示例 范例01:调用函数 ```tsl setsysparam(pn_stock(), 'SH000300'); return IndexStockWeightByDate("SZ000002", 20200924T); // 输出:1.17721168024293 ``` ## `indexWeightFirstday()` 声明:function 返回指定指数权重开始日,与系统参数(证券代码)相关 返回:datetime ### 示例 范例01:调用函数 ```tsl setsysparam(pn_stock(), 'SH000300'); return IndexWeightFirstday(); ```