# Get Order Fee

order_fee_query(order_id_list=[], acc_id=0, acc_index=0, trd_env=TrdEnv.REAL)

  • 介绍

    Get specified orders' fee details. (Minimum version requirement: 8.2.4218)

  • 参数

    Parameter Type Description
    order_id_list list Order id list.
    trd_env TrdEnv Trading environment.
    acc_id int Trading account ID.
    acc_index int The account number in the trading account list.
  • 返回

    Field Type Description
    ret RET_CODE Interface result.
    data pd.DataFrame If ret == RET_OK, order fee list is returned.
    str If ret != RET_OK, error description is returned.
    • Order list format as follows:
      字段 类型 说明
      order_id str Order ID
      fee_amount float Total fee of the order.
      fee_details list Fee details of the order.
  • Example

from moomoo import *
trd_ctx = OpenSecTradeContext(filter_trdmarket=TrdMarket.US, host='127.0.0.1', port=11111, security_firm=SecurityFirm.FUTUSECURITIES)
ret1, data1 = trd_ctx.history_order_list_query(status_filter_list=[OrderStatus.FILLED_ALL])
if ret1 == RET_OK:
    if data1.shape[0] > 0:  # If the order list is not empty
        ret2, data2 = trd_ctx.order_fee_query(data1['order_id'].values.tolist())  # Convert order ids to list data type, and request for order fees.
        if ret2 == RET_OK:
            print(data2)
            print(data2['fee_details'][0])  # Get fee details of the first order
        else:
            print('order_fee_query error: ', data2)
else:
    print('order_list_query error: ', data1)
trd_ctx.close()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  • Output
                                            order_id  fee_amount                                        fee_details
0  v3_20240314_12345678_MTc4NzA5NzY5OTA3ODAzMzMwN       10.46  [(Commission, 5.85), (Platform Fee, 2.7), (ORF...
1  v3_20240318_12345678_MTM5Nzc5MDYxNDY1NDM1MDI1M        2.25  [(Commission, 0.99), (Platform Fee, 1.0), (Set...
[('Commission', 5.85), ('Platform Fee', 2.7), ('ORF', 0.11), ('OCC Fee', 0.18), ('Option Settlement Fees', 1.62)]
1
2
3
4

Interface Limitations

  • A maximum of 10 requests per 30 seconds.
  • Only orders after 2018-01-01 are supported.