Administrator
2024-10-10 befe1e660da97a583781d7948aebf23da8424493
bug修复
4个文件已修改
31 ■■■■ 已修改文件
api/outside_api_command_callback.py 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
servers/huaxin_trade_server.py 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/radical_buy_data_manager.py 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/init_data_util.py 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/outside_api_command_callback.py
@@ -281,6 +281,8 @@
            code_list_type = data["code_list_type"]
            operate = data["operate"]
            code = data.get("code")
            if code and not tool.is_can_buy_code(code):
                raise Exception(f"不是可以交易的代码:{code}")
            fresult = {"code": 0}
            if code_list_type == outside_api_command_manager.CODE_LIST_WANT:
                if operate == outside_api_command_manager.OPERRATE_SET:
servers/huaxin_trade_server.py
@@ -661,7 +661,8 @@
            if huaxin_util.is_deal(order_status):
                if int(str(data["direction"])) == huaxin_util.TORA_TSTP_D_Buy:
                    l2_trade_util.forbidden_trade(data["securityID"], msg="已成交", force=True)
                    if TradePointManager.get_latest_place_order_mode(data["securityID"]) == OrderBeginPosInfo.MODE_RADICAL:
                    if TradePointManager.get_latest_place_order_mode(
                            data["securityID"]) == OrderBeginPosInfo.MODE_RADICAL:
                        RadicalBuyDealCodesManager().add_deal_code(data["securityID"])
                # 成交,更新成交列表与资金列表
                huaxin_trade_data_update.add_deal_list()
@@ -847,7 +848,7 @@
                            buy_volume_rate = L2TradeDataProcessor.volume_rate_info[code][0]
                            sell_info = (0, 0)
                            if refer_sell_data:
                                sell_info = (refer_sell_data[0],refer_sell_data[1])
                                sell_info = (refer_sell_data[0], refer_sell_data[1])
                            threshold_money = 0
                            order_begin_pos_info = OrderBeginPosInfo(buy_single_index=buy_single_index,
                                                                     buy_exec_index=buy_exec_index,
@@ -873,6 +874,7 @@
                async_log_util.info(logger_l2_radical_buy, f"目前代码不可交易:{code}-{can_buy_result[1]}")
        except Exception as e:
            async_log_util.info(logger_debug, f"激进买计算异常:{str(e)}")
            logger_debug.exception(e)
# 回调
trade/radical_buy_data_manager.py
@@ -36,14 +36,10 @@
        price = gpcode_manager.get_limit_up_price_as_num(code)
        if not price:
            # 获取现价
            price =  L1DataManager.get_l1_current_price(code)
            price = L1DataManager.get_l1_current_price(code)
        if price:
            if price < constant.MIN_CODE_PRICE or price > constant.MAX_CODE_PRICE:
                return False, "价格不满足需求"
        if gpcode_manager.BlackListCodeManager().is_in_cache(code):
            return False, "已拉黑"
        return True, ""
utils/init_data_util.py
@@ -14,16 +14,13 @@
def re_set_price_pres(codes, force=False):
    # 通过历史数据缓存获取
    try:
        result = HistoryKDatasUtils.get_gp_latest_info(codes)
        for item in result:
            symbol = item['symbol']
            symbol = symbol.split(".")[1]
            pre_close = tool.to_price(decimal.Decimal(str(item['pre_close'])))
            gpcode_manager.CodePrePriceManager.set_price_pre(symbol, pre_close, force)
    except Exception as e:
        logger_debug.error(f"get_gp_latest_info异常:{codes}")
        logger_debug.exception(e)
    result = HistoryKDatasUtils.get_gp_latest_info(codes)
    for item in result:
        symbol = item['symbol']
        symbol = symbol.split(".")[1]
        pre_close = tool.to_price(decimal.Decimal(str(item['pre_close'])))
        gpcode_manager.CodePrePriceManager.set_price_pre(symbol, pre_close, force)
# 获取近90天的最大量与最近的量