发明者量化商品期货合约代码明细

温馨提示:鉴于内容太多, 可使用 Ctrl + F 进行搜索

由于商品期货合约存续的特殊性,为满足用户的使用需求,针对每一个品种提供主力连续合约和指数合约,其主要是根据当前时间段内有效的商品期货合约数据人工合成,具体调用方法可以参考本页示例代码。其中:

  • 主力连续合约:由该期货品种不同时期的主力合约(价格和成交量)直接拼接而成,代码以888结尾,例如rb888。合约首次上市时, 以当日收盘同品种持仓量最大者作为从第二个交易日开始的主力合约。如果同品种其他合约持仓量在收盘后超过当前主力合约1.1倍时, 则在第二个交易日进行主力合约切换。

  • 指数合约:由该期货品种所有正在交易的合约,以持仓量加权平均计算。

1. 期货合约

1.1 期货合约代码规则


中国金融期货交易所

1.2 期货合约代码明细

示例代码

function main() {
    // 判断商品期货行情和交易连接是否正常
    while(!exchange.IO("status")) {
        Sleep(1000);
    }
    // 设置合约代码
    Log(exchange.SetContractType("IF888"));
}

返回值

{
    "InstrumentName": "沪深连续",
    "ExchangeInstID": "IF2112",
    "MaxLimitOrderVolume": 20,
    "PriceTick": 0.2,
    "MaxMarginSideAlgorithm": 49,
    "ProductID": "IF",
    "DeliveryMonth": 12,
    "MaxMarketOrderVolume": 10,
    "EndDelivDate": "20211217",
    "InstLifePhase": 49,
    "PositionType": 50,
    "UnderlyingMultiple": 1,
    "CombinationType": 48,
    "IsTrading": 1,
    "StrikePrice": 1.7976931348623157e+308,
    "ExchangeID": "CFFEX",
    "VolumeMultiple": 300,
    "DeliveryYear": 2021,
    "MinMarketOrderVolume": 1,
    "MinLimitOrderVolume": 1,
    "ExpireDate": "20211217",
    "OptionsType": 0,
    "InstrumentID": "IF2112",
    "CreateDate": "20210416",
    "PositionDateType": 50,
    "LongMarginRatio": 0.12,
    "UnderlyingInstrID": "IF",
    "ProductClass": 49,
    "OpenDate": "20210419",
    "StartDelivDate": "20211217",
    "ShortMarginRatio": 0.12
}

上海期货交易所

示例代码

function main() {
    // 判断商品期货行情和交易连接是否正常
    while(!exchange.IO("status")) {
        Sleep(1000);
    }
    // 设置合约代码
    Log(exchange.SetContractType("ag888"));
}

返回值

{
    "InstrumentName": "ag连续",
    "DeliveryMonth": 6,
    "OpenDate": "20210616",
    "StartDelivDate": "20220616",
    "PositionDateType": 49,
    "UnderlyingInstrID": "ag",
    "ProductID": "ag",
    "ProductClass": 49,
    "DeliveryYear": 2022,
    "ExchangeInstID": "ag2206",
    "EndDelivDate": "20220620",
    "MinLimitOrderVolume": 1,
    "PositionType": 50,
    "LongMarginRatio": 0.12,
    "VolumeMultiple": 15,
    "CreateDate": "20210514",
    "UnderlyingMultiple": 1,
    "ExchangeID": "SHFE",
    "MaxMarketOrderVolume": 30,
    "MaxLimitOrderVolume": 500,
    "MinMarketOrderVolume": 1,
    "OptionsType": 48,
    "MaxMarginSideAlgorithm": 49,
    "CombinationType": 48,
    "InstLifePhase": 49,
    "IsTrading": 1,
    "ShortMarginRatio": 0.12,
    "StrikePrice": 0,
    "InstrumentID": "ag2206",
    "PriceTick": 1,
    "ExpireDate": "20220615"
}

上海国际能源交易中心

示例代码

function main() {
    // 判断商品期货行情和交易连接是否正常
    while(!exchange.IO("status")) {
        Sleep(1000);
    }
    // 设置合约代码
    Log(exchange.SetContractType("bc888"));
}

返回值

{
    "ExchangeID": "INE",
    "InstLifePhase": 49,
    "LongMarginRatio": 0.1,
    "ShortMarginRatio": 0.1,
    "OptionsType": 48,
    "ExchangeInstID": "bc2202",
    "MaxLimitOrderVolume": 500,
    "StartDelivDate": "20220216",
    "EndDelivDate": "20220222",
    "MaxMarginSideAlgorithm": 49,
    "StrikePrice": 0,
    "InstrumentName": "bc连续",
    "DeliveryYear": 2022,
    "PriceTick": 10,
    "UnderlyingInstrID": "bc",
    "MinLimitOrderVolume": 1,
    "ExpireDate": "20220215",
    "UnderlyingMultiple": 1,
    "PositionType": 50,
    "InstrumentID": "bc2202",
    "ProductClass": 49,
    "DeliveryMonth": 2,
    "VolumeMultiple": 5,
    "OpenDate": "20210208",
    "CombinationType": 48,
    "ProductID": "bc",
    "MaxMarketOrderVolume": 30,
    "MinMarketOrderVolume": 1,
    "CreateDate": "20210114",
    "IsTrading": 1,
    "PositionDateType": 49
}

郑州商品交易所

示例代码

function main() {
    // 判断商品期货行情和交易连接是否正常
    while(!exchange.IO("status")) {
        Sleep(1000);
    }
    // 设置合约代码
    Log(exchange.SetContractType("AP888"));
}

返回值

{
    "InstrumentName": "苹果连续",
    "ExchangeInstID": "AP201",
    "DeliveryYear": 2022,
    "CreateDate": "20210118",
    "PositionDateType": 50,
    "InstrumentID": "AP201",
    "ExchangeID": "CZCE",
    "MaxLimitOrderVolume": 1000,
    "CombinationType": 48,
    "DeliveryMonth": 1,
    "MinMarketOrderVolume": 1,
    "EndDelivDate": "20220114",
    "PositionType": 50,
    "VolumeMultiple": 10,
    "ExpireDate": "20220114",
    "InstLifePhase": 49,
    "UnderlyingInstrID": "",
    "MaxMarketOrderVolume": 1000,
    "ShortMarginRatio": 0.1,
    "StrikePrice": 0,
    "ProductID": "AP",
    "MinLimitOrderVolume": 1,
    "StartDelivDate": "20220114",
    "IsTrading": 1,
    "LongMarginRatio": 0.1,
    "ProductClass": 49,
    "PriceTick": 1,
    "OpenDate": "20210118",
    "MaxMarginSideAlgorithm": 48,
    "OptionsType": 0,
    "UnderlyingMultiple": 1
}

大连商品交易所

示例代码

function main() {
    // 判断商品期货行情和交易连接是否正常
    while(!exchange.IO("status")) {
        Sleep(1000);
    }
    // 设置合约代码
    Log(exchange.SetContractType("a888"));
}

返回值

{
    "MaxMarginSideAlgorithm": 48,
    "InstrumentName": "豆一连续",
    "ExchangeInstID": "a2203",
    "MinMarketOrderVolume": 1,
    "UnderlyingMultiple": 0,
    "InstrumentID": "a2203",
    "ExchangeID": "DCE",
    "DeliveryYear": 2022,
    "PriceTick": 1,
    "PositionType": 50,
    "StrikePrice": 0,
    "ProductID": "a",
    "ProductClass": 49,
    "CreateDate": "20210315",
    "StartDelivDate": "",
    "IsTrading": 1,
    "LongMarginRatio": 0.12,
    "OptionsType": 0,
    "CombinationType": 48,
    "MinLimitOrderVolume": 1,
    "OpenDate": "20210315",
    "DeliveryMonth": 3,
    "MaxLimitOrderVolume": 1000,
    "VolumeMultiple": 10,
    "ExpireDate": "20220314",
    "EndDelivDate": "20220317",
    "InstLifePhase": 49,
    "ShortMarginRatio": 0.12,
    "UnderlyingInstrID": "",
    "MaxMarketOrderVolume": 1000,
    "PositionDateType": 50
}

2. 交易所套利合约

2.1 交易所套利代码规则

示例代码

function main() {
    // 判断商品期货行情和交易连接是否正常
    while(!exchange.IO("status")) {
        Sleep(1000);
    }
    // 设置合约代码
    Log(exchange.SetContractType("SPC b2201&m2201"));
}

返回值

{
    "DeliveryMonth": 0,
    "MinMarketOrderVolume": 1,
    "PriceTick": 1,
    "StartDelivDate": "",
    "PositionDateType": 50,
    "CombinationType": 48,
    "ExchangeInstID": "SPC b2201&m2201",
    "CreateDate": "",
    "OpenDate": "",
    "UnderlyingMultiple": 1,
    "DeliveryYear": 0,
    "EndDelivDate": "",
    "PositionType": 50,
    "ShortMarginRatio": 0,
    "MaxMarketOrderVolume": 1000,
    "InstLifePhase": 49,
    "IsTrading": 1,
    "UnderlyingInstrID": "",
    "StrikePrice": 0,
    "InstrumentID": "SPC b2201&m2201",
    "ExchangeID": "DCE",
    "ProductID": "SPC b&m",
    "ProductClass": 51,
    "VolumeMultiple": 0,
    "LongMarginRatio": 0,
    "InstrumentName": "SPC b2201&m2201",
    "MinLimitOrderVolume": 1,
    "ExpireDate": "",
    "MaxLimitOrderVolume": 1000,
    "MaxMarginSideAlgorithm": 48,
    "OptionsType": 0
}

3. 商品期权

商品期权是一种很好的商品风险规避和管理的金融工具,大宗商品的风险无处不在,其中最重要的是价格风险,那么就可以利用商品期权的各种套期保值工具对冲交易,来规避这种风险。

3.1 商品期权代码规则

期权的合约代码由“期货合约代码+期权类型+行权价格”组成,例如M1705-C-2500、M1705-P-2500,里面C、P分别代表看涨期权和看跌期权。如下面的图表所示:

示例代码

function main() {
    // 判断商品期货行情和交易连接是否正常
    while(!exchange.IO("status")) {
        Sleep(1000);
    }
    // 设置合约代码
    Log(exchange.SetContractType("i2211-C-740"));
}

返回值

{
    "ExpireDate": "20221014",
    "EndDelivDate": "20221014",
    "UnderlyingInstrID": "i2211",
    "InstrumentName": "i2211-C-740",
    "DeliveryYear": 2022,
    "InstLifePhase": 49,
    "UnderlyingMultiple": 1,
    "ProductClass": 50,
    "MaxLimitOrderVolume": 1000,
    "LongMarginRatio": 0,
    "ExchangeInstID": "i2211-C-740",
    "ProductID": "i_o",
    "VolumeMultiple": 100,
    "OpenDate": "20211209",
    "PositionType": 50,
    "InstrumentID": "i2211-C-740",
    "DeliveryMonth": 11,
    "MinMarketOrderVolume": 1,
    "MinLimitOrderVolume": 1,
    "IsTrading": 1,
    "PositionDateType": 50,
    "MaxMarginSideAlgorithm": 48,
    "PriceTick": 0.1,
    "ExchangeID": "DCE",
    "ShortMarginRatio": 0,
    "CombinationType": 0,
    "MaxMarketOrderVolume": 1000,
    "CreateDate": "20211209",
    "StartDelivDate": "20221014",
    "StrikePrice": 740,
    "OptionsType": 49
}
免责声明:信息仅供参考,不构成投资及交易建议。投资者据此操作,风险自担。
如果觉得文章对你有用,请随意赞赏收藏
相关推荐
相关下载
登录后评论
Copyright © 2019 宽客在线