# Get Details of Historical Candlestick Quota

get_history_kl_quota(get_detail=False)

  • Description

    Get usage details of historical candlestick quota

  • Parameters

    Parameter Type Description
    get_detail bool Whether to return the detailed record of historical candlestick pulled.
  • Return

    Field Type Description
    ret RET_CODE Interface result.
    data tuple If ret == RET_OK, historical candlestick quota is returned.
    str If ret != RET_OK, error description is returned.
    • Historical candlestick quota format as follows:

      Field Type Description
      used_quota int Used quota.
      remain_quota int Remaining quota.
      detail_list list Detailed records of historical candlestick data pulled, including stock code and pulling time.
      • detail_list, the data column format is as follows
        Field Type Description
        code str Stock code.
        name str Stock name.
        request_time str The time string of the last pull.
  • Example

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

ret, data = quote_ctx.get_history_kl_quota(get_detail=True)  # Setting True means that you need to return the detailed record of historical candlestick pulled
if ret == RET_OK:
    print(data)
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
  • Output
(2, 98,  {'code': 'HK.00123', 'name': 'YUEXIU PROPERTY', 'request_time': '2023-06-20 19:59:00'}, {'code': 'HK.00700', 'name': 'TENCENT', 'request_time': '2023-07-19 16:44:14'}])
1

Interface Restrictions

  • We will issue historical candlestick quotas based on the assets and tradings of your account. Therefore, you can only obtain historical candlestick data for a limited number of stocks within 30 days. For specific rules, please refer to Subscription Quota & Historical Candlestick Quota.
  • The historical candlestick quota you consume on that day will be automatically released after 30 days.