# Get Market Snapshot

# get_market_snapshot

get_market_snapshot(code_list)

  • Description

    Get market snapshot

  • Parameters

    Parameter Type Description
    code_list list Stock list
  • Return

    Parameter Type Description
    ret RET_CODE Interface result.
    data pd.DataFrame If ret == RET_OK, stock snapshot data is returned.
    str If ret != RET_OK, error description is returned.
    • Stock snapshot data format as follows:
      Field Type Description
      code str Stock code.
      name str Stock name.
      update_time str Current update time.
      last_price float Latest price.
      open_price float Open.
      high_price float High.
      low_price float Low.
      prev_close_price float Yesterday's close.
      volume int Volume.
      turnover float Turnover.
      turnover_rate float Turnover rate.
      suspension bool Is suspended or not.
      listing_date str Listing date.
      equity_valid bool Is stock or not.
      issued_shares int Total shares.
      total_market_val float Total market value.
      net_asset int Net asset value.
      net_profit int Net profit.
      earning_per_share float Earnings per share.
      outstanding_shares int Shares outstanding.
      net_asset_per_share float Net assets per share.
      circular_market_val float Circulation market value.
      ey_ratio float Yield rate.
      pe_ratio float P/E ratio.
      pb_ratio float P/B ratio.
      pe_ttm_ratio float P/E ratio TTM.
      dividend_ttm float Dividend TTM, dividend.
      dividend_ratio_ttm float Dividend rate TTM.
      dividend_lfy float Dividend LFY, dividend of the previous year.
      dividend_lfy_ratio float Dividend rate LFY.
      stock_owner str The code of the underlying stock to which the warrant belongs or the code of the underlying stock of the option.
      wrt_valid bool Is warrant or not.
      wrt_conversion_ratio float Conversion ratio.
      wrt_type WrtType Warrant type.
      wrt_strike_price float Strike price.
      wrt_maturity_date str Maturity date.
      wrt_end_trade str Last trading time.
      wrt_leverage float Leverage ratio.
      wrt_ipop float in/out of the money.
      wrt_break_even_point float Breakeven point.
      wrt_conversion_price float Conversion price.
      wrt_price_recovery_ratio float Price recovery ratio.
      wrt_score float Comprehensive score of warrant.
      wrt_code str The underlying stock of the warrant (This field has been deprecated and changed to stock_owner.).
      wrt_recovery_price float Warrant recovery price.
      wrt_street_vol float Warrant Outstanding quantity.
      wrt_issue_vol float Warrant issuance.
      wrt_street_ratio float Outstanding percentage.
      wrt_delta float Delta value of warrant.
      wrt_implied_volatility float Warrant implied volatility.
      wrt_premium float Warrant premium.
      wrt_upper_strike_price float Upper bound price.
      wrt_lower_strike_price float lower bound price.
      wrt_inline_price_status PriceType in/out of bounds
      wrt_issuer_code str Issuer code.
      option_valid bool Is option or not.
      option_type OptionType Option type.
      strike_time str The option exercise date.
      option_strike_price float Strike price.
      option_contract_size float Number of stocks per contract.
      option_open_interest int Total open contract number.
      option_implied_volatility float Implied volatility.
      option_premium float Premium.
      option_delta float Greek value Delta.
      option_gamma float Greek value Gamma.
      option_vega float Greek value Vega.
      option_theta float Greek value Theta.
      option_rho float Greek value Rho.
      index_option_type IndexOptionType Index option type.
      option_net_open_interest int Net open contract number.
      option_expiry_date_distance int The number of days from the expiry date, a negative number means it has expired.
      option_contract_nominal_value float Contract nominal amount.
      option_owner_lot_multiplier float Equal number of underlying stocks.
      option_area_type OptionAreaType Option type (by exercise time).
      option_contract_multiplier float Contract multiplier.
      plate_valid bool Is plate or not.
      plate_raise_count int Number of stocks that raises in the plate.
      plate_fall_count int Number of stocks that falls in the plate.
      plate_equal_count int Number of stocks that dose not change in price in the plate.
      index_valid bool Is index or not.
      index_raise_count int Number of stocks that raises in the plate.
      index_fall_count int Number of stocks that falls in the plate.
      index_equal_count int Number of stocks that dose not change in the plate.
      lot_size int The number of shares per lot, stock options represent the number of shares per contract
      , and futures represent contract multipliers.
      price_spread float The current upward price difference.
      ask_price float Ask price.
      bid_price float Bid price.
      ask_vol float Ask volume.
      bid_vol float Bid volume.
      enable_margin bool Whether financing is available (Deprecated).
      mortgage_ratio float Stock mortgage rate (Deprecated).
      long_margin_initial_ratio float The initial margin rate of financing (Deprecated).
      enable_short_sell bool Whether short-selling is available (Deprecated).
      short_sell_rate float Short-selling reference rate (Deprecated).
      short_available_volume int Remaining quantity that can be sold short (Deprecated).
      short_margin_initial_ratio float The initial margin rate for short selling (Deprecated).
      sec_status SecurityStatus Stock status.
      amplitude float Amplitude.
      avg_price float Average price.
      bid_ask_ratio float The Committee.
      volume_ratio float Volume ratio.
      highest52weeks_price float Highest price in 52 weeks.
      lowest52weeks_price float Lowest price in 52 weeks .
      highest_history_price float Highest historical price.
      lowest_history_price float Lowest historical price.
      pre_price float Pre-market price.
      pre_high_price float Highest pre-market price.
      pre_low_price float Lowest pre-market price.
      pre_volume int Pre-market volume.
      pre_turnover float Pre-market turnover.
      pre_change_val float Pre-market change.
      pre_change_rate float Pre-market change rate.
      pre_amplitude float Pre-market amplitude.
      after_price float After-hours price.
      after_high_price float Highest price after-hours.
      after_low_price float Lowest price after-hours.
      after_volume int After-hours trading volume.
      after_turnover float After-hours turnover.
      after_change_val float After-hours change.
      after_change_rate float After-hours change rate.
      after_amplitude float After-hours amplitude.
      future_valid bool Is futures or not.
      future_last_settle_price float Yesterday's close.
      future_position float Holding position.
      future_position_change float Change in position.
      future_main_contract bool Is future main contract or not.
      future_last_trade_time str The last trading time.
      trust_valid bool Is fund or not.
      trust_dividend_yield float Dividend rate.
      trust_aum float Asset scale.
      trust_outstanding_units int Total circulation.
      trust_netAssetValue float Net asset value.
      trust_premium float Premium.
      trust_assetClass AssetClass Asset class.
  • Example

from moomoo 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])    # Take the first stock code
    print(data['code'].values.tolist())   # Convert to list
else:
    print('error:', data)
quote_ctx.close() # After using the connection, remember to close it to prevent the number of connections from running out
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   
0  SH.600000  Shanghai Pudong Development Bank  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  \
1   HK.00700                           TENCENT  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               4990000.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   

   wrt_recovery_price  wrt_street_vol  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   
0                 NaN             NaN            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  \
1                 NaN             NaN            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   

   trust_dividend_yield  trust_aum  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                  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                  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

Interface Limitations

  • Request up to 60 snapshots every 30 seconds
  • For each request, the maximum number of stock codes supported by the parameter code_list is 400.
  • Under the authority of Hong Kong stock BMP, the maximum number of snapshots of Hong Kong securities (including warrants, CBBC, and Inline Warrants) for a single request is 20
  • Under the authority of Hong Kong futures and options BMP, the maximum number of snapshots of Hong Kong futures and options for a single request is 20