# 金融 / 期权 / 期权主力合约 / 中间函数 ## `optionCheckIdsEndT(index_id, end_t, option_type, ctype)` 声明:function 返回指定日指定标的的平值、实值、虚值合约 | 参数 | 类型 | 说明 | | ------------- | ----------- | ------------------------------- | | `index_id` | string | 字符串。标的代码 | | `end_t` | t_date_time | 日期。截止日期 | | `option_type` | integer | 用户自定义。期权类型,取值如下: | | `ctype` | integer | 用户自定义。合约类型,取值如下: | 返回:array ### 示例 范例01:调用函数 ```tsl return optionCheckIdsEndT('SH510050', 20210331T, -1, 0); ``` ## `optionCheckValueIds(index_id, end_t, option_type, ctype)` 声明:function 返回指定日指定标的的平值、实值、虚值合约 | 参数 | 类型 | 说明 | | ------------- | ----------- | ------------------------------- | | `index_id` | string | 字符串。标的代码 | | `end_t` | t_date_time | 日期。截止日期 | | `option_type` | integer | 用户自定义。期权类型,取值如下: | | `ctype` | integer | 用户自定义。合约类型,取值如下: | 返回:array ### 示例 范例01:调用函数 ```tsl return optionCheckValueIds('SH510050', 20210331T, 1, 0); ``` ## `optionIsValueId(option_id, end_t, ctype)` 声明:function 判断是否平值/实值/虚值合约 | 参数 | 类型 | 说明 | | ----------- | ----------- | --------------------- | | `option_id` | string | 字符串。期权代码 | | `end_t` | t_date_time | 日期。截止日期 | | `ctype` | integer | 用户自定义。取值如下: | 返回:integer ### 示例 范例01:调用函数 ```tsl // "OP10003265 50ETF购4月3600"在20210331日是否平值合约 return optionIsValueId("OP10003265", 20210331T, 0); // 输出:1 ``` ## `optionsZLId(index_id, end_t, option_type, check_type, rank_num, ctype)` 声明:function 返回指定日指定标的的期权主力合约,规则为 | 参数 | 类型 | 说明 | | ------------- | ----------- | ------------------------------- | | `index_id` | string | 字符串。标的代码 | | `end_t` | t_date_time | 日期。截止日期 | | `option_type` | integer | 用户自定义。期权类型,取值如下: | | `check_type` | integer | 用户自定义。筛选类型,取值如下: | | `rank_num` | integer | 整数。排名 | | `ctype` | integer | 用户自定义。取值如下: | 返回:string ### 示例 范例01:调用函数 ```tsl return optionsZlId('SH510050', 20210331T, -1, 1, 0); // 输出:OP10003264 ```