# 获取期货合约资料

# get_future_info

get_future_info(code_list)

  • 介绍

    获取期货合约资料

  • 参数

    参数 类型 说明
    code_list list 股票代码列表
  • 返回

    参数 类型 说明
    ret RET_CODE 接口调用结果
    data pd.DataFrame 当 ret == RET_OK,返回期货合约资料数据
    str 当 ret != RET_OK,返回错误描述
    • 期货合约资料数据格式如下:
      字段 类型 说明
      code str 股票代码
      name str 股票名称
      owner str 标的
      exchange str 交易所
      type str 合约类型
      size float 合约规模
      size_unit str 合约规模单位
      price_currency str 报价货币
      price_unit str 报价单位
      min_change float 最小变动
      min_change_unit str 最小变动的单位
      trade_time str 交易时间
      time_zone str 时区
      last_trade_time str 最后交易时间
      exchange_format_url str 交易所规格 url
      origin_code str 实际合约代码
  • Example

from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)

ret, data = quote_ctx.get_future_info(["HK.MPImain", "HK.HAImain"])
if ret == RET_OK:
    print(data)
    print(data['code'][0])    # 取第一条的股票代码
    print(data['code'].values.tolist())   # 转为 list
else:
    print('error:', data)
quote_ctx.close() # 结束后记得关闭当条连接,防止连接条数用尽
1
2
3
4
5
6
7
8
9
10
11
  • Output
    code      name       owner exchange  type     size size_unit price_currency price_unit  min_change min_change_unit                        trade_time time_zone last_trade_time                                exchange_format_url           origin_code
0  HK.MPImain   內房期货主连  恒生中国内地地产指数      港交所  股指期货     50.0    指数点×港元             港元        指数点        0.50             指数点  (09:15 - 12:00), (13:00 - 16:30)       CCT                  https://sc.hkex.com.hk/TuniS/www.hkex.com.hk/P...           HK.MPI2112
1  HK.HAImain   海通证券期货主连    HK.06837      港交所  股票期货  10000.0         股             港元      每股/港元        0.01              港元  (09:30 - 12:00), (13:00 - 16:00)       CCT                  https://sc.hkex.com.hk/TuniS/www.hkex.com.hk/P...           HK.HAI2112
HK.MPImain
['HK.MPImain', 'HK.HAImain']
1
2
3
4
5

接口限制

  • 每 30 秒内最多请求 30 次获取期货合约资料接口
  • 每次请求的代码列表中,期货个数上限为 200 个