from futu import * quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111) ret, data, page_req_key = quote_ctx.request_history_kline('HK.00700', autype=AuType.NONE, start='2021-10-03', end='2021-11-08', max_count=50) # 每页5个,请求第一页 if ret == RET_OK: print(data) print(data['code'][0]) # 取第一条的股票代码 print(data['close'].values.tolist()) # 第一页收盘价转为 list else: print('error:', data) while page_req_key != None: # 请求后面的所有结果 print('*************************************') ret, data, page_req_key = quote_ctx.request_history_kline('HK.00700', start='2024-04-11', end='2024-06-18', max_count=50, page_req_key=page_req_key) # 请求翻页后的数据 if ret == RET_OK: print(data) else: print('error:', data) print('All pages are finished!') quote_ctx.close() # 结束后记得关闭当条连接,防止连接条数用尽