# 获取历史 K 线额度使用明细

# get_history_kl_quota

get_history_kl_quota(get_detail=False)

  • 介绍

    获取历史 K 线额度使用明细

  • 参数

    参数 类型 说明
    get_detail bool 是否返回拉取历史 K 线的详细纪录
  • 返回

    参数 类型 说明
    ret RET_CODE 接口调用结果
    data tuple 当 ret == RET_OK,返回历史 K 线额度数据
    str 当 ret != RET_OK,返回错误描述
    • 历史 K 线额度数据格式如下:

      字段 类型 说明
      used_quota int 已用额度
      remain_quota int 剩余额度
      detail_list list 拉取历史 K 线的详细纪录,含股票代码和拉取时间
      • detail_list 数据列格式如下
        字段 类型 说明
        code str 股票代码
        name str 股票名称
        request_time str 最后一次拉取的时间字符串
  • Example

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

ret, data = quote_ctx.get_history_kl_quota(get_detail=True)  # 设置 true 代表需要返回详细的拉取历史 K 线的记录
if ret == RET_OK:
    print(data)
else:
    print('error:', data)
quote_ctx.close() # 结束后记得关闭当条连接,防止连接条数用尽
1
2
3
4
5
6
7
8
9
  • Output
(2, 98, {'code': 'HK.00123', 'name': '越秀地产', 'request_time': '2023-06-20 19:59:00'}, {'code': 'HK.00700', 'name': '腾讯控股', 'request_time': '2023-07-19 17:48:16'}])
1

接口限制

  • 我们会根据您账户的资产和交易的情况,下发历史 K 线额度。因此,30 天内您只能获取有限只股票的历史 K 线数据。具体规则参见 订阅额度 & 历史 K 线额度
  • 您当日消耗的历史 K 线额度,会在 30 天后自动释放。