Closed reisenmachtfreude closed 12 months ago
Recently, a timeout is returned when calling history_order_list_query() with parameters start and end. It worked well some days ago. If I skip parameters start and end, the code works fine again. I'm using Python 3.10.12 with futu-api version 7.5.3708
2023-11-13 21:04:34,071 | 17627 | [open_context_base.py] _send_init_connect_sync:311: InitConnect ok: conn_id=1, host=127.0.0.1, port=11111, user_id=33632013 2023-11-13 21:04:46,216 | 17627 | [network_manager.py] _on_packet:647: Recv: conn_id=1; proto_id=2221; serial_no=5879; data_len=0; msg=PacketErr.Timeout; -1 PacketErr.Timeout
Full example code
import datetime import pytz current_time_ts = datetime.datetime.now(pytz.timezone('Hongkong')) current_time = current_time_ts.strftime('%Y-%m-%d %H:%M:%S') from futu import * trade_ctx = OpenSecTradeContext(filter_trdmarket=TrdMarket.HK, host='127.0.0.1', port=11111, security_firm=SecurityFirm.FUTUSECURITIES) # this call works fine #ret, data = trade_ctx.history_order_list_query(trd_env=TrdEnv.SIMULATE, status_filter_list=status_filter_list) # This call ends in timeout (a week ago, it was working fine) ret, data = trade_ctx.history_order_list_query(trd_env=TrdEnv.SIMULATE, start="2023-01-01 00:00:00", end=current_time) print(ret) print(data) trade_ctx.close()
If there are too many history orders within the start to end time range, this interface might be timeout. You can try to request several times with a smaller range of history orders. Our suggestion is to request a range of 30 days once.
Recently, a timeout is returned when calling history_order_list_query() with parameters start and end. It worked well some days ago. If I skip parameters start and end, the code works fine again. I'm using Python 3.10.12 with futu-api version 7.5.3708
Full example code