Administrator
2023-07-20 f77767b27ea2ed4dd0fbb7a98f5164df5b3d51d6
bug修复
2个文件已修改
12 ■■■■■ 已修改文件
trade/huaxin/huaxin_trade_api.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/trade_api_server.py 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/huaxin_trade_api.py
@@ -223,12 +223,12 @@
# 获取委托列表
# can_cancel:是否可以撤
def get_delegate_list(can_cancel=True, blocking=True):
def get_delegate_list(can_cancel=True, blocking=True, timeout=TIMEOUT):
    request_id, client = __request(ClientSocketManager.CLIENT_TYPE_DELEGATE_LIST,
                                   {"type": ClientSocketManager.CLIENT_TYPE_DELEGATE_LIST,
                                    "can_cancel": 1 if can_cancel else 0})
    return __read_response(client, request_id, blocking)
    return __read_response(client, request_id, blocking, timeout=timeout)
# 获取成交列表
trade/huaxin/trade_api_server.py
@@ -357,7 +357,7 @@
                hx_logger_trade_debug.info(f"获取交易数据开始:{type_}")
                if type_ == "delegate_list":
                    dataJSON = huaxin_trade_api.get_delegate_list(can_cancel=False)
                    dataJSON = huaxin_trade_api.get_delegate_list(can_cancel=False, timeout=5)
                    print("获取委托列表", dataJSON)
                    if dataJSON["code"] == 0:
                        data = dataJSON["data"]
@@ -370,13 +370,9 @@
                                    codes.append(d["securityID"])
                            if codes:
                                try:
                                    trade_manager.process_trade_delegate_data([{"code":c} for c in codes])
                                    trade_manager.process_trade_delegate_data([{"code": c} for c in codes])
                                except Exception as e:
                                    logging.exception(e)
                elif type_ == "money":
                    dataJSON = huaxin_trade_api.get_money()
                    if dataJSON["code"] == 0: