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.
199 lines
5.0 KiB
Markdown
199 lines
5.0 KiB
Markdown
# 期货 / 期货代码
|
|
|
|
## `futuresAllPzCode()`
|
|
|
|
所有期货代码对照表,若有新品种上市数据也会更新,此说明不再更新。
|
|
|
|
返回:array
|
|
|
|
## `futuresCodeToPz(stockid)`
|
|
|
|
期货代码->期货品种,支持通过期货合约代码、主力代码、指数代码、连续代码得到期货品种代码 若无参数stockid,则取当前证券为指定代码。
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| --------- | ------ | ------ |
|
|
| `stockid` | string | 字符串 |
|
|
|
|
返回:any
|
|
|
|
## `futurescodetopzendt(stockid)`
|
|
|
|
期货代码->期货品种(时间相关),支持通过期货合约代码、主力代码、指数代码、连续代码得到期货品种代码 若无参数stockid,则取当前证券为指定代码。1)期货合约代码->期货品种:基本面-交易代码 2)其它代码->期货品种:708表 3)若无参数stockid,则取当前证券为指定代码。 有些期货品种换过品种代码,所以品种代码与系统时间相关;
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| --------- | ------ | ------- |
|
|
| `stockid` | string | 字符串, |
|
|
|
|
返回:string
|
|
|
|
## `futuresContinueCode()`
|
|
|
|
指定期货合约的连续代码,与系统参数(期货代码)相关
|
|
|
|
返回:string
|
|
|
|
### 示例
|
|
|
|
```tsl
|
|
setsysparam(pn_stock(),'CU2101');
|
|
return FuturesContinueCode(); //返回'LXCU00'
|
|
```
|
|
|
|
## `futuresContinueCode1()`
|
|
|
|
指定期货合约的连一代码,与系统参数(期货代码)相关
|
|
|
|
返回:string
|
|
|
|
### 示例
|
|
|
|
```tsl
|
|
setsysparam(pn_stock(),'CU2101');
|
|
return FuturesContinueCode1(); //返回'LXCU01'
|
|
```
|
|
|
|
## `futuresContinueCode2()`
|
|
|
|
指定期货合约的连二代码,与系统参数(期货代码)相关
|
|
|
|
返回:string
|
|
|
|
### 示例
|
|
|
|
```tsl
|
|
setsysparam(pn_stock(),'CU2101');
|
|
return FuturesContinueCode2(); //返回'LXCU02'
|
|
```
|
|
|
|
## `futuresContinueCode4()`
|
|
|
|
指定期货合约的连四代码,与系统参数(期货代码)相关。
|
|
|
|
返回:string
|
|
|
|
### 示例
|
|
|
|
```tsl
|
|
setsysparam(pn_stock(),'CU2101');
|
|
return FuturesContinueCode4();
|
|
```
|
|
|
|
## `futuresGetJysCode(futures_id)`
|
|
|
|
天软期货代码转换为交易所代码
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| ------------ | ------ | ----------------- |
|
|
| `futures_id` | string | 证券,期货合约代码 |
|
|
|
|
返回:string
|
|
|
|
## `futuresGetTsCode(futures_id)`
|
|
|
|
交易所代码转换为天软期货代码
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| ------------ | ------ | ----------------- |
|
|
| `futures_id` | string | 证券,期货合约代码 |
|
|
|
|
返回:string
|
|
|
|
## `futuresIdToCzl()`
|
|
|
|
根据期货合约得到次主力线,与系统参数(期货代码)相关。
|
|
|
|
返回:string
|
|
|
|
### 示例
|
|
|
|
```tsl
|
|
setsysparam(pn_stock(),'cu2401');
|
|
return FuturesIDToCZL();
|
|
```
|
|
|
|
## `futuresIndexCode()`
|
|
|
|
指定期货合约的指数线代码,与系统参数(期货代码)相关
|
|
|
|
返回:string
|
|
|
|
### 示例
|
|
|
|
```tsl
|
|
setsysparam(pn_stock(),'IF00');
|
|
return FuturesIndexCode(); //返回'IFInd'
|
|
```
|
|
|
|
## `futuresSettlement()`
|
|
|
|
实时结算价(期货),与系统参数(证券代码,时间)相关,证券代码需使用期货实际合约,时间需要具体时间点。
|
|
|
|
返回:float
|
|
|
|
### 示例
|
|
|
|
```tsl
|
|
SetSysParam(pn_stock(),"sc2506");
|
|
SetSysParam(PN_Date(),strtodatetime('2025-04-14 11:00:00'));
|
|
return FuturesSettlement(); //结果:468.8
|
|
```
|
|
|
|
## `getFuturesBkbydate(bk_name, endt)`
|
|
|
|
指定日指定板块在市交易的期货合约,期货板块具体请查看Q:天软公用市场板块说明文档或平台中的板块工具。
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| --------- | -------- | ----------------------------------- |
|
|
| `bk_name` | String | 字符串,板块名称,多个板块可用;分隔 |
|
|
| `endt` | DateTime | 日期类型,截止日 |
|
|
|
|
返回:String
|
|
|
|
### 示例
|
|
|
|
```tsl
|
|
//取2020-2-1日,所有期货还在市交易的合给
|
|
return getFuturesBkbydate('国内商品期货;国债期货;股指期货',20200201T);
|
|
//取2020-2-1日,沪深300指数期货与10年期国债期货品种中还在市交易的合约
|
|
return getFuturesBkbydate('沪深300指数;10年期国债',20200201T);
|
|
//取2020-2-1日,大连商品交易所还在市交易的合约
|
|
return getFuturesBkbydate('大连商品交易所',20200201T);
|
|
```
|
|
|
|
## `futuresContinueCode3()`
|
|
|
|
指定期货合约的连四代码,与系统参数(期货代码)相关
|
|
|
|
返回:STRING
|
|
|
|
### 示例
|
|
|
|
```tsl
|
|
//得到CU2101的连四代码
|
|
setSysParam(pn_stock(),'CU2101');
|
|
return futuresContinueCode4(); //返回'LXCU04'
|
|
```
|
|
|
|
## `getFuturesDerivedIdByEndt(end_t, future_type, id_type)`
|
|
|
|
指定日已上市的期货衍生代码
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
| ------------- | ---------- | ----------------------------- |
|
|
| `end_t` | Date | 日期, 截止日 |
|
|
| `future_type` | UserDefine | 用户自定义, 期货类型,默认为0 |
|
|
| `id_type` | UserDefine | 用户自定义, 代码类型,默认为0 |
|
|
|
|
返回:array
|
|
|
|
### 示例
|
|
|
|
```tsl
|
|
//指定日已上市的股指期货的品种代码
|
|
end_t := 20240201T;
|
|
future_type := 1;
|
|
id_type := 0;
|
|
return getFuturesDerivedIdByEndt(end_t,future_type,id_type);
|
|
//array("IC","IF","IH","IM")
|
|
```
|