feat(tsl-api-reference): expand and reorganize api catalog

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.
This commit is contained in:
csh
2026-08-10 18:26:24 +08:00
parent 2938300acb
commit 9010829c6d
1186 changed files with 243901 additions and 219769 deletions
@@ -0,0 +1,196 @@
# 金融 / 指数 / 指数情况
## `getAllIndexIDs(end_t)`
声明:function
获取指定日所有申万行业指数ID及名称对照表
| 参数 | 类型 | 说明 |
| ------- | -------- | ------------- |
| `end_t` | datetime | 日期,截止日期 |
返回:array
### 示例
范例01:调用 GetAllIndexIDs
```tsl
Return GetAllIndexIDs(20251029T);
```
## `getBkBacktrackByDate(index_id, end_t, ex_type)`
声明:function
获取指数历史上指定日样本(可回溯)。当ExType=1时,如指数成分中取不到成分,则从权重表中获取。此函数可以简单回溯历史数据,当Endt早于指数开始日,则选取指数开始日成分股在endt在市交易的成分股列表
| 参数 | 类型 | 说明 |
| ---------- | -------- | ---------------- |
| `index_id` | string | 字符串。指数代码 |
| `end_t` | datetime | 日期。截止日 |
| `ex_type` | int | 整数。是否扩展 |
返回:array
### 示例
范例01SWHY740000申万煤炭在20140805的成分数据
```tsl
// SWHY740000申万煤炭在20140805的成分数据
return GetBKBacktrackByDate("SWHY740000", 20140805T);
```
## `getbkbybegtendt(indexid, begt, endt)`
声明:function
区间曾经是成分股的股票,区间范围内是指数成份股的股票
| 参数 | 类型 | 说明 |
| --------- | -------- | ---------------------------------------------------------- |
| `indexid` | string | 字符串,板块代码,一个或多个代码,多个代码以英文分号“;”隔开 |
| `begt` | datetime | Tdatetime,开始日期 |
| `endt` | datetime | Tdatetime,截止日期 |
返回:array
## `getBkByDate(index_id, end_t, extype)`
声明:function
获取指数历史指定日的成份股列表。与GetBK不同,该函数需要的第一个参数是指数代码,获取该指数的指定日的成分股,比如沪深300定期调整,在不同时间获取的成分股将不同。 新增功能,当ExType=1时指数成分中取不到成分时,则从权重表中获取
| 参数 | 类型 | 说明 |
| ---------- | -------- | ------------------------------------------------------------------------------------- |
| `index_id` | string | 指数代码 |
| `end_t` | datetime | 截止日 |
| `extype` | int | 整型,是否扩展,默认不扩展;0:不扩展;1:扩展取数(指数成分表无数据时,从权重表中获取) |
返回:table
### 示例
范例01:获取沪深300在2012年9月8日的成份股列表
```tsl
// 获取沪深300在2012年9月8日的成份股列表。
Return GetBkByDate('SH000300', inttodate(20120908));
```
范例02:创业板综在20201201的成分数据
```tsl
// 创业板综在20201201的成分数据
return GetBKByDate("SZ399102", 20201201T, 1); // 取权重中的成份股替代
```
## `getBkByIndexName(index_name, end_t)`
声明:function
使用指数名称获取指定日指数成分,只支持申万行业、A股
| 参数 | 类型 | 说明 |
| ------------ | -------- | --------------- |
| `index_name` | string | 字符串,指数名称 |
| `end_t` | datetime | 日期,截止日期 |
返回:array
### 示例
范例01:调用 GetBKByIndexName
```tsl
A股在20201201的成分数据
return GetBKByIndexName("A股", 20201201T);
```
## `getBkGoMarketByDate(index_id, end_t, ex_type)`
声明:function
获取指数历史上指定日样本(已上市)。当ExType=1时指数成分中取不到成分时,则从权重表中获取。存在申万行业分类的成份股中,它的选入日期可能早于上市日,现剔除这部分标的
| 参数 | 类型 | 说明 |
| ---------- | -------- | ---------------- |
| `index_id` | string | 字符串。指数代码 |
| `end_t` | datetime | 日期。截止日 |
| `ex_type` | int | 整数。是否扩展 |
返回:array
### 示例
范例01:创业板综在20201201的成分数据
```tsl
// 创业板综在20201201的成分数据
return GetBKGoMarketByDate("SZ399102", 20201201T, 1);
```
## `getBkNameToId(index_name, end_t)`
声明:function
使用指数名称获取指定日指数成分
| 参数 | 类型 | 说明 |
| ------------ | -------- | --------------- |
| `index_name` | string | 字符串,指数名称 |
| `end_t` | datetime | 日期,截止日期 |
返回:array
### 示例
范例01:调用 GetBKNameToId
```tsl
创业板综在20201201的成分数据
return GetBKNameToId("A股", 20201201T);
```
## `stock_hsgEligibleInfo(bkid, stockid)`
声明:function
股票调入调出沪深港通情况,返回:板块代码、板块、代码、入选日期、剔除日期、成份标志
| 参数 | 类型 | 说明 |
| --------- | ------ | ----------------------------------------------------------------------------------------------------------- |
| `bkid` | string | 字符串,字符串,通道代码;"HG000001" 港股通(沪)"HG000003" 港股通(深)"HG000002" 沪股通;"HG000004" 深股通 |
| `stockid` | string | 字符串,股票代码 |
返回:array
## `stockIsIndexComposite(index_id, end_t)`
声明:function
查询指定日股票是否是指数的成份股,与系统证券pn_stock()相关
| 参数 | 类型 | 说明 |
| ---------- | -------- | ------ |
| `index_id` | string | 指数 |
| `end_t` | datetime | 截止日 |
返回:bool
### 示例
范例01:调用函数
```tsl
setsysparam(pn_stock(), 'SZ000002');
return StockIsIndexComposite('SH000300', inttodate(20120907));
```