Administrator
2024-11-07 93ec042ae730c8e4cad1562d7ee579941847397c
扫入整改
14个文件已修改
236 ■■■■■ 已修改文件
api/outside_api_command_callback.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
code_attribute/code_nature_analyse.py 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
code_attribute/first_target_code_data_processor.py 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/trade_client.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_limitup_sell_data_manager.py 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_transaction_data_processor.py 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/place_order_single_data_manager.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
servers/huaxin_trade_server.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/code_plate_key_manager.py 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_data_constant.py 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/radical_buy_data_manager.py 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/radical_buy_strategy.py 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/trade_data_manager.py 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/trade_result_manager.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/outside_api_command_callback.py
@@ -934,7 +934,7 @@
                            limit_up_price = gpcode_manager.get_limit_up_price(code)
                            buy1_money = Buy1PriceManager().get_latest_buy1_money(code)
                            if buy1_money is None:
                                buy1_money = 0
                                buy1_money = 1
                            # 获取已经成交的大单数量
                            total_big_num = 0
                            total_big_count = 0
@@ -1210,7 +1210,7 @@
                # 获取大单成交列表
                code = data["code"]
                data_list = BigOrderDealManager().get_total_buy_money_list(code)
                bigger_money = l2_data_util_old.get_big_money_val(float(gpcode_manager.get_limit_up_price(code)),
                bigger_money = l2_data_util_old.get_big_money_val(gpcode_manager.get_limit_up_price_as_num(code),
                                                                  tool.is_ge_code(code))
                fdatas = []
                for d in data_list:
code_attribute/code_nature_analyse.py
@@ -404,7 +404,8 @@
    # if max_price > float(limit_up_price):
    #     return False
    rate = (float(limit_up_price) - min_price_info[1]["close"]) / min_price_info[1]["close"]
    if rate >= 0.319:
    THRESHOLD_RATE = 0.319*2 if tool.is_ge_code(code) else 0.319
    if rate >= THRESHOLD_RATE:
        return True, rate
    return False, rate
code_attribute/first_target_code_data_processor.py
@@ -121,7 +121,8 @@
                max_volume_in_5_days = init_data_util.parse_max_volume_in_days(volumes_data, 5)
                async_log_util.info(logger_first_code_record, f"{code} 获取到首板60天最大量:{volumes}")
                code_volumn_manager.CodeVolumeManager().set_histry_volumn(code, volumes[0], volumes[1], volumes[2], volumes[3], max_volume_in_5_days)
                code_volumn_manager.CodeVolumeManager().set_histry_volumn(code, volumes[0], volumes[1], volumes[2],
                                                                          volumes[3], max_volume_in_5_days)
                # 保存K线形态
                k_format = code_nature_analyse.get_k_format(code, limit_up_price, volumes_data)
@@ -129,26 +130,25 @@
                # 是否具有辨识度
                is_special = True if k_format and k_format[8][0] else False
                if not WantBuyCodesManager().is_in_cache(code) and not gpcode_manager.BuyOpenLimitUpCodeManager().is_in_cache(code):
                if not WantBuyCodesManager().is_in_cache(
                        code) and not gpcode_manager.BuyOpenLimitUpCodeManager().is_in_cache(code):
                    # 不是想买单,也不是排一的代码
                    if not is_special:
                        situation = MarketSituationManager().get_situation_cache()
                        zylt_threshold_as_yi = buy_condition_util.get_zyltgb_threshold(situation)
                        if global_util.zyltgb_map.get(code) and global_util.zyltgb_map.get(code) > zylt_threshold_as_yi[
                            1] * 100000000:
                            l2_trade_util.forbidden_trade(code,
                                                          f"无辨识度,自由流通市值({global_util.zyltgb_map.get(code) // 100000000})>{zylt_threshold_as_yi[1]}亿")
                            continue
                        elif limit_up_price and float(limit_up_price) >= constant.MAX_CODE_PRICE:
                            l2_trade_util.forbidden_trade(code,
                                                          f"无辨识度,涨停价({limit_up_price})>{constant.MAX_CODE_PRICE}")
                            continue
                    if code_nature_analyse.is_price_too_high_in_days(code, volumes_data, limit_up_price)[
                        0] and code.find("30") != 0:
                    # if not is_special:
                    #     situation = MarketSituationManager().get_situation_cache()
                    #     zylt_threshold_as_yi = buy_condition_util.get_zyltgb_threshold(situation)
                    #     if global_util.zyltgb_map.get(code) and global_util.zyltgb_map.get(code) > zylt_threshold_as_yi[
                    #         1] * 100000000:
                    #         l2_trade_util.forbidden_trade(code,
                    #                                       f"无辨识度,自由流通市值({global_util.zyltgb_map.get(code) // 100000000})>{zylt_threshold_as_yi[1]}亿")
                    #         continue
                    #     elif limit_up_price and float(limit_up_price) >= constant.MAX_CODE_PRICE:
                    #         l2_trade_util.forbidden_trade(code,
                    #                                       f"无辨识度,涨停价({limit_up_price})>{constant.MAX_CODE_PRICE}")
                    #         continue
                    if code_nature_analyse.is_price_too_high_in_days(code, volumes_data, limit_up_price)[0]:
                        # 判断是否太高
                        l2_trade_util.forbidden_trade(code, "6天内股价长得太高")
                        continue
                        pass
                    if len(k_format) > 14 and k_format[14]:
                        l2_trade_util.forbidden_trade(code, "昨日炸板")
huaxin_client/trade_client.py
@@ -645,7 +645,7 @@
                            pRspInfoField: "CTORATstpRspInfoField", nRequestID: "int") -> "void":
        try:
            if pInputOrderActionField and pRspInfoField:
                async_log_util.info(logger_local_huaxin_trade_debug, 'OnErrRtnOrderAction: Error! [%d] [%d] [%d] [%s]'
                async_log_util.info(logger_local_huaxin_trade_debug, 'OnErrRtnOrderAction: Error! [%s] [%s] [%s] [%s]'
                                    % (nRequestID, pInputOrderActionField.OrderSysID,
                                       pRspInfoField.ErrorID,
                                       pRspInfoField.ErrorMsg))
@@ -1196,5 +1196,5 @@
    # while True:
    #     time.sleep(1)
    run()
    input()
l2/l2_limitup_sell_data_manager.py
@@ -48,14 +48,16 @@
                        # 卖撤
                        cls.__order_no_set_dict[code].discard(order_no)
                        cls.__delegating_sell_num_dict[code] -= volume
                        async_log_util.l2_data_log.info(hx_logger_l2_sell_delegate, f"{code}-卖撤-{order_no, price, volume}")
                        async_log_util.l2_data_log.info(hx_logger_l2_sell_delegate,
                                                        f"{code}-卖撤-{order_no, price, volume}")
                else:
                    if d[3] != '1':
                        # 卖
                        cls.__order_no_data_map_dict[code][order_no] = (order_no, price, volume)
                        cls.__order_no_set_dict[code].add(order_no)
                        cls.__delegating_sell_num_dict[code] += volume
                        async_log_util.l2_data_log.info(hx_logger_l2_sell_delegate, f"{code}-卖-{order_no, price, volume}")
                        async_log_util.l2_data_log.info(hx_logger_l2_sell_delegate,
                                                        f"{code}-卖-{order_no, price, volume}")
        except:
            pass
@@ -79,7 +81,7 @@
        try:
            limit_up_price = gpcode_manager.get_limit_up_price_as_num(code)
            has_limit_up_active_buy = False
            order_no_set =  cls.__order_no_set_dict.get(code)
            order_no_set = cls.__order_no_set_dict.get(code)
            if order_no_set is None:
                order_no_set = set()
            for d in datas:
@@ -90,16 +92,18 @@
                    continue
                has_limit_up_active_buy = True
                break
            total_deal_volume = 0
            if code in cls.__delegating_sell_num_dict:
                for d in datas:
                    # 减去
                    if d[7] in order_no_set:
                        cls.__delegating_sell_num_dict[code] -= d[2]
                        total_deal_volume += d[2]
                cls.__delegating_sell_num_dict[code] -= total_deal_volume
            if has_limit_up_active_buy:
                # 打印日志
                async_log_util.l2_data_log.info(hx_logger_l2_sell_deal, f"有涨停主动卖:{code}-{datas[-1][3]}-{ cls.__delegating_sell_num_dict.get(code)}")
                async_log_util.l2_data_log.info(hx_logger_l2_sell_deal,
                                                f"有涨停主动卖:{code}-{datas[-1][3]}-{cls.__delegating_sell_num_dict.get(code)}, 成交量-{total_deal_volume}")
        except:
            pass
@@ -118,5 +122,3 @@
        if code in cls.__delegating_sell_num_dict:
            cls.__delegating_sell_num_dict.pop(code)
l2/l2_transaction_data_processor.py
@@ -21,7 +21,7 @@
from trade import current_price_process_manager, trade_constant
import concurrent.futures
from trade.radical_buy_data_manager import RedicalBuyDataManager, EveryLimitupBigDealOrderManager
from trade.radical_buy_data_manager import RadicalBuyDataManager, EveryLimitupBigDealOrderManager
from utils import tool
@@ -60,7 +60,7 @@
            is_placed_order = l2_data_manager.TradePointManager.is_placed_order(order_begin_pos)
            if is_placed_order:
                if order_begin_pos and order_begin_pos.mode == OrderBeginPosInfo.MODE_RADICAL:
                    RedicalBuyDataManager.big_order_deal(code)
                    RadicalBuyDataManager.big_order_deal(code)
            if is_placed_order and bigger_buy_datas:
                # 有大于50w的大单成交
@@ -106,6 +106,17 @@
            order_begin_pos = l2_data_manager.TradePointManager().get_buy_compute_start_data_cache(code)
            # 是否已经下单
            is_placed_order = l2_data_manager.TradePointManager.is_placed_order(order_begin_pos)
            _start_time = time.time()
            L2LimitUpSellDataManager.set_deal_datas(code, datas)
            #  大单统计
            # cls.__statistic_thread_pool.submit(cls.statistic_big_order_infos, code, datas, order_begin_pos)
            try:
                cls.statistic_big_order_infos(code, datas, order_begin_pos)
            except Exception as e:
                hx_logger_l2_debug.error(f"统计大单出错:{str(e)}")
            use_time_list.append(("统计买单数据", time.time() - _start_time))
            _start_time = time.time()
            big_sell_order_info = None
            try:
@@ -163,16 +174,7 @@
            except Exception as e:
                async_log_util.error(logger_debug, f"卖单统计异常:{big_sell_order_info}")
                logger_debug.exception(e)
            _start_time = time.time()
            L2LimitUpSellDataManager.set_deal_datas(code, datas)
            #  大单统计
            # cls.__statistic_thread_pool.submit(cls.statistic_big_order_infos, code, datas, order_begin_pos)
            try:
                cls.statistic_big_order_infos(code, datas, order_begin_pos)
            except Exception as e:
                hx_logger_l2_debug.error(f"统计大单出错:{str(e)}")
            use_time_list.append(("统计买单数据", time.time() - _start_time))
            _start_time = time.time()
            # if big_money_count > 0:
            #     LCancelRateManager.compute_big_num_deal_rate(code)
l2/place_order_single_data_manager.py
@@ -42,7 +42,6 @@
        if code in cls.__latest_limit_up_sell_list_dict:
            cls.__latest_limit_up_sell_list_dict.pop(code)
        if code in cls.__latest_limit_up_sell_order_no_set_dict:
            async_log_util.info(logger_debug, f"清除被动卖相关数据:{code}")
            cls.__latest_limit_up_sell_order_no_set_dict.pop(code)
    @classmethod
servers/huaxin_trade_server.py
@@ -52,7 +52,7 @@
from api.outside_api_command_callback import OutsideApiCommandCallback
from trade.huaxin.huaxin_trade_record_manager import DelegateRecordManager
from trade.order_statistic import DealAndDelegateWithBuyModeDataManager
from trade.radical_buy_data_manager import RedicalBuyDataManager
from trade.radical_buy_data_manager import RadicalBuyDataManager
from trade.sell.sell_rule_manager import TradeRuleManager
from trade.trade_data_manager import RadicalBuyDealCodesManager
from trade.trade_manager import CodesTradeStateManager
@@ -827,7 +827,7 @@
                return
            # 单票是否可买
            can_buy_result = RedicalBuyDataManager.can_buy(code)
            can_buy_result = RadicalBuyDataManager.is_code_can_buy(code)
            if can_buy_result[0]:
                # 获取激进买的板块
                result_cache = self.__radical_buy_by_blocks_result_cache.get(code)
third_data/code_plate_key_manager.py
@@ -16,7 +16,7 @@
from third_data.third_blocks_manager import BlockMapManager, CodeThirdBlocksManager
from trade.buy_money_count_setting import RadicalBuyBlockCodeCountManager
from trade.order_statistic import DealAndDelegateWithBuyModeDataManager
from trade.radical_buy_data_manager import RedicalBuyDataManager
from trade.radical_buy_data_manager import RadicalBuyDataManager
from utils import global_util, tool, buy_condition_util
from log_module import log, async_log_util
from db import redis_manager_delegate as redis_manager
@@ -1176,7 +1176,12 @@
            blocks -= constant.KPL_INVALID_BLOCKS
            # 过滤
            blocks = BlockMapManager().filter_blocks(blocks)
            temp_dict[code] = (kpl_util.get_high_level_count(d[4]), blocks)
            # 开1剔除4板以上的
            high_level = kpl_util.get_high_level_count(d[4])
            if high_level >= 4:
                continue
            temp_dict[code] = (high_level, blocks)
        kpl_data_constant.open_limit_up_code_dict_for_radical_buy = temp_dict
    @classmethod
@@ -1264,7 +1269,6 @@
            if _code in exclude_codes:
                continue
            blocks = LimitUpDataConstant.get_blocks_with_history(_code)
            blocks = BlockMapManager().filter_blocks(blocks)
            if _code == code:
                # 获取当前代码涨停时间
                limit_up_time = int(k[5])
@@ -1313,7 +1317,7 @@
        # 9:45点之前涨停的才能买入
        # 获取当前代码的涨停时间
        limit_up_timestamp = cls.__get_limit_up_timestamp(code)
        if int(tool.timestamp_format(limit_up_timestamp, "%H%M%S")) > 94500:
        if tool.get_now_time_as_int() > 100000:
            return False, "超过生效时间"
        # 根据板块聚合数据
        open_limit_up_block_codes_dict = {}
@@ -1333,12 +1337,26 @@
        current_index, current_before_codes_info = cls.__get_current_index(code, block, yesterday_limit_up_codes,
                                                                           limit_up_time=limit_up_timestamp)
        exclude_codes = set()
        if count >= 2 or (
                count == 1 and kpl_data_constant.open_limit_up_code_dict_for_radical_buy[open_limit_up_block_codes[0]][
            0] == 2):
        # 是否为强势二板开1:该代码所有的慨念必须都为二板开1且开1的只能有他自己
        is_strong_2_level = count == 1 and \
                            kpl_data_constant.open_limit_up_code_dict_for_radical_buy[open_limit_up_block_codes[0]][
                                0] == 2
        if is_strong_2_level:
            _code = open_limit_up_block_codes[0]
            blocks = LimitUpDataConstant.get_blocks_with_history(_code)
            if blocks:
                # 所有的慨念的开1代码必须只有他自己
                for b in blocks:
                    temp_codes = open_limit_up_block_codes_dict.get(b)
                    if temp_codes and len(temp_codes) > 1:
                        is_strong_2_level = False
                        break
        if count >= 2 or is_strong_2_level:
            # 开始数量大于2个或者只有一个2板开1
            exclude_codes.clear()
        else:
            # 只有一个开1
            # 获取包含高位板的身位
            # ----获取历史身位----
            history_index, history_before_codes_info = cls.__get_history_index(code, block, set())
@@ -1347,17 +1365,19 @@
                                                                               limit_up_time=limit_up_timestamp)
            if history_before_codes_info and current_before_codes_info and history_before_codes_info[0][0] == \
                    current_before_codes_info[0][0]:
                # 前排第一个元素无炸板
                # 排除第一个非开1数据
                exclude_codes = {history_before_codes_info[0][0]}
            else:
                return False, f"开1数量:{count},历史-{history_index + 1} 实时-{current_index + 1}"
        # 获取主板的身位
        # 获取主板的身位(已经排除了开1的代码)
        history_index, history_before_codes_info = cls.__get_history_index(code, block,
                                                                           yesterday_limit_up_codes,
                                                                           exclude_codes=exclude_codes)
        # 过滤不正的原因
        history_index, history_before_codes_info = cls.__filter_before_codes(block, history_index, history_before_codes_info, yesterday_limit_up_codes)
        history_index, history_before_codes_info = cls.__filter_before_codes(block, history_index,
                                                                             history_before_codes_info,
                                                                             yesterday_limit_up_codes)
        # 买首板老大/老二
        # 首板老大不能买时可买老二
@@ -1365,8 +1385,8 @@
            return False, f"开1数量:{count},非开1首板身位不匹配:历史-{history_index + 1} 实时-{current_index + 1}"
        if history_index == 1:
            # 当前代码为老2,要判断老大是否可买
            if RedicalBuyDataManager.can_buy(history_before_codes_info[0][0],
                                             DealAndDelegateWithBuyModeDataManager().get_deal_codes())[0]:
            if RadicalBuyDataManager.is_code_can_buy(history_before_codes_info[0][0],
                                                     DealAndDelegateWithBuyModeDataManager().get_deal_codes())[0]:
                return False, f"开1数量:{count},前排代码可买:{history_before_codes_info[0]}"
            return True, f"开1数量:{count},前排代码不可买:{history_before_codes_info[0]},历史前排-{history_before_codes_info},开1代码-{open_limit_up_block_codes}"
        return True, f"开1数量:{count},历史-{history_index + 1} 实时-{current_index + 1}, 前排代码-{current_before_codes_info}, 开1代码-{open_limit_up_block_codes}"
@@ -1436,13 +1456,17 @@
                               tool.timestamp_format(current_before_codes_info[-1][1], '%H:%M:%S')) >= 10 * 60:
            return False, f"距离上个代码涨停已过去10分钟({current_before_codes_info[0]})"
        history_index, history_before_codes_info = cls.__get_history_index(code, block, set())
        history_before_codes = [x[0] for x in history_before_codes_info]
        # 包含高位板的整体排序
        all_history_index, all_history_before_codes_info = cls.__get_history_index(code, block, set())
        all_history_before_codes = [x[0] for x in all_history_before_codes_info]
        # 前两个代码是否有炸板
        dif_codes = set(history_before_codes[:2]) - set(current_before_codes[:2])
        dif_codes = set(all_history_before_codes[:2]) - set(current_before_codes[:2])
        if dif_codes:
            return False, f"前2代码有炸板:{dif_codes}"
        # 不计算前2的代码
        # 前排代码炸板不能>=2个
        dif_codes = set(all_history_before_codes) - set(current_before_codes)
        if len(dif_codes) >= 2:
            return False, f"板块前排有{len(dif_codes)}个炸板"
        exclude_codes = set()
        for x in current_before_codes_info:
@@ -1477,22 +1501,25 @@
                # 首板老2,判断前面的老大是否是属于不能买的范畴
                pre_code = history_before_codes_info[0][0]
                # pre_code不能买,才能买
                if RedicalBuyDataManager.can_buy(pre_code, DealAndDelegateWithBuyModeDataManager().get_deal_codes())[0]:
                if RadicalBuyDataManager.is_code_can_buy(pre_code,
                                                         DealAndDelegateWithBuyModeDataManager().get_deal_codes())[0]:
                    return False, f"前排代码可买:{pre_code}"
                # 距离前一个是否在10分钟内
                if tool.trade_time_sub(tool.timestamp_format(limit_up_timestamp, '%H:%M:%S'),
                                       tool.timestamp_format(history_before_codes_info[-1][1], '%H:%M:%S')) >= 10 * 60:
                    return False, f"距离上个不能买的代码涨停已过去10分钟({history_before_codes_info[0]})"
                # 前面一个代码不能买,前一个代码必须与前前个代码涨停时间相差15分钟内
                for i in range(len(all_history_before_codes_info) - 1, -1, -1):
                    if all_history_before_codes_info[i][0] == pre_code:
                        if tool.trade_time_sub(tool.timestamp_format(all_history_before_codes_info[i][1], '%H:%M:%S'),
                                               tool.timestamp_format(all_history_before_codes_info[i - 1][1],
                                                                     '%H:%M:%S')) >= 15 * 60:
                            return False, f"被顺位代码({pre_code}) 与上个代码涨停时间>=15分钟 ({all_history_before_codes_info[i]}##{all_history_before_codes_info[i - 1]})"
                        else:
                            return True, f"被顺位代码({pre_code}) 与上个代码涨停时间<15分钟 ({all_history_before_codes_info[i]}##{all_history_before_codes_info[i - 1]})"
                return False, f"没找到顺位代码({pre_code})的前排代码"
            else:
                # 距离上个代码涨停5分钟以内
                if tool.trade_time_sub(tool.timestamp_format(limit_up_timestamp, '%H:%M:%S'),
                                       tool.timestamp_format(current_before_codes_info[-1][1], '%H:%M:%S')) >= 10 * 60:
                    return False, f"距离上个代码涨停已过去10分钟({current_before_codes_info[-1]})"
                # 代码为目标代码
                pass
        else:
            if tool.trade_time_sub(tool.timestamp_format(limit_up_timestamp, '%H:%M:%S'),
                                   tool.timestamp_format(current_before_codes_info[-1][1], '%H:%M:%S')) >= 10 * 60:
                return False, f"距离上个代码涨停已过去10分钟({current_before_codes_info[-1]})"
            # 代码为目标代码
            pass
        return True, f"满足买入需求: 前排代码-{current_before_codes_info}"
    @classmethod
third_data/kpl_data_constant.py
@@ -2,6 +2,7 @@
import constant
from db import redis_manager_delegate as redis_manager
from db.redis_manager_delegate import RedisUtils
from third_data.third_blocks_manager import BlockMapManager
from utils import tool
from utils.kpl_data_db_util import KPLLimitUpDataUtil
@@ -183,10 +184,12 @@
            return
        cls.history_limit_up_datas = history_limit_up_datas_
        for d in cls.history_limit_up_datas:
            # 参考原因:当前涨停原因+当日变化之前的原因+180天最近2条涨停原因
            # 参考原因:当前涨停原因+当日变化之前的原因+扫入参考原因
            code = d[3]
            # 当前涨停原因
            blocks = {d[2]}
            history_reasons = LimitUpCodesBlockRecordManager().get_limit_up_reasons(code)
            # 扫入参考原因
            history_reasons = LimitUpCodesBlockRecordManager().get_radical_buy_blocks(code)
            if history_reasons:
                blocks |= history_reasons
            today_changed_reasons = TodayLimitUpReasonChangeManager().get_changed_reasons(code)
@@ -197,7 +200,7 @@
            #         kpl_block_util.open_limit_up_time_range[1]:
            #     blocks |= set(d[6].split("、"))
            blocks -= constant.KPL_INVALID_BLOCKS
            cls.__history_code_blocks_dict[code] = blocks
            cls.__history_code_blocks_dict[code] = BlockMapManager().filter_blocks(blocks)
            cls.__history_code_data_dict[code] = d
    @classmethod
trade/radical_buy_data_manager.py
@@ -14,11 +14,11 @@
from utils import tool, global_util
class RedicalBuyDataManager():
class RadicalBuyDataManager():
    @classmethod
    def can_buy(cls, code, deal_codes=None):
    def is_code_can_buy(cls, code, deal_codes=None):
        """
        是否可以买
        代码是否可以买(根据代码本身属性)
        @param code: 代码
        @param total_sell_volume: 总卖量
        @return: 是否可以买, 原因
@@ -28,14 +28,8 @@
            if not k_format[13]:
                return False, "近60个交易日无涨停"
            if k_format[14]:
                # 昨天炸板,且当前的量比小于60%
                current_total_sell_data = L2MarketSellManager().get_current_total_sell_data(code)
                total_sell_volume = 0
                if current_total_sell_data:
                    total_sell_volume = current_total_sell_data[2]
                volume_rate = code_volumn_manager.CodeVolumeManager().get_volume_rate(code, total_sell_volume=total_sell_volume)
                if volume_rate < 0.6:
                    return False, f"昨日炸板,量比({volume_rate})<0.6"
                # 昨天炸板,一律不买
                return False, f"昨日炸板"
        # 获取涨停价
        price = gpcode_manager.get_limit_up_price_as_num(code)
        if not price:
@@ -121,6 +115,7 @@
    for dc in deal_codes:
        # 获取涨停原因
        reasons = set()
        # 当前的涨停原因
        limit_up_reason = kpl_data_manager.LimitUpDataConstant.get_limit_up_reason_with_history(dc)
        if limit_up_reason and limit_up_reason in constant.KPL_INVALID_BLOCKS:
            limit_up_reason = None
trade/radical_buy_strategy.py
@@ -110,7 +110,7 @@
        else:
            __latest_deal_active_buy_order[code] = [transaction_data[6], transaction_data[2], money]
        if code not in __start_time_dict:
        if code not in __start_time_dict and False:
            # 判断买单成交的金额,如果金额大于50w就作为计时起始点
            if __latest_deal_active_buy_order[code][2] >= 500000:
                # 设置计时起点,将当前的数据清零
@@ -119,18 +119,18 @@
        else:
            __deal_active_buy_total_money[code] += money
            # 已经开始计数
            THRESHOLD_TIME = 1000 if tool.is_sh_code(code) else 500
            huaxin_timestamp = transaction_data[3]
            time_str_with_ms = __huaxin_timestamp_convert_temp[code].get(huaxin_timestamp)
            if not time_str_with_ms:
                __huaxin_timestamp_convert_temp[code].clear()
                time_str_with_ms = l2_huaxin_util.convert_time(huaxin_timestamp, with_ms=True)
                __huaxin_timestamp_convert_temp[code][huaxin_timestamp] = time_str_with_ms
            # THRESHOLD_TIME = 1000 if tool.is_sh_code(code) else 500
            # huaxin_timestamp = transaction_data[3]
            # time_str_with_ms = __huaxin_timestamp_convert_temp[code].get(huaxin_timestamp)
            # if not time_str_with_ms:
            #     __huaxin_timestamp_convert_temp[code].clear()
            #     time_str_with_ms = l2_huaxin_util.convert_time(huaxin_timestamp, with_ms=True)
            #     __huaxin_timestamp_convert_temp[code][huaxin_timestamp] = time_str_with_ms
            if tool.trade_time_sub_with_ms(time_str_with_ms, __start_time_dict[code]) > THRESHOLD_TIME:
                __start_time_dict.pop(code)
                __deal_active_buy_total_money[code] = 0
                return BUY_MODE_NONE, f"距离上个大单成交超过{THRESHOLD_TIME}ms"
            # if tool.trade_time_sub_with_ms(time_str_with_ms, __start_time_dict[code]) > THRESHOLD_TIME:
            #     __start_time_dict.pop(code)
            #     __deal_active_buy_total_money[code] = 0
            #     return BUY_MODE_NONE, f"距离上个大单成交超过{THRESHOLD_TIME}ms"
    price = transaction_datas[-1][1]
    huaxin_timestamp = transaction_datas[-1][3]
@@ -139,7 +139,7 @@
    if selling_num is None:
        selling_num = 0
    if selling_num is not None:
        # 总卖 = 主动成交的累计金额 + 处于委托状态的涨停卖金额
        # 总卖 = 涨停主动买成交的累计金额 + 处于委托状态的涨停卖金额
        total_sell = __deal_active_buy_total_money[code] + selling_num * price
        if total_sell == 0:
            total_sell = 1
trade/trade_data_manager.py
@@ -484,9 +484,8 @@
    @classmethod
    def __load_data(cls):
        __redis = cls.__get_redis()
        result = RedisUtils.get(cls.__get_redis(), "radical_buy_deal_codes")
        result = RedisUtils.smembers(cls.__get_redis(), "radical_buy_deal_codes")
        if result:
            result = json.loads(result)
            cls.__deal_codes_cache = set(result)
    @classmethod
trade/trade_result_manager.py
@@ -12,7 +12,7 @@
from l2.l2_data_util import local_today_datas, L2DataUtil
from l2.l2_sell_manager import L2MarketSellManager
from log_module.log import logger_l2_error
from trade.radical_buy_data_manager import RedicalBuyDataManager
from trade.radical_buy_data_manager import RadicalBuyDataManager
from trade.trade_data_manager import PlaceOrderCountManager
from trade.trade_queue_manager import THSBuy1VolumnManager
from utils import tool, buy_condition_util
@@ -109,7 +109,7 @@
    # 如果是扫入下单,下单之后就加红
    if order_begin_pos.mode == OrderBeginPosInfo.MODE_RADICAL:
        RedicalBuyDataManager.place_order_success(code)
        RadicalBuyDataManager.place_order_success(code)
    # 清除下单信号
    place_order_single_data_manager.L2TradeSingleDataManager.clear_data(code)