# 獲取快照

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 盤後振幅
      overnight_price float 夜盤價格
      overnight_high_price float 夜盤最高價
      overnight_low_price float 夜盤最低價
      overnight_volume int 夜盤成交量
      overnight_turnover float 夜盤成交額
      overnight_change_val float 夜盤漲跌額
      overnight_change_rate float 夜盤漲跌幅
      overnight_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 moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)

ret, data = quote_ctx.get_market_snapshot(['HK.00700', 'US.AAPL'])
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  HK.00700  騰訊控股      2025-04-07 16:09:07      435.40      441.80      462.40     431.00            497.80  123364114  5.499476e+10          1.341       False   2004-06-16       100          0.20          NaN      435.4     435.20   281300    17300            NaN             NaN                        NaN                NaN              NaN                     NaN                         NaN      6.308    445.792        -68.499         5.627             547.00000           294.400000             706.100065            -13.202011            431.60             0    0.000000e+00     NORMAL          True     9202391012      4.006721e+12  1.051300e+12  2.095753e+11             22.774          9202391012         4.006721e+12              114.242     0.199    19.118     3.811        19.118          3.48                0.80          3.48               0.799      False                   NaN      N/A               NaN                NaN            NaN                 NaN             NaN   
1   US.AAPL    蘋果  2025-04-07 05:30:43.301      188.38      193.89      199.88     187.34            203.19  125910913  2.424473e+10          0.838       False   1980-12-12         1          0.01          NaN      180.8     180.48       29      400            NaN             NaN                        NaN                NaN              NaN                     NaN                         NaN      6.172    192.554         86.480         2.226             259.81389           163.300566             259.813890              0.053580            188.93       3151311    5.930968e+08     NORMAL          True    15022073000      2.829858e+12  6.675809e+10  9.133420e+10              6.080         15016677308         2.828842e+12                4.444     1.417    30.983    42.389        29.901          0.99                0.53          0.98               0.520      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 overnight_price overnight_high_price overnight_low_price overnight_volume overnight_turnover overnight_change_val overnight_change_rate overnight_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             N/A                  N/A                 N/A              N/A                N/A                  N/A                   N/A                 N/A  
1                      NaN                  NaN            NaN              N/A    180.68         181.98        177.47     276016  49809244.83           -7.7          -4.087         2.394       186.6          188.639          186.44            -1.78            -0.944          1.1673          176.94                186.5               174.4           533115        94944250.56               -11.44                -6.072              6.4231  
HK.00700
['HK.00700', 'US.AAPL']
1
2
3
4
5
6
7
8
9
10
11
12
13

介面限制

  • 每 30 秒內最多請求 60 次快照。
  • 每次請求,介面參數 股票代碼列表 支援傳入的標的數量上限是 400 個。