# ContextInfo.get_instrumentdetail - 获取合约详细信息 根据代码获取合约详细信息 规范地址:https://quantx.asia/docs/qmt/builtin-python/api-reference/contextinfo-get-instrumentdetail/ 适用平台:QMT 内置 Python;运行环境:builtin-python 内容更新:2026-10-11 资料核验:2026-10-11 资料来源: - [官方来源](https://dict.thinktrader.net/VBA/check_sheet.html) --- ## 功能说明 根据代码获取合约详细信息 ## 原型 ```python ContextInfo.get_instrumentdetail(stockcode) ``` ## 参数 | 参数 | 类型 | 说明 | | --- | --- | --- | | stockcode | string | 股票代码,例如 600000.SH。 | ## 返回值 根据stockcode返回一个dict。该字典数据key值有: ExchangeID:合约市场代码 InstrumentID:合约代码 InstrumentName:合约名称 ProductID:合约的品种ID(期货) ProductName:合约的品种名称(期货) CreateDate:上市日期(期货) OpenDate:IPO日期(股票) ExpireDate:退市日或者到期日 PreClose:前收盘价格 SettlementPrice:前结算价格 UpStopPrice:当日涨停价 DownStopPrice:当日跌停价 FloatVolumn:流通股本 TotalVolumn:总股本 LongMarginRatio:多头保证金率 ShortMarginRatio:空头保证金率 PriceTick:最小变价单位 VolumeMultiple:合约乘数(对期货以外的品种,默认是1) MainContract:主力合约标记 LastVolume: 昨日持仓量 InstrumentStatus:合约停牌状态 IsTrading:合约是否可交易 IsRecent:是否是近月合约 ## 示例 以下代码依据官方示例整理缩进,并将旧式 print 写法改为函数调用;账号使用占位值。 ```python def handlebar(ContextInfo): print(ContextInfo.get_instrumentdetail('600000.SH')) ``` ## 官方来源 [迅投 QMT 官方函数检索表](https://dict.thinktrader.net/VBA/check_sheet.html),条目 `ContextInfo.get_instrumentdetail`。本页属于 QMT 内置 Python 接口;原站函数检索表同时收录其他语言,不能按网页路径将本条目误归为 VBA。网页核对日期:2026-10-11。