资源加载中... loading...

优宽量化商品期货合约代码明细

Author: 扫地僧, Created: 2021-12-09 14:14:05, Updated: 2024-06-20 17:31:48

[TOC]

img

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

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

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

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

1. 期货合约

1.1 期货合约代码规则

交易所 具体合约规则 主力连续合约 指数合约 具体合约
中国金融期货交易所 品种代码(大写) + 交割年份(2位) + 交割月份(2位) IF888 IF000 IF2201
上海期货交易所 品种代码(小写) + 交割年份(2位) + 交割月份(2位) ag888 ag000 ag2201
上海国际能源交易中心 品种代码(小写) + 交割年份(2位) + 交割月份(2位) bc888 bc000 bc2201
郑州商品交易所 品种代码(大写) + 交割年份(1位) + 交割月份(2位) AP888 AP000 AP201
大连商品交易所 品种代码(小写) + 交割年份(2位) + 交割月份(2位) a888 a000 a2201

1.2 期货合约代码明细

中国金融期货交易所

名称 主力合约代码 指数合约代码 具体合约代码
沪深300指数 IF888 IF000 IF2201
中证500指数 IC888 IC000 IC2201
上证50指数 IH888 IH000 IH2201
2年期国债期货 TS888 TS000 TS2201
5年期国债期货 TF888 TF000 TF2201
10年期国债期货 T888 T000 T2201

示例代码

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
}

上海期货交易所

名称 主力合约代码 指数合约代码 具体合约代码
白银 ag888 ag000 ag2201
al888 al000 al2201
黄金 au888 au000 au2201
石油沥青 bu888 bu000 bu2201
cu888 cu000 cu2201
燃料油 fu888 fu000 fu2201
热轧卷板 hc888 hc000 hc2201
ni888 ni000 ni2201
pb888 pb000 pb2201
螺纹钢 rb888 rb000 rb2201
天然橡胶 ru888 ru000 ru2201
sn888 sn000 sn2201
纸浆 sp888 sp000 sp2201
不锈钢 ss888 ss000 ss2201
线材 wr888 wr000 wr2201
zn888 zn000 zn2201

示例代码

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"
}

上海国际能源交易中心

名称 主力合约代码 指数合约代码 具体合约代码
阴极铜 bc888 bc000 bc2201
低硫燃料油 lu888 lu000 lu2201
20号胶 nr888 nr000 nr2201
原油 sc888 sc000 sc2201

示例代码

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
}

郑州商品交易所

名称 主力合约代码 指数合约代码 具体合约代码
苹果 AP888 AP000 AP201
棉花 CF888 CF000 CF201
红枣 CJ888 CJ000 CJ201
棉纱 CY888 CY000 CY201
早籼稻 ER888 ER000 ER201
玻璃 FG888 FG000 FG201
绿豆 GN888 GN000 GN201
粳稻谷 JR888 JR000 JR201
晚籼稻 LR888 LR000 LR201
甲醇 MA888 MA000 MA201
甲醇 ME888 ME000 ME201
菜籽油 OI888 OI000 OI201
短纤 PF888 PF000 PF201
花生 PK888 PK000 PK201
普麦 PM888 PM000 PM201
早籼稻 RI888 RI000 RI201
菜籽粕 RM888 RM000 RM201
菜籽油 RO888 RO000 RO201
油菜籽 RS888 RS000 RS201
纯碱 SA888 SA000 SA201
硅铁 SF888 SF000 SF201
锰硅 SM888 SM000 SM201
白糖 SR888 SR000 SR201
PTA TA888 TA000 TA201
动力煤 TC888 TC000 TC201
尿素 UR888 UR000 UR201
强麦 WH888 WH000 WH201
强麦 WS888 WS000 WS201
硬白小麦 WT888 WT000 WT201
动力煤 ZC888 ZC000 ZC201

示例代码

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
}

大连商品交易所

名称 主力合约代码 指数合约代码 具体合约代码
豆一 a888 a000 a2201
豆二 b888 b000 b2201
胶合板 bb888 bb000 bb2201
玉米 c888 c000 c2201
玉米淀粉 cs888 cs000 cs2201
苯乙烯 eb888 eb000 eb2201
乙二醇 eg888 eg000 eg2201
纤维板 fb888 fb000 fb2201
铁矿石 i888 i000 i2201
焦炭 j888 j000 j2201
鸡蛋 jd888 jd000 jd2201
焦煤 jm888 jm000 jm2201
聚乙烯 l888 l000 l2201
生猪 lh888 lh000 lh2201
豆粕 m888 m000 m2201
棕榈油 p888 p000 p2201
液化石油气 pg888 pg000 pg2201
聚丙烯 pp888 pp000 pp2201
粳米 rr888 rr000 rr2201
聚氯乙烯 v888 v000 v2201
豆油 y888 y000 y2201

示例代码

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 交易所套利代码规则

交易所 类型 具体合约规则 具体合约
郑州商品交易所 跨期 SPD 代码年份月份&代码年份月份 SPD OI201&OI205
郑州商品交易所 跨品种 IPS 代码年份月份&代码年份月份 IPS FG205&SA205
大连商品交易所 跨期 SP 代码年份月份&代码年份月份 SP v2201&v2205
大连商品交易所 跨品种 SPC 代码年份月份&代码年份月份 SPC b2201&m2201

示例代码

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分别代表看涨期权和看跌期权。如下面的图表所示:

img

示例代码

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
}

更多内容

比特币吸血鬼 你好怎么联系