admin
2025-04-14 ea616067fa6b3305317ea45efce862d4156651da
交易接口日志
2个文件已修改
36 ■■■■ 已修改文件
strategy/order_methods.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin_trade_api.py 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/order_methods.py
@@ -65,7 +65,7 @@
                    logger.info(f"【{i['securityName']}】交易失败~")
                else:
                    # 买票后添加 持仓代码集合
                    data_cache.position_symbols_set.add(symbol)
                    data_cache.position_symbols_set.add(symbol[-6:])
                    logger.info(f"【{i['securityName']}】交易成功!")
trade/huaxin_trade_api.py
@@ -400,9 +400,11 @@
                               is_trade=True)
    try:
        if blocking:
            return __read_response(request_id, blocking)
            res = __read_response(request_id, blocking)
        else:
            return {"order_ref": order_ref}
            res = {"order_ref": order_ref}
        async_log_util.info(hx_logger_trade_debug, f"下单结果:{res}")
        return res
    finally:
        # huaxin_trade_data_update.add_delegate_list("下单", delay=0.2)
        huaxin_trade_data_update.add_money_list()
@@ -425,7 +427,8 @@
    :param recancel:
    :return:
    """
    if tool.trade_time_sub(tool.get_now_time_str(), "14:57:00") >= 0 and tool.trade_time_sub(tool.get_now_time_str(),"15:00:01") <= 0:
    if tool.trade_time_sub(tool.get_now_time_str(), "14:57:00") >= 0 and tool.trade_time_sub(tool.get_now_time_str(),
                                                                                             "15:00:01") <= 0:
        # 集合竞价不撤单
        return
@@ -448,7 +451,9 @@
                                "orderActionRef": order_action_ref,
                                "orderSysID": orderSysID, "sinfo": sinfo}, request_id=request_id, is_trade=True)
    try:
        return __read_response(request_id, blocking)
        res = __read_response(request_id, blocking)
        async_log_util.info(hx_logger_trade_debug, f"撤单结果:{res}")
        return res
    finally:
        # huaxin_trade_data_update.add_delegate_list("撤单")
        huaxin_trade_data_update.add_money_list()
@@ -474,7 +479,11 @@
                           {"type": ClientSocketManager.CLIENT_TYPE_DELEGATE_LIST,
                            "can_cancel": 1 if can_cancel else 0})
    return __read_response(request_id, blocking, timeout=timeout)
    res = __read_response(request_id, blocking, timeout=timeout)
    async_log_util.info(hx_logger_trade_debug, f"获取委托列表:{res}")
    return res
# 获取成交列表
@@ -487,7 +496,10 @@
    """
    request_id = __request(ClientSocketManager.CLIENT_TYPE_DEAL_LIST,
                           {"type": ClientSocketManager.CLIENT_TYPE_DEAL_LIST})
    return __read_response(request_id, blocking, timeout=timeout)
    res = __read_response(request_id, blocking, timeout=timeout)
    async_log_util.info(hx_logger_trade_debug, f"获取成交列表:{res}")
    return res
# todo 获取华鑫持仓列表 后续即可实现仓位管理
# 获取持仓列表
@@ -499,7 +511,10 @@
    """
    request_id = __request(ClientSocketManager.CLIENT_TYPE_POSITION_LIST,
                           {"type": ClientSocketManager.CLIENT_TYPE_POSITION_LIST})
    return __read_response(request_id, blocking)
    res = __read_response(request_id, blocking)
    async_log_util.info(hx_logger_trade_debug, f"获取持仓结果:{res}")
    return res
# todo 获取华鑫账户资金 后续即可实现账户管理
# 获取账户资金状况
@@ -511,7 +526,10 @@
    """
    request_id = __request(ClientSocketManager.CLIENT_TYPE_MONEY,
                           {"type": ClientSocketManager.CLIENT_TYPE_MONEY})
    return __read_response(request_id, blocking)
    res = __read_response(request_id, blocking)
    async_log_util.info(hx_logger_trade_debug, f"获取账户结果:{res}")
    return res
# money = get_money()
# print(f"money=={money}")