# Get Today's Deals

# deal_list_query

deal_list_query(code="", trd_env=TrdEnv.REAL, acc_id=0, acc_index=0, refresh_cache=False)

  • Description

    Query today's deal list of a specific trading account.
    This feature is only available for live trading and not for paper trading.

  • Parameters

    Parameter Type Description
    code str Security symbol.
    trd_env TrdEnv Trading environment.
    acc_id int Trading account ID.
    acc_index int The account number in the trading account list.
    refresh_cache bool Whether to refresh the cache.
  • Return

    Field Type Description
    ret RET_CODE Interface result.
    data pd.DataFrame If ret == RET_OK, transaction list is returned.
    str If ret != RET_OK, error description is returned.
    • Transaction list format as follows:
      Field Type Description
      trd_side TrdSide Trading direction.
      deal_id str Deal number.
      order_id str Order ID.
      code str Security code.
      stock_name str Security name.
      qty float Quantity of shares bought/sold on this fill.
      price float Fill price.
      create_time str Create time.
      counter_broker_id int Counter broker ID.
      counter_broker_name str Counter broker name.
      status DealStatus Deal status.
  • Example

from futu import *
trd_ctx = OpenSecTradeContext(filter_trdmarket=TrdMarket.HK, host='127.0.0.1', port=11111, security_firm=SecurityFirm.FUTUSECURITIES)
ret, data = trd_ctx.deal_list_query()
if ret == RET_OK:
    print(data)
    if data.shape[0] > 0:  # If the order fill list is not empty
        print(data['order_id'][0])  # Get the first order ID of the transaction list
        print(data['order_id'].values.tolist())  # Convert to list
else:
    print('deal_list_query error: ', data)
trd_ctx.close()
1
2
3
4
5
6
7
8
9
10
11
  • Output
    code stock_name              deal_id             order_id    qty  price trd_side              create_time  counter_broker_id counter_broker_name status
0  HK.00388      Hong Kong Exchanges and Clearing  5056208452274069375  4665291631090960915  100.0  370.0      BUY  2020-09-17 21:15:59.979                  5                         OK)    
4665291631090960915
['4665291631090960915']
1
2
3
4

Interface Limitations

  • A maximum of 10 requests per 30 seconds
  • It will be restricted by the frequency limit for this interface only when refresh_cache is True