Files
playbook/skills/tsl-api-reference/references/codegen/dotnet/financial/option-option_contract_code.md
T
csh 9010829c6d 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.
2026-08-10 18:26:24 +08:00

6.6 KiB

金融 / 期权 / 期权合约代码

op_getOptionChainList(stock_id, exercise_way, option_type)

声明:function

通过指定行权方式和期权类型获取标的的期权合约列表

参数 类型 说明
stock_id string 字符串。期权标的代码
exercise_way integer 用户自定义。行权方式,取值如下:
option_type integer 用户自定义。期权类型,取值如下:

返回:array

示例

范例01:返回50ETF为标的,所有行权方式和期权类型的期权合约列表

return OP_GetOptionChainList("SH510050", -1, -1);
// 输出:50ETF为标的,所有行权方式和期权类型的期权合约列表

op_selectOption(stock_id, endt, option_type, maturity_date_type, ctype, ntpye)

声明:function

标的指定条件交易的期权合约列表

参数 类型 说明
stock_id string 字符串。期权品种代码
endt datetime 日期。截止日
option_type integer 用户自定义。期权类型,取值如下:
maturity_date_type integer 整数。到期日类型
ctype integer 用户自定义。合约类型,取值如下:
ntpye integer 整数。档位

返回:array

示例

范例01:返回50ETF为标的,20230511T交易类型为认购的近月平值期权合约列表

return OP_SelectOption("SH510050", 20230511T, 1, 0, 0, 0);
// 输出:array("OP10005274")

op_selectOptionData(stock_id, endt)

声明:function

标的指定日交易的期权合约列表信息

参数 类型 说明
stock_id string 证券,期权品种代码
endt datetime 日期,截止日

返回:array

示例

范例01:返回"AP"在20240419交易的期权合约列表信息

return OP_SelectOptionData('AP', 20240419T);
// 输出:"AP"在20240419交易的期权合约列表信息

optionGetAIDByDate(option_id, endt)

声明:function

通过期权代码获取ETF期权分红后A合约代码

参数 类型 说明
option_id string 证券,期权代码
endt t_date_time 日期,截止日期

返回:real

示例

范例01:调用函数

// 获取期权"OP10008745"标的在20250116分红后的A合约代码
option_id := "OP10008745";
endt := 20250116T;
return optionGetAidByDate(option_id, endt);
// 输出:OP10008621

optionGetMIDByDate(option_id, endt)

声明:function

通过期权代码获取ETF期权分红后M合约代码

参数 类型 说明
option_id string 证券,期权代码
endt t_date_time 日期,截止日期

返回:real

示例

范例01:调用函数

// 获取期权"OP10008621"标的在20250116分红后的M合约代码
option_id := "OP10008621";
endt := 20250116T;
return optionGetMidByDate(option_id, endt);
// 输出:OP10008745

optionNearContractCallITM1()

声明:function

期权标的近月认购实一档合约,与系统参数(证券代码、时间)相关

返回:string

示例

范例01:调用函数

setSysParam(pn_stock(), "SH510050");
setSysParam(pn_date(), 20230511T);
return optionNearContractCallItm1();
// 输出:50ETF为标的,20230511T交易类型为认购的近月实值一档期权合约

optionNearContractCallITM2()

声明:function

期权标的近月认购实二档合约,与系统参数(证券代码、时间)相关

返回:string

示例

范例01:调用函数

setSysParam(pn_stock(), "SH510050");
setSysParam(pn_date(), 20230511T);
return optionNearContractCallItm2();
// 输出:50ETF为标的,20230511T交易类型为认购的近月实值二档期权合约

optionNearContractCallOTM1()

声明:function

期权标的近月认购虚一档合约,与系统参数(证券代码、时间)相关

返回:string

示例

范例01:调用函数

setSysParam(pn_stock(), "SH510050");
setSysParam(pn_date(), 20230511T);
return optionNearContractCallOtm1();
// 输出:50ETF为标的,20230511T交易类型为认购的近月虚值一档期权合约

optionNearContractCallOTM2()

声明:function

期权标的近月认购虚二档合约,与系统参数(证券代码、时间)相关

返回:string

示例

范例01:调用函数

setSysParam(pn_stock(), "SH510050");
setSysParam(pn_date(), 20230511T);
return optionNearContractCallOtm2();
// 输出:50ETF为标的,20230511T交易类型为认购的近月虚值二档期权合约

optionNearContractPutITM1()

声明:function

期权标的近月认沽实一档合约,与系统参数(证券代码、时间)相关

返回:string

示例

范例01:调用函数

setSysParam(pn_stock(), "SH510050");
setSysParam(pn_date(), 20230511T);
return optionNearContractPutItm1();
// 输出:50ETF为标的,20230511T交易类型为认沽的近月实值一档期权合约

optionNearContractPutITM2()

声明:function

期权标的近月认沽实二档合约,与系统参数(证券代码、时间)相关

返回:string

示例

范例01:调用函数

setSysParam(pn_stock(), "SH510050");
setSysParam(pn_date(), 20230511T);
return optionNearContractPutItm2();
// 输出:50ETF为标的,20230511T交易类型为认沽的近月实值二档期权合约

optionNearContractPutOTM1()

声明:function

期权标的近月认沽虚一档合约,与系统参数(证券代码、时间)相关

返回:string

示例

范例01:调用函数

setSysParam(pn_stock(), "SH510050");
setSysParam(pn_date(), 20230511T);
return optionNearContractPutOtm1();
// 输出:50ETF为标的,20230511T交易类型为认沽的近月虚值一档期权合约

optionNearContractPutOTM2()

声明:function

期权标的近月认沽虚二档合约,与系统参数(证券代码、时间)相关

返回:string

示例

范例01:调用函数

setSysParam(pn_stock(), "SH510050");
setSysParam(pn_date(), 20230511T);
return optionNearContractPutOtm2();
// 输出:50ETF为标的,20230511T交易类型为认沽的近月虚值二档期权合约