# 获取快照

get_market_snapshot(code_list)

  • 介绍

    获取快照数据

  • 参数

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

    参数 类型 说明
    ret RET_CODE 接口调用结果
    data pd.DataFrame 当 ret == RET_OK,返回股票快照数据
    str 当 ret != RET_OK,返回错误描述
    • 股票快照数据格式如下:
      字段 类型 说明
      code str 股票代码
      name str 股票名称
      update_time str 当前价更新时间
      last_price float 最新价格
      open_price float 今日开盘价
      high_price float 最高价格
      low_price float 最低价格
      prev_close_price float 昨收盘价格
      volume int 成交数量
      turnover float 成交金额
      turnover_rate float 换手率
      suspension bool 是否停牌
      listing_date str 上市日期
      equity_valid bool 是否正股
      issued_shares int 总股本
      total_market_val float 总市值
      net_asset int 资产净值
      net_profit int 净利润
      earning_per_share float 每股盈利
      outstanding_shares int 流通股本
      net_asset_per_share float 每股净资产
      circular_market_val float 流通市值
      ey_ratio float 收益率
      pe_ratio float 市盈率
      pb_ratio float 市净率
      pe_ttm_ratio float 市盈率 TTM
      dividend_ttm float 股息 TTM,派息
      dividend_ratio_ttm float 股息率 TTM
      dividend_lfy float 股息 LFY,上一年度派息
      dividend_lfy_ratio float 股息率 LFY
      stock_owner str 窝轮所属正股的代码或期权的标的股代码
      wrt_valid bool 是否是窝轮
      wrt_conversion_ratio float 换股比率
      wrt_type WrtType 窝轮类型
      wrt_strike_price float 行使价格
      wrt_maturity_date str 格式化窝轮到期时间
      wrt_end_trade str 格式化窝轮最后交易时间
      wrt_leverage float 杠杆比率
      wrt_ipop float 价内/价外
      wrt_break_even_point float 打和点
      wrt_conversion_price float 换股价
      wrt_price_recovery_ratio float 正股距收回价
      wrt_score float 窝轮综合评分
      wrt_code str 窝轮对应的正股(此字段已废除,修改为 stock_owner)
      wrt_recovery_price float 窝轮收回价
      wrt_street_vol float 窝轮街货量
      wrt_issue_vol float 窝轮发行量
      wrt_street_ratio float 窝轮街货占比
      wrt_delta float 窝轮对冲值
      wrt_implied_volatility float 窝轮引伸波幅
      wrt_premium float 窝轮溢价
      wrt_upper_strike_price float 上限价
      wrt_lower_strike_price float 下限价
      wrt_inline_price_status PriceType 界内界外
      wrt_issuer_code str 发行人代码
      option_valid bool 是否是期权
      option_type OptionType 期权类型
      strike_time str 期权行权日
      option_strike_price float 行权价
      option_contract_size float 每份合约数
      option_open_interest int 总未平仓合约数
      option_implied_volatility float 隐含波动率
      option_premium float 溢价
      option_delta float 希腊值 Delta
      option_gamma float 希腊值 Gamma
      option_vega float 希腊值 Vega
      option_theta float 希腊值 Theta
      option_rho float 希腊值 Rho
      index_option_type IndexOptionType 指数期权类型
      option_net_open_interest int 净未平仓合约数
      option_expiry_date_distance int 距离到期日天数
      option_contract_nominal_value float 合约名义金额
      option_owner_lot_multiplier float 相等正股手数
      option_area_type OptionAreaType 期权类型(按行权时间)
      option_contract_multiplier float 合约乘数
      plate_valid bool 是否为板块类型
      plate_raise_count int 板块类型上涨支数
      plate_fall_count int 板块类型下跌支数
      plate_equal_count int 板块类型平盘支数
      index_valid bool 是否有指数类型
      index_raise_count int 指数类型上涨支数
      index_fall_count int 指数类型下跌支数
      index_equal_count int 指数类型平盘支数
      lot_size int 每手股数,股票期权表示每份合约的股数
      ,期货表示合约乘数
      price_spread float 当前向上的摆盘价差
      ask_price float 卖价
      bid_price float 买价
      ask_vol float 卖量
      bid_vol float 买量
      enable_margin bool 是否可融资(已废弃)
      mortgage_ratio float 股票抵押率(已废弃)
      long_margin_initial_ratio float 融资初始保证金率(已废弃)
      enable_short_sell bool 是否可卖空(已废弃)
      short_sell_rate float 卖空参考利率(已废弃)
      short_available_volume int 剩余可卖空数量(已废弃)
      short_margin_initial_ratio float 卖空(融券)初始保证金率(已废弃)
      sec_status SecurityStatus 股票状态
      amplitude float 振幅
      avg_price float 平均价
      bid_ask_ratio float 委比
      volume_ratio float 量比
      highest52weeks_price float 52 周最高价
      lowest52weeks_price float 52 周最低价
      highest_history_price float 历史最高价
      lowest_history_price float 历史最低价
      pre_price float 盘前价格
      pre_high_price float 盘前最高价
      pre_low_price float 盘前最低价
      pre_volume int 盘前成交量
      pre_turnover float 盘前成交额
      pre_change_val float 盘前涨跌额
      pre_change_rate float 盘前涨跌幅
      pre_amplitude float 盘前振幅
      after_price float 盘后价格
      after_high_price float 盘后最高价
      after_low_price float 盘后最低价
      after_volume int 盘后成交量
      after_turnover float 盘后成交额
      after_change_val float 盘后涨跌额
      after_change_rate float 盘后涨跌幅
      after_amplitude float 盘后振幅
      future_valid bool 是否期货
      future_last_settle_price float 昨结
      future_position float 持仓量
      future_position_change float 日增仓
      future_main_contract bool 是否主连合约
      future_last_trade_time str 最后交易时间
      trust_valid bool 是否基金
      trust_dividend_yield float 股息率
      trust_aum float 资产规模
      trust_outstanding_units int 总发行量
      trust_netAssetValue float 单位净值
      trust_premium float 溢价
      trust_assetClass AssetClass 资产类别
  • Example

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

ret, data = quote_ctx.get_market_snapshot(['SH.600000', 'HK.00700'])
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          update_time  last_price  open_price  high_price  low_price  prev_close_price    volume      turnover  turnover_rate  suspension listing_date  lot_size  price_spread  stock_owner  ask_price  bid_price  ask_vol  bid_vol  enable_margin  mortgage_ratio  long_margin_initial_ratio  enable_short_sell  short_sell_rate  short_available_volume  short_margin_initial_ratio  amplitude  avg_price  bid_ask_ratio  volume_ratio  highest52weeks_price  lowest52weeks_price  highest_history_price  lowest_history_price  close_price_5min  after_volume  after_turnover sec_status  equity_valid  issued_shares  total_market_val     net_asset    net_profit  earning_per_share  outstanding_shares  circular_market_val  net_asset_per_share  ey_ratio  pe_ratio  pb_ratio  pe_ttm_ratio  dividend_ttm  dividend_ratio_ttm  dividend_lfy  dividend_lfy_ratio  wrt_valid  wrt_conversion_ratio wrt_type  wrt_strike_price  wrt_maturity_date  wrt_end_trade  wrt_recovery_price  wrt_street_vol   
0  SH.600000  浦发银行  2023-07-19 15:00:00        7.41        7.36        7.43       7.36              7.39  18189577  1.346770e+08          0.062       False   1999-11-10       100          0.01          NaN       7.41        7.4    44513   215500           True             0.0                       40.0              False              NaN                     NaN                         NaN      0.947      7.404        -24.004         1.046                  8.22             6.630000              12.080000             -2.898137              7.41             0             0.0     NORMAL          True    29352175642      2.174996e+11  6.011913e+11  5.116084e+10              1.743         29352175642         2.174996e+11               20.482     0.079     4.251     0.361         4.568         0.320                4.32         0.000               0.000      False                   NaN      N/A               NaN                NaN            NaN                 NaN             NaN  \
1   HK.00700  腾讯控股  2023-07-19 16:08:14      333.00      330.60      333.80     327.00            336.40  21913296  7.240461e+09          0.229       False   2004-06-16       100          0.20          NaN     333.00      332.8  2393100     4700           True             0.0                       30.0               True             0.93               4989900.0                        30.0      2.021    330.414        -52.783         1.025                414.20           186.226308             709.500065             -9.802011            332.60             0             0.0     NORMAL          True     9574268633      3.188231e+12  8.892772e+11  2.107392e+11             22.011          9574268633         3.188231e+12               92.882     0.244    15.128     3.585        14.638        20.523                6.16        20.523               6.163      False                   NaN      N/A               NaN                NaN            NaN                 NaN             NaN   

   wrt_issue_vol  wrt_street_ratio  wrt_delta  wrt_implied_volatility  wrt_premium  wrt_leverage  wrt_ipop  wrt_break_even_point  wrt_conversion_price  wrt_price_recovery_ratio  wrt_score  wrt_upper_strike_price  wrt_lower_strike_price wrt_inline_price_status  wrt_issuer_code  option_valid option_type  strike_time  option_strike_price  option_contract_size  option_open_interest  option_implied_volatility  option_premium  option_delta  option_gamma  option_vega  option_theta  option_rho  option_net_open_interest  option_expiry_date_distance  option_contract_nominal_value  option_owner_lot_multiplier option_area_type  option_contract_multiplier index_option_type  index_valid  index_raise_count  index_fall_count  index_equal_count  plate_valid  plate_raise_count  plate_fall_count  plate_equal_count  future_valid  future_last_settle_price  future_position  future_position_change  future_main_contract  future_last_trade_time  trust_valid  trust_dividend_yield  trust_aum   
0            NaN               NaN        NaN                     NaN          NaN           NaN       NaN                   NaN                   NaN                       NaN        NaN                     NaN                     NaN                     N/A              NaN         False         N/A          NaN                  NaN                   NaN                   NaN                        NaN             NaN           NaN           NaN          NaN           NaN         NaN                       NaN                          NaN                            NaN                          NaN              N/A                         NaN               N/A        False                NaN               NaN                NaN        False                NaN               NaN                NaN         False                       NaN              NaN                     NaN                   NaN                     NaN        False                   NaN        NaN  \
1            NaN               NaN        NaN                     NaN          NaN           NaN       NaN                   NaN                   NaN                       NaN        NaN                     NaN                     NaN                     N/A              NaN         False         N/A          NaN                  NaN                   NaN                   NaN                        NaN             NaN           NaN           NaN          NaN           NaN         NaN                       NaN                          NaN                            NaN                          NaN              N/A                         NaN               N/A        False                NaN               NaN                NaN        False                NaN               NaN                NaN         False                       NaN              NaN                     NaN                   NaN                     NaN        False                   NaN        NaN   

   trust_outstanding_units  trust_netAssetValue  trust_premium trust_assetClass pre_price pre_high_price pre_low_price pre_volume pre_turnover pre_change_val pre_change_rate pre_amplitude after_price after_high_price after_low_price after_change_val after_change_rate after_amplitude  
0                      NaN                  NaN            NaN              N/A       N/A            N/A           N/A        N/A          N/A            N/A             N/A           N/A         N/A              N/A             N/A              N/A               N/A             N/A  
1                      NaN                  NaN            NaN              N/A       N/A            N/A           N/A        N/A          N/A            N/A             N/A           N/A         N/A              N/A             N/A              N/A               N/A             N/A  
SH.600000
['SH.600000', 'HK.00700']
1
2
3
4
5
6
7
8
9
10
11
12
13

接口限制

  • 每 30 秒内最多请求 60 次快照。
  • 每次请求,接口参数 股票代码列表 支持传入的标的数量上限是 400 个。
  • 港股 BMP 权限下,单次请求的香港证券(含窝轮、牛熊、界内证)快照数量上限是 20 个。
  • 港股期权期货 BMP 权限下,单次请求的香港期货和期权的快照数量上限是 20 个。