# Get Real-time Broker Queue

# Get Real-time Broker Queue

get_broker_queue(code)

  • Description

    Obtain real-time data of market participants on the order book. (Require real-time data subscription.)

  • Parameters

    Parameter Type Description
    code str Stock code.
  • Return

    Field Type Description
    ret RET_CODE Interface result.
    bid_frame_table pd.DataFrame If ret == RET_OK, queue of bid brokers is returned.
    str If ret != RET_OK, error description is returned.
    ask_frame_table pd.DataFrame If ret == RET_OK, queue of ask brokers is returned.
    str If ret != RET_OK, error description is returned.
    • Queue of bid brokers format as follows:
      Field Type Description
      code str Stock code.
      name str Stock name.
      bid_broker_id int Bid broker ID.
      bid_broker_name str Bid broker name.
      bid_broker_pos int Broker level.
      order_id int Exchange order ID.
      order_volume int Order volume.
    • Queue of ask brokers format as follows:
      Field Type Description
      code str Stock code.
      name str Stock name.
      ask_broker_id int Ask Broker ID.
      ask_broker_name str Ask Broker name.
      ask_broker_pos int Broker level.
      order_id int Exchange order ID.
      order_volume int Order volume.
  • Example

from futu import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret_sub, err_message = quote_ctx.subscribe(['HK.00700'], [SubType.BROKER], subscribe_push=False)
# First subscribe to the broker queue type. After the subscription is successful, OpenD will continue to receive pushes from the server, False means that there is no need to push the data to the script temporarily
if ret_sub == RET_OK: # Subscription successful
     ret, bid_frame_table, ask_frame_table = quote_ctx.get_broker_queue('HK.00700') # Get a broker queue data
     if ret == RET_OK:
         print(bid_frame_table)
     else:
         print('error:', bid_frame_table)
else:
     print('subscription failed')
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
  • Output
    code     name  bid_broker_id                                    bid_broker_name  bid_broker_pos order_id order_volume
0   HK.00700  TENCENT           5338            J.P. Morgan Broking (Hong Kong) Limited               1      N/A          N/A
..       ...      ...            ...                                                ...             ...      ...          ...
36  HK.00700  TENCENT           8305  Futu Securities International (Hong Kong) Limited               4      N/A          N/A

[37 rows x 7 columns]
1
2
3
4
5
6

Tips