# Get Real-time Quote

get_stock_quote(code_list)

  • Description

    To get real-time quotes of subscribed securities, you must subscribe first.

  • Parameters

    Parameter Type Description
    code_list list Stock list. Data type of elements in the list is str.
  • Return

    Field Type Description
    ret RET_CODE Interface result.
    data pd.DataFrame If ret == RET_OK, quotation data is returned.
    str If ret != RET_OK, error description is returned.
    • quotation data format as follows:
      Field Type Description
      code str Stock code.
      data_date str Date.
      data_time str Time of latest price.
      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.
      amplitude int Amplitude.
      suspension bool Whether trading is suspended.
      listing_date str Listing date.
      price_spread float Spread.
      dark_status DarkStatus Grey market transaction status.
      sec_status SecurityStatus Stock status.
      strike_price float Strike price.
      contract_size float Contract size.
      open_interest int Number of open positions.
      implied_volatility float Implied volatility.
      premium float Premium.
      delta float Greek value Delta.
      gamma float Greek value Gamma.
      vega float Greek value Vega.
      theta float Greek value Theta.
      rho float Greek value Rho.
      index_option_type IndexOptionType Index option type.
      net_open_interest int Net open contract number.
      expiry_date_distance int The number of days from the expiry date.
      contract_nominal_value float Contract nominal amount.
      owner_lot_multiplier float Equal number of underlying stocks.
      option_area_type OptionAreaType Option type (by exercise time).
      contract_multiplier float Contract multiplier.
      pre_price float Pre-market price.
      pre_high_price float Pre-market high.
      pre_low_price float Pre-market low.
      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 After-hours high.
      after_low_price float After-hours low.
      after_volume int After-hours 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.
      overnight_price float Overnight price.
      overnight_high_price float Overnight high.
      overnight_low_price float Overnight low.
      overnight_volume int Overnight volume.
      overnight_turnover float Overnight turnover.
      overnight_change_val float Overnight change.
      overnight_change_rate float Overnight change rate.
      overnight_amplitude float Overnight amplitude.
      last_settle_price float Yesterday's close.
      position float Holding position.
      position_change float Daily position change.
  • Example

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

ret_sub, err_message = quote_ctx.subscribe(['US.AAPL'], [SubType.QUOTE], subscribe_push=False)
# Subscribe to the K line type first. After the subscription is successful, OpenD will continue to receive pushes from the server, False means that there is no need to push to the script temporarily
if ret_sub == RET_OK: # Subscription successful
     ret, data = quote_ctx.get_stock_quote(['US.AAPL']) # Get real-time data of subscription stock quotes
     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)
else:
     print('subscription failed', err_message)
quote_ctx.close() # Close the current connection, OpenD will automatically cancel the corresponding type of subscription for the corresponding stock after 1 minute
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  • Output
code name   data_date     data_time  last_price  open_price  high_price  low_price  prev_close_price     volume      turnover  turnover_rate  amplitude  suspension listing_date  price_spread dark_status sec_status strike_price contract_size open_interest implied_volatility premium delta gamma vega theta  rho net_open_interest expiry_date_distance contract_nominal_value owner_lot_multiplier option_area_type contract_multiplier last_settle_price position position_change index_option_type  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_volume  after_turnover  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  US.AAPL   APPLE  2025-04-07  05:37:21.794      188.38      193.89      199.88     187.34            203.19  125910913  2.424473e+10          0.838      6.172       False   1980-12-12          0.01         N/A     NORMAL          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     181.43          181.98         177.47      288853   52132735.18           -6.95           -3.689          2.394        186.6           188.639           186.44       3151311    5.930968e+08             -1.78             -0.944           1.1673           176.94                 186.5                174.4            533115         94944250.56                -11.44                 -6.072               6.4231
US.AAPL
['US.AAPL']
1
2
3
4

Tips