admin
2025-04-07 e7c7efc9d6fc46a2925fa5b2b74358c68b007df2
strategy/buying_strategy.py
@@ -9,6 +9,7 @@
# from datetime import timedelta
import time
import utils.tool
from log_module import async_log_util
from log_module.log import logger_kpl_jingxuan_in, logger_common
# import dateutil
# 引入掘金API
@@ -17,7 +18,6 @@
from strategy import basic_methods
from strategy import account_management
from strategy import order_methods
from utils import tool, huaxin_util
@@ -100,6 +100,15 @@
    return last_volume
def logger_info(content):
    """
    日志记录
    :param content:
    :return:
    """
    async_log_util.info(logger, content)
# 涨幅视界策略【根据涨幅进入视界为起始的策略】
def growth_view_strategy(current_info):
    symbol_code = current_info[0]  # 券商接口为纯数字编号
@@ -140,7 +149,7 @@
        # 由于会存在分时L1数据中最新价为0导致current_low==0的情况,所以当出现这一情况时,将它直接赋值为昨收价(目前没有办法根本解决)
        if current_low == 0:
            current_low = k_line_data[0]['close']
            # logger.info(f"current_low == 0 赋值为K线昨收价")
            # logger_info(f"current_low == 0 赋值为K线昨收价")
        # 如果公司名称中不包含["ST", "退市", "退", "XD", "XR", "DR", "N"] 则继续逻辑判断
        if not any(keyword in k_line_data[0]['sec_name'] for keyword in ["ST", "退市", "退", "XD", "XR", "DR", "N"]):
@@ -150,17 +159,17 @@
                deep_low = (current_low - k_line_data[0]['close']) / k_line_data[0]['close'] * 100  # 当日最大跌幅比
            else:
                deep_low = 0  # 当日最大跌幅比
                # logger.info(f"current_low is None or current_low == 0  按照K线昨收价作为当日当时最低价赋值,强行将最大跌幅比赋值为0")
                # logger_info(f"current_low is None or current_low == 0  按照K线昨收价作为当日当时最低价赋值,强行将最大跌幅比赋值为0")
            # 由于已经把回调的涨停概念数据全局化了,所以直接使用这个数据列表,并且直接去重后列表化
            limit_up_block_names = list(set(data_cache.limit_up_block_names))
            # 在循环监测个股瞬时行情时进入涨幅视界的情况  *************************************************************【涨幅视界】********************************************************
            if tick_growth is not None and tick_growth >= 0.3:
                logger.info(f"上证指数 开盘涨幅 ====》》》 {round(data_cache.Shanghai_open_growth, 4)}%")
                logger.info(f"深证指数 开盘涨幅 ====》》》 {round(data_cache.Shenzhen_open_growth, 4)}%")
                logger.info(f"创业板指 开盘涨幅 ====》》》 {round(data_cache.TSXV_open_growth, 4)}%")
                async_log_util.info(logger, f"上证指数 开盘涨幅 ====》》》 {round(data_cache.Shanghai_open_growth, 4)}%")
                async_log_util.info(logger, f"深证指数 开盘涨幅 ====》》》 {round(data_cache.Shenzhen_open_growth, 4)}%")
                async_log_util.info(logger, f"创业板指 开盘涨幅 ====》》》 {round(data_cache.TSXV_open_growth, 4)}%")
                now = datetime.datetime.now()
                logger.info(
                    f"获取时间========================================={current_created_at}=========================================")
                async_log_util.info(logger,
                                    f"获取时间========================================={current_created_at}=========================================")
                # 调用安全交易量公式
                ratios = basic_methods.secure_volume(now)
                # print(f"ratios==================={ratios} ,")
@@ -174,8 +183,8 @@
                # print(f"自由市值=========={free_market_value} 亿")
                # 使用 get 方法安全地获取板块列表,如果股票代码不存在则返回 None 或一个空列表作为默认值
                stocks_plates = data_cache.all_stocks_plate_dict.get(symbol_to_search, {}).get("plate", [])
                logger.info(f"【{k_line_data[0]['sec_name']}】概念板块=========={stocks_plates} ")
                logger.info(f"【大盘当前】涨停概念=========={limit_up_block_names}")
                async_log_util.info(logger, f"【{k_line_data[0]['sec_name']}】概念板块=========={stocks_plates} ")
                async_log_util.info(logger, f"【大盘当前】涨停概念=========={limit_up_block_names}")
                # 将获取的板块列表转换为集合,并计算与涨停板块的交集
                stocks_plates_set = set(stocks_plates)
                limit_up_plate_set = set(limit_up_block_names)
@@ -199,16 +208,17 @@
                    # 遍历每个键对应的列表中的列表
                    for stock_list in values:
                        if len(stock_list) > 1 and symbol_code in stock_list[1]:
                            logger.info(f"在板块强度个股列表中找到了 {key}:{k_line_data[0]['sec_name']}。")
                            async_log_util.info(logger,
                                                f"在板块强度个股列表中找到了 {key}:{k_line_data[0]['sec_name']}。")
                            # 打印概念对应的个股列表
                            # print(f"stock_list=={stock_list}")
                            # 将个股精选的相关两个概念字符串转化为列表
                            correlation_plate_list = stock_list[4].split('、')
                            logger.info(
                                f"【{stock_list[0]}】,当日当时涨幅:{stock_list[2]}%,当时涨速:{stock_list[3]},个股精选相关板块=={correlation_plate_list} ,领涨次数:{stock_list[6]}")
                            async_log_util.info(logger,
                                                f"【{stock_list[0]}】,当日当时涨幅:{stock_list[2]}%,当时涨速:{stock_list[3]},个股精选相关板块=={correlation_plate_list} ,领涨次数:{stock_list[6]}")
                            # 如果只需要找到一个就停止,可以在这里使用 break
                            if len(values) >= 2:
                                logger.info(f"单一板块内瞬时拉升数为:{len(values)},分别为===={values}")
                                async_log_util.info(logger, f"单一板块内瞬时拉升数为:{len(values)},分别为===={values}")
                                # 如果子列表长度大于1且第二个元素包含 当前进入涨幅视界的symbol_code
                                strength_list_have_it = True
                                strength_plate = correlation_plate_list
@@ -218,14 +228,16 @@
                # 调用历史K累计涨停天数函数
                limit_up_day = basic_methods.count_limit_up_day(k_line_data)
                # 调用大抛压位计算函数
                throwing_pressure_position = basic_methods.position_of_throwing_pressure(k_line_data, current_open, current_volume, today_limit_up_price)
                throwing_pressure_position = basic_methods.position_of_throwing_pressure(k_line_data, current_open,
                                                                                         current_volume,
                                                                                         today_limit_up_price)
                # print(f"throwing_pressure_position === {throwing_pressure_position}")
                # 计算瞬时量幅比
                last_volume_to_growth_ratio = (round(current_last_volume / 10000, 2) / round(
                    k_line_data[0]['volume'] / 10000, 2)) / (round(tick_growth, 2) / 100)
                logger.info(
                    f"当日当时涨幅:{today_growth}%,当日当时总成交量:{round(current_volume / 10000, 2)}万,昨日的总成交量{round(k_line_data[0]['volume'] / 10000, 2)}万,瞬时成交量:{round(current_last_volume / 10000, 2)}万,瞬时涨幅:{round(tick_growth, 2)}%,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%")
                async_log_util.info(logger,
                                    f"当日当时涨幅:{today_growth}%,当日当时总成交量:{round(current_volume / 10000, 2)}万,昨日的总成交量{round(k_line_data[0]['volume'] / 10000, 2)}万,瞬时成交量:{round(current_last_volume / 10000, 2)}万,瞬时涨幅:{round(tick_growth, 2)}%,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%")
                # print(
                #     f"卖一量:{current_quotes[0]['ask_v']},卖二量:{current_quotes[1]['ask_v']},卖三量:{current_quotes[2]['ask_v']},卖四量:{current_quotes[3]['ask_v']},卖五量:{current_quotes[4]['ask_v']}")
                # print(
@@ -234,7 +246,7 @@
                buying_strong = basic_methods.get_buying_strength(current_quotes_buy, current_quotes_sell)
                # print(f"buying_strong==={buying_strong}")
                if len(data_cache.bought_plate) > 0:
                    logger.info(f"已买入的概念板块==={data_cache.bought_plate}")
                    async_log_util.info(logger, f"已买入的概念板块==={data_cache.bought_plate}")
                    # 创建一个已买板块集合
                bought_plate_set = set(data_cache.bought_plate)
                # 设定当前时间点
@@ -248,7 +260,7 @@
                    if deep_low > -3 and deep_low is not None:
                        # 进入乐观涨幅区间
                        if 0 <= today_growth <= 6.5:
                            # logger.info(f"进入乐观涨幅区间!公司名称:{k_line_data[0]['sec_name']},当日当时涨幅:{today_growth},当前时间:{current_data['created_at']}")
                            # logger_info(f"进入乐观涨幅区间!公司名称:{k_line_data[0]['sec_name']},当日当时涨幅:{today_growth},当前时间:{current_data['created_at']}")
                            # 进入无高位风险 且 无二次近前高风险等 视界
                            if k_line_data[0]['risk_position'] not in ['recent_high_position_risk',
                                                                       'recent_second_break_near_high_position_risk',
@@ -259,167 +271,169 @@
                                '''
                                if len(limit_up_plate_included) != 0 and limit_up_plate_included.issubset(
                                        check_plate_list) is False:
                                    logger.info(
                                    logger_info(
                                        f"【{k_line_data[0]['sec_name']}】--------------------------------------------------------------------------------------------------------[有概念视界]")
                                    logger.info(f"包含涨停概念:{limit_up_plate_included}")
                                    logger_info(f"包含涨停概念:{limit_up_plate_included}")
                                    if len(limit_up_plate_included) >= 3:
                                        logger.info(f"包含多个涨停概念:{limit_up_plate_included}")
                                        logger_info(f"包含多个涨停概念:{limit_up_plate_included}")
                                    limit_up_plate_included_list = list(limit_up_plate_included)
                                    intersection_plate = bought_plate_set.intersection(limit_up_plate_included)
                                    if len(intersection_plate) > 0:
                                        logger.info(f"重复相交概念==={intersection_plate}")
                                    logger.info(
                                        logger_info(f"重复相交概念==={intersection_plate}")
                                    logger_info(
                                        f"【有概念】(涨停列表中包含自身概念 且 不是唯一包含概念不可用) !最新价: {current_price},,当日当时涨幅:{today_growth}%。")
                                    # 有概念有强度视界
                                    if strength_list_have_it is True:
                                        logger.info(
                                        logger_info(
                                            f"【有概念 有强度】出现在板块强度大于2的列表中 瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,当日当时涨幅:{today_growth}%。")
                                        if last_volume_to_growth_ratio > 0.8 and (
                                                free_market_value < 40 and current_price < 20):
                                            logger.info(
                                            logger_info(
                                                f"【不利】瞬时量幅比> 0.8 且 (小自由市值<40亿 或 最新价小于20元 )!,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,自由市值:{free_market_value} 亿。")
                                        elif now_time <= datetime.time(9, 30, 5).strftime("%H:%M:%S"):
                                            logger.info(
                                            logger_info(
                                                f"【不利】早盘第一个tick,瞬时涨幅计算恐有误,不买!瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%。")
                                        elif limit_up_day < 1 and tick_growth < 1:
                                            logger.info(
                                            logger_info(
                                                f"【不利】冷票 且 瞬时涨幅小于 1 !不买!!,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,90天内涨停天数:{limit_up_day}")
                                        # for d in k_line_data[1:3] 只检查k_line_data中的第二个和第三个元素
                                        elif limit_up_day > 6 and any(
                                                'attribute' in d and d['attribute'] in data_cache.limit_up_type for d in
                                                k_line_data[1:3]) and current_volume <= k_line_data[0]['volume'] * 1.5:
                                            logger.info(
                                            logger_info(
                                                f"【不利】过于显著票 且 上日或上上涨停板 当日量还不足昨日量的1.5倍!不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,最新价: {current_price},,90天内涨停天数:{limit_up_day}")
                                        elif k_line_data[0]['attribute'] in data_cache.frying_plate_type:
                                            logger.info(f"【不利】昨日炸板!不买!!")
                                            logger_info(f"【不利】昨日炸板!不买!!")
                                        elif k_line_data[0]['attribute'] in data_cache.limit_up_type:
                                            logger.info(f"【不利】昨日涨停!不买!!")
                                            logger_info(f"【不利】昨日涨停!不买!!")
                                        elif k_line_data[0]['attribute'] in data_cache.limit_down_type:
                                            logger.info(f"【不利】昨日跌停!不买!!")
                                            logger_info(f"【不利】昨日跌停!不买!!")
                                        # elif k_line_data[0]['attribute'] == 'up_down' and k_line_data[0]['today_volume_shape'] == 'increases_down':
                                        #     logger.info(f"【不利】昨日高开低走 且 放量下跌,不买!!")
                                        elif k_line_data[0]['attribute'] == 'down_down' and k_line_data[0]['today_volume_shape'] == 'increases_down':
                                            logger.info(f"【不利】昨日低开低走 且 放量下跌,不买!!")
                                        #     logger_info(f"【不利】昨日高开低走 且 放量下跌,不买!!")
                                        elif k_line_data[0]['attribute'] == 'down_down' and k_line_data[0][
                                            'today_volume_shape'] == 'increases_down':
                                            logger_info(f"【不利】昨日低开低走 且 放量下跌,不买!!")
                                        elif throwing_pressure_position[0] is True:
                                            # 最近涨停日期:{k_line_data[limit_up_day_min_index]['bob']} ,
                                            logger.info(
                                            logger_info(
                                                f"【不利】接近涨停大抛压价位 近7日涨停过票 且 当前价和今日涨停价  且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于涨停最高价的1.02倍 不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                        elif throwing_pressure_position[1] is True:
                                            # 最近涨停日期:{k_line_data[frying_plate_day_min_index]['bob']} ,炸板次日量{round(k_line_data[frying_plate_day_min_index - 1]['volume'], 2)},
                                            logger.info(
                                            logger_info(
                                                f"【不利】接近炸板大抛压价位 近7日炸板过票 且 当前价和今日涨停价  且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于炸板最高价的1.02倍 不买!! ,90天内涨停天数:{limit_up_day}")
                                        elif throwing_pressure_position[2] is True:
                                            # 最近涨停日期:{k_line_data[limit_down_day_min_index]['bob']} ,
                                            logger.info(
                                            logger_info(
                                                f"【不利】接近跌停大抛压价位[跌停日的最高价或最低价] 近7日跌停过票 且 当前价和今日涨停价  且当日量还不足昨日量的1.5倍!不买!!今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                        elif (
                                                free_market_value == 0 or free_market_value == 0.0) and free_market_value < 6:
                                            logger.info(
                                            logger_info(
                                                f"【不利】自由市值小于6亿!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                        elif len(intersection_plate) > 0:
                                            logger.info(
                                            logger_info(
                                                f"【不利】同概念只买一次,不买了,重复相交概念==={intersection_plate}")
                                        elif data_cache.have_plate_buy_times >= 3:
                                            logger.info(f"【不利】有概念买入已经 3 次了!不买了!!")
                                            logger_info(f"【不利】有概念买入已经 3 次了!不买了!!")
                                        elif len(data_cache.addition_position_symbols_set) >= 3:
                                            logger.info(f"【不利】当日已经买了3只票!不买了!!")
                                            logger_info(f"【不利】当日已经买了3只票!不买了!!")
                                        elif now_time < data_cache.OPENING_TIME or now_time > data_cache.NOON_MARKET_TIME:
                                            logger.info(f"【不利】不在9:30-13:05时间内!不买!!")
                                            logger_info(f"【不利】不在9:30-13:05时间内!不买!!")
                                        else:
                                            logger.info(
                                            logger_info(
                                                f"************************************************【有概念有强度指标下单】************************************************")
                                            logger.info(
                                            logger_info(
                                                f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")
                                            logger.info(
                                            logger_info(
                                                f"大盘综合强度分数:{data_cache.real_time_market_strong},大盘指数情绪预期分数==={data_cache.index_trend_expectation_score}分,设想的下单金额:{data_cache.today_planned_order_amount}")
                                            # 调用下单方法下单
                                            order_methods.buy_order_by_value(symbol, data_cache.today_planned_order_amount,
                                            order_methods.buy_order_by_value(symbol,
                                                                             data_cache.today_planned_order_amount,
                                                                             k_line_data[0]['sec_name'],
                                                                             current_price)
                                            # 查看一下该股有无大单
                                            L2_data_analysis.find_L2_big_order_of_code(symbol_code)
                                            # 检测持仓代码集合中有无下单个股,才认为交易成功
                                            if symbol_code not in data_cache.position_symbols_set:
                                                logger.info(f"【{k_line_data[0]['sec_name']}】交易失败~持仓集合:{data_cache.position_symbols_set}")
                                                logger_info(
                                                    f"【{k_line_data[0]['sec_name']}】交易失败~持仓集合:{data_cache.position_symbols_set}")
                                            else:
                                                # 将有概念买入次数自加1
                                                data_cache.have_plate_buy_times += 1
                                                # 将买入个股的当时概念添加到全局变量中存储
                                                data_cache.bought_plate.extend(limit_up_plate_included_list)
                                                logger.info(f"【{k_line_data[0]['sec_name']}】交易成功!持仓集合:{data_cache.position_symbols_set}")
                                                logger_info(
                                                    f"【{k_line_data[0]['sec_name']}】交易成功!持仓集合:{data_cache.position_symbols_set}")
                                    # 有概念无强度视界
                                    if strength_list_have_it is False:
                                        logger.info(
                                        logger_info(
                                            f"【有概念 无强度】未出现在板块强度大于2的列表中 瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,当日当时涨幅:{today_growth}%。")
                                        if tick_growth >= 0.8:
                                            logger.info(
                                            logger_info(
                                                f"【有概念 无强度 有强拉】瞬时涨幅 > 0.8% !瞬时涨幅:{round(tick_growth, 2)}%")
                                            if last_volume_to_growth_ratio > 0.8 and (
                                                    free_market_value < 40 and current_price < 20):
                                                logger.info(
                                                logger_info(
                                                    f"【不利】瞬时量幅比> 0.8 且 (小自由市值<40亿 或 最新价小于20元 )!,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,自由市值:{free_market_value} 亿。")
                                            elif now_time <= datetime.time(9, 30, 5).strftime("%H:%M:%S"):
                                                logger.info(
                                                logger_info(
                                                    f"【不利】早盘第一个tick,瞬时涨幅计算恐有误,不买!瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%。")
                                            elif now_time <= datetime.time(9, 35, 00).strftime("%H:%M:%S"):
                                                logger.info(
                                                logger_info(
                                                    f"【不利】早盘前5分钟,不做有概念无强度试验,不买!瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%。")
                                            elif today_growth < 3:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】当日当时涨幅小于3%,信心不足,不太可能有强度,不买!瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%。")
                                            elif limit_up_day < 1 and tick_growth < 1:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】冷票 且 瞬时涨幅小于 1 !不买!!,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,90天内涨停天数:{limit_up_day}")
                                            # for d in k_line_data[1:3] 只检查k_line_data中的第二个和第三个元素
                                            elif limit_up_day > 6 and any(
                                                    'attribute' in d and d['attribute'] in data_cache.limit_up_type
                                                    for d in k_line_data[1:3]) and current_volume <= k_line_data[0][
                                                'volume'] * 1.5:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】过于显著票 且 上日或上上涨停板 当日量还不足昨日量的1.5倍!不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,最新价: {current_price},,90天内涨停天数:{limit_up_day}")
                                            elif k_line_data[0]['attribute'] in data_cache.frying_plate_type:
                                                logger.info(f"【不利】昨日炸板!不买!!")
                                                logger_info(f"【不利】昨日炸板!不买!!")
                                            elif k_line_data[0]['attribute'] in data_cache.limit_up_type:
                                                logger.info(f"【不利】昨日涨停!不买!!")
                                                logger_info(f"【不利】昨日涨停!不买!!")
                                            elif k_line_data[0]['attribute'] in data_cache.limit_down_type:
                                                logger.info(f"【不利】昨日跌停!不买!!")
                                                logger_info(f"【不利】昨日跌停!不买!!")
                                            # elif k_line_data[0]['attribute'] == 'up_down' and k_line_data[0]['today_volume_shape'] == 'increases_down':
                                            #     logger.info(f"【不利】昨日高开低走 且 放量下跌,不买!!")
                                            #     logger_info(f"【不利】昨日高开低走 且 放量下跌,不买!!")
                                            elif k_line_data[0]['attribute'] == 'down_down' and k_line_data[0][
                                                'today_volume_shape'] == 'increases_down':
                                                logger.info(f"【不利】昨日低开低走 且 放量下跌,不买!!")
                                                logger_info(f"【不利】昨日低开低走 且 放量下跌,不买!!")
                                            elif throwing_pressure_position[0] is True:
                                                # 最近涨停日期:{k_line_data[limit_up_day_min_index]['bob']} ,
                                                logger.info(
                                                logger_info(
                                                    f"【不利】接近涨停大抛压价位 近7日涨停过票 且 当前价和今日涨停价  且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于涨停最高价的1.02倍 不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                            elif throwing_pressure_position[1] is True:
                                                # 最近涨停日期:{k_line_data[frying_plate_day_min_index]['bob']} ,炸板次日量{round(k_line_data[frying_plate_day_min_index - 1]['volume'], 2)},
                                                logger.info(
                                                logger_info(
                                                    f"【不利】接近炸板大抛压价位 近7日炸板过票 且 当前价和今日涨停价  且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于炸板最高价的1.02倍 不买!! ,90天内涨停天数:{limit_up_day}")
                                            elif throwing_pressure_position[2] is True:
                                                # 最近涨停日期:{k_line_data[limit_down_day_min_index]['bob']} ,
                                                logger.info(
                                                logger_info(
                                                    f"【不利】接近跌停大抛压价位[跌停日的最高价或最低价] 近7日跌停过票 且 当前价和今日涨停价  且当日量还不足昨日量的1.5倍!不买!!今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                            elif (
                                                    free_market_value == 0 or free_market_value == 0.0) and free_market_value < 6:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】自由市值小于6亿!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                            elif len(intersection_plate) > 0:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】同概念只买一次,不买了,重复相交概念==={intersection_plate}")
                                            elif data_cache.have_plate_buy_times >= 1:
                                                logger.info(f"【不利】有概念无强度买入已经1次了!不买了!!")
                                                logger_info(f"【不利】有概念无强度买入已经1次了!不买了!!")
                                            elif len(data_cache.addition_position_symbols_set) >= 4:
                                                logger.info(f"【不利】当日已经买了3只票!不买了!!")
                                                logger_info(f"【不利】当日已经买了3只票!不买了!!")
                                            elif now_time < data_cache.OPENING_TIME or now_time > data_cache.NOON_MARKET_TIME:
                                                logger.info(f"【不利】不在9:30-13:05时间内!不买!!")
                                                logger_info(f"【不利】不在9:30-13:05时间内!不买!!")
                                            else:
                                                logger.info(
                                                logger_info(
                                                    f"************************************************【有概念无强度指标下单】************************************************")
                                                logger.info(
                                                logger_info(
                                                    f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")
                                                # 调用下单方法下单
                                                # order_methods.buy_order_by_value(symbol, 1000,
@@ -433,89 +447,89 @@
                                                L2_data_analysis.find_L2_big_order_of_code(symbol_code)
                                                # 检测持仓代码集合中有无下单个股,才认为交易成功
                                                if symbol_code not in data_cache.position_symbols_set:
                                                    logger.info(
                                                    logger_info(
                                                        f"【{k_line_data[0]['sec_name']}】交易失败~持仓集合:{data_cache.position_symbols_set}")
                                                else:
                                                    # 将有概念买入次数自加1
                                                    data_cache.have_plate_buy_times += 1
                                                    # 将买入个股的当时概念添加到全局变量中存储
                                                    data_cache.bought_plate.extend(limit_up_plate_included_list)
                                                    logger.info(
                                                    logger_info(
                                                        f"【{k_line_data[0]['sec_name']}】交易成功!持仓集合:{data_cache.position_symbols_set}")
                                '''
                                无概念 有强度视界
                                '''
                                if len(limit_up_plate_included) == 0 or limit_up_plate_included.issubset(
                                        check_plate_list) is True:
                                    # logger.info(f"【无概念】")
                                    # logger_info(f"【无概念】")
                                    if strength_list_have_it is True:
                                        logger.info(
                                        logger_info(
                                            f"【{k_line_data[0]['sec_name']}】--------------------------------------------------------------------------------------------------------[有强度视界]")
                                        logger.info(
                                        logger_info(
                                            f"【无概念 有强度】出现在板块强度大于2的列表中!瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,最新价: {current_price},瞬时涨幅:{round(tick_growth, 2)}%,当日当时涨幅:{today_growth}%,当前时间:{current_created_at}。")
                                        logger.info(
                                        logger_info(
                                            f"【强度数据】 == {data_cache.market_sift_plate_stock_dict}")
                                        strength_plate_set = set(strength_plate)
                                        intersection_plate = bought_plate_set.intersection(strength_plate_set)
                                        if len(intersection_plate) > 0:
                                            logger.info(f"重复相交强度==={intersection_plate}")
                                            logger_info(f"重复相交强度==={intersection_plate}")
                                        if last_volume_to_growth_ratio < 0.8:
                                            logger.info(
                                            logger_info(
                                                f"【有强度 有小量换大涨幅】瞬时量幅比< 0.8 !瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,最新价: {current_price},瞬时涨幅:{round(tick_growth, 2)}%,当日当时涨幅:{today_growth}%,当前时间:{current_created_at}。")
                                            if tick_growth >= 0.8:
                                                logger.info(
                                                logger_info(
                                                    f"【有强度 有小量换大涨幅 有强拉】瞬时涨幅 > 0.8% !瞬时涨幅:{round(tick_growth, 2)}%")
                                                if limit_up_day < 1:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】冷票 !不买!!,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,90天内涨停天数:{limit_up_day}")
                                                # for d in k_line_data[1:3] 只检查k_line_data中的第二个和第三个元素
                                                elif limit_up_day > 6 and any(
                                                        'attribute' in d and d['attribute'] in data_cache.limit_up_type
                                                        for d in k_line_data[1:3]) and current_volume <= k_line_data[0][
                                                    'volume'] * 1.5:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】过于显著票 且 上日或上上涨停板 当日量还不足昨日量的1.5倍!不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                                elif k_line_data[0]['attribute'] in data_cache.frying_plate_type:
                                                    logger.info(f"【不利】昨日炸板!不买!!")
                                                    logger_info(f"【不利】昨日炸板!不买!!")
                                                elif k_line_data[0]['attribute'] in data_cache.limit_up_type:
                                                    logger.info(f"【不利】昨日涨停!不买!!")
                                                    logger_info(f"【不利】昨日涨停!不买!!")
                                                elif k_line_data[0]['attribute'] in data_cache.limit_down_type:
                                                    logger.info(f"【不利】昨日跌停!不买!!")
                                                    logger_info(f"【不利】昨日跌停!不买!!")
                                                # elif k_line_data[0]['attribute'] == 'up_down' and k_line_data[0]['today_volume_shape'] == 'increases_down':
                                                #     logger.info(
                                                #     logger_info(
                                                #         f"【不利】昨日高开低走 且 放量下跌,不买!!")
                                                elif k_line_data[0]['attribute'] == 'down_down' and k_line_data[0][
                                                    'today_volume_shape'] == 'increases_down':
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】昨日低开低走 且 放量下跌,不买!!")
                                                elif throwing_pressure_position[0] is True:
                                                    # 最近涨停日期:{k_line_data[limit_up_day_min_index]['bob']} ,
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】接近涨停大抛压价位 近7日涨停过票 且 当前价和今日涨停价 且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于涨停最高价的1.02倍 不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                                elif throwing_pressure_position[1] is True:
                                                    # 最近涨停日期:{k_line_data[frying_plate_day_min_index]['bob']} ,炸板次日量{round(k_line_data[frying_plate_day_min_index - 1]['volume'], 2)},
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】接近炸板大抛压价位 近7日炸板过票 且 当前价和今日涨停价 且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于炸板最高价的1.02倍 不买!!90天内涨停天数:{limit_up_day}")
                                                elif throwing_pressure_position[2] is True:
                                                    # 最近涨停日期:{k_line_data[limit_down_day_min_index]['bob']} ,
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】接近跌停大抛压价位[跌停日的最高价或最低价] 近7日跌停过票 且 当前价和今日涨停价 且当日量还不足昨日量的1.5倍!不买!!今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,,90天内涨停天数:{limit_up_day}")
                                                elif (
                                                        free_market_value == 0 or free_market_value == 0.0) and free_market_value < 6:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】自由市值小于6亿!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                                elif data_cache.have_strength_buy_times >= 1:
                                                    logger.info(f"【不利】有强度买入 1 次了!不买了!!")
                                                    logger_info(f"【不利】有强度买入 1 次了!不买了!!")
                                                elif len(data_cache.addition_position_symbols_set) >= 3:
                                                    logger.info(f"【不利】当日已经买了3只票!不买了!!")
                                                    logger_info(f"【不利】当日已经买了3只票!不买了!!")
                                                elif now_time < data_cache.OPENING_TIME or now_time > data_cache.NOON_MARKET_TIME:
                                                    logger.info(f"【不利】不在9:30-13:05时间内!不买!!")
                                                    logger_info(f"【不利】不在9:30-13:05时间内!不买!!")
                                                else:
                                                    logger.info(
                                                    logger_info(
                                                        f"************************************************【有强度有强拉指标下单】************************************************")
                                                    logger.info(
                                                    logger_info(
                                                        f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")  # 输出当前价格和3秒涨幅信息
                                                    logger.info(
                                                    logger_info(
                                                        f"大盘综合强度分数:{data_cache.real_time_market_strong},大盘指数情绪预期分数==={data_cache.index_trend_expectation_score}分,设想的下单金额:{data_cache.today_planned_order_amount}")
                                                    # 调用下单方法下单
                                                    order_methods.buy_order_by_value(symbol,
@@ -530,48 +544,49 @@
                                                    L2_data_analysis.find_L2_big_order_of_code(symbol_code)
                                                    # 检测持仓代码集合中有无下单个股,才认为交易成功
                                                    if symbol_code not in data_cache.position_symbols_set:
                                                        logger.info(
                                                        logger_info(
                                                            f"【{k_line_data[0]['sec_name']}】交易失败~持仓集合:{data_cache.position_symbols_set}")
                                                    else:
                                                        # 将有概念买入次数自加1
                                                        data_cache.have_strength_buy_times += 1
                                                        # 将买入个股的当时概念添加到全局变量中存储
                                                        data_cache.bought_plate.extend(strength_plate)
                                                        logger.info(
                                                        logger_info(
                                                            f"【{k_line_data[0]['sec_name']}】交易成功!持仓集合:{data_cache.position_symbols_set}")
                                '''
                                无概念无强度 有小量换大涨幅度视界
                                '''
                                if len(limit_up_plate_included) == 0 or limit_up_plate_included.issubset(
                                        check_plate_list) is True:
                                    # logger.info(f"【无概念】")
                                    # logger_info(f"【无概念】")
                                    if strength_list_have_it is False:
                                        logger.info(
                                        logger_info(
                                            f"【{k_line_data[0]['sec_name']}】--------------------------------------------------------------------------------------------------------[小量大涨幅视界]")
                                        logger.info(
                                        logger_info(
                                            f"【无概念 无强度】未出现在板块强度大于2的列表中!瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,最新价: {current_price},瞬时涨幅:{round(tick_growth, 2)}%,当日当时涨幅:{today_growth}%。")
                                        # logger.info(
                                        # logger_info(
                                        #     f"【强度数据】  ==  {data_cache.market_sift_plate_stock_dict}")
                                        if last_volume_to_growth_ratio < 0.8:
                                            logger.info(
                                            logger_info(
                                                f"【无概念 无强度 有小量换大涨幅】瞬时量幅比< 0.8 !瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%。")
                                            if tick_growth >= 0.8:
                                                logger.info(
                                                logger_info(
                                                    f"【无概念 无强度 有小量换大涨幅 有强拉】瞬时涨幅 > 0.8% !瞬时涨幅:{round(tick_growth, 2)}%")
                                                if current_volume < k_line_data[0]['volume'] * ratios:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】今日成交量 < 昨日的{ratios}倍,不买!!公司名称:{k_line_data[0]['sec_name']},今日目前成交量为昨日的{round(current_volume / k_line_data[0]['volume'], 2)}")
                                                elif buying_strong is not True and current_volume <= k_line_data[0]['volume'] * ratios and now_time > data_cache.MORN_MARKET_TIME:
                                                    logger.info(
                                                elif buying_strong is not True and current_volume <= k_line_data[0][
                                                    'volume'] * ratios and now_time > data_cache.MORN_MARKET_TIME:
                                                    logger_info(
                                                        f"【不利】买一量小于卖一量 且 挂买总量小于挂卖总量 且 当日量不足 (9:35后实施)!不买!!公司名称:{k_line_data[0]['sec_name']},自由市值:{free_market_value} 亿,最新价: {current_price}")
                                                    # logger.info(
                                                    # logger_info(
                                                    #     f"目前获取的精选板块股票强度数据  ==  {data_cache.market_sift_plate_stock_dict}")
                                                elif current_high - current_price > 0.05:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】当前最新价小于今日最高价!不买!!公司名称:{k_line_data[0]['sec_name']},,最新价: {current_price},,当日最高价:{current_high}")
                                                elif limit_up_day < 1 and current_volume <= k_line_data[0][
                                                    'volume'] * 2:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】冷票 且 (瞬时涨幅小于1 或 瞬时量与昨总量比与瞬时涨幅的比值大于0.8)且 当日量还不足昨日量的1.5倍!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price},,90天内涨停天数:{limit_up_day}")
                                                # for d in k_line_data[1:3] 只检查k_line_data中的第二个和第三个元素
                                                elif limit_up_day > 6 and any(
@@ -579,51 +594,52 @@
                                                        for d in
                                                        k_line_data[1:3]) and current_volume <= k_line_data[0][
                                                    'volume'] * 1.5:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】过于显著票 且 上日或上上涨停板 当日量还不足昨日量的1.5倍!不买!! 公司名称:{k_line_data[0]['sec_name']},今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,最新价: {current_price},,90天内涨停天数:{limit_up_day}")
                                                elif k_line_data[0]['attribute'] in data_cache.frying_plate_type:
                                                    logger.info(f"【不利】昨日炸板!不买!!")
                                                    logger_info(f"【不利】昨日炸板!不买!!")
                                                elif k_line_data[0]['attribute'] in data_cache.limit_up_type:
                                                    logger.info(f"【不利】昨日涨停!不买!!")
                                                    logger_info(f"【不利】昨日涨停!不买!!")
                                                elif k_line_data[0]['attribute'] in data_cache.limit_down_type:
                                                    logger.info(f"【不利】昨日跌停!不买!!")
                                                    logger_info(f"【不利】昨日跌停!不买!!")
                                                # elif k_line_data[0]['attribute'] == 'up_down' and k_line_data[0]['today_volume_shape'] == 'increases_down':
                                                #     logger.info(f"【不利】昨日高开低走 且 放量下跌,不买!!公司名称:{k_line_data[0]['sec_name']}")
                                                elif k_line_data[0]['attribute'] == 'down_down' and k_line_data[0]['today_volume_shape'] == 'increases_down':
                                                    logger.info(
                                                #     logger_info(f"【不利】昨日高开低走 且 放量下跌,不买!!公司名称:{k_line_data[0]['sec_name']}")
                                                elif k_line_data[0]['attribute'] == 'down_down' and k_line_data[0][
                                                    'today_volume_shape'] == 'increases_down':
                                                    logger_info(
                                                        f"【不利】昨日低开低走 且 放量下跌,不买!!公司名称:{k_line_data[0]['sec_name']}")
                                                elif throwing_pressure_position[0] is True:
                                                    # 最近涨停日期:{k_line_data[limit_up_day_min_index]['bob']} ,
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】近7日涨停过票 且 当前价和今日涨停价 接近涨停大抛压价位 且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于涨停最高价的1.02倍 不买!! 公司名称:{k_line_data[0]['sec_name']},今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,最新价: {current_price}")
                                                elif throwing_pressure_position[1] is True:
                                                    # 最近涨停日期:{k_line_data[frying_plate_day_min_index]['bob']} ,炸板次日量{round(k_line_data[frying_plate_day_min_index - 1]['volume'], 2)},
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】近7日炸板过票 且 当前价和今日涨停价 接近炸板大抛压价位 且 当日量还不足涨停次日量的1.5倍!且 次日最高价小于炸板最高价的1.02倍 不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                                elif throwing_pressure_position[2] is True:
                                                    # 最近涨停日期:{k_line_data[limit_down_day_min_index]['bob']} ,
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】近7日跌停过票 且 当前价和今日涨停价 接近跌停大抛压价位[跌停日的最高价或最低价] 且当日量还不足昨日量的1.5倍!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                                elif (
                                                        free_market_value == 0 or free_market_value == 0.0) and free_market_value < 6:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】自由市值小于6亿!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                                elif data_cache.have_small_turn_large_buy_times >= 1:
                                                    logger.info(f"【不利】有小量换大涨幅买入已经 1 次了!不买了!!")
                                                    logger_info(f"【不利】有小量换大涨幅买入已经 1 次了!不买了!!")
                                                elif len(data_cache.addition_position_symbols_set) >= 4:
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】当日已经买了4只票!不买了!!")
                                                elif (
                                                        data_cache.MORN_MARKET_TIME < now_time < data_cache.NOON_MARKET_TIME) is False or free_market_value < 100 or (
                                                        today_open_growth < 5 or today_growth < 5):
                                                    logger.info(
                                                    logger_info(
                                                        f"【不利】不在9:35-13:05时间内!或自由市值小于100亿!或开盘涨幅或当日当时涨幅都小于5%!不买!!")
                                                else:
                                                    logger.info(
                                                    logger_info(
                                                        f"************************************************【小量大涨幅指标】************************************************")
                                                    logger.info(
                                                    logger_info(
                                                        f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")  # 输出当前价格和3秒涨幅信息
                                                    logger.info(
                                                    logger_info(
                                                        f"目前获取的精选板块股票强度数据  ==  {data_cache.market_sift_plate_stock_dict}")
                                                    # buying_ratio = basic_methods.maximum_buying_ratio(len(data_cache.addition_position_symbols_set))
                                                    # 调用下单方法下单
@@ -638,98 +654,102 @@
                                                    L2_data_analysis.find_L2_big_order_of_code(symbol_code)
                                                    # 检测持仓代码集合中有无下单个股,才认为交易成功
                                                    if symbol_code not in data_cache.position_symbols_set:
                                                        logger.info(
                                                        logger_info(
                                                            f"【{k_line_data[0]['sec_name']}】交易失败~持仓集合:{data_cache.position_symbols_set}")
                                                    else:
                                                        # 将有概念买入次数自加1
                                                        data_cache.have_small_turn_large_buy_times += 1
                                                        # 将买入个股的当时概念添加到全局变量中存储
                                                        data_cache.bought_plate.extend(k_line_data[0]['sec_name'])
                                                        logger.info(
                                                        logger_info(
                                                            f"【{k_line_data[0]['sec_name']}】交易成功!持仓集合:{data_cache.position_symbols_set}")
                                '''
                                昨日涨停视界,今日连板预期盯视界
                                '''
                                if k_line_data[0]['attribute'] in data_cache.limit_up_type:
                                    # logger.info(f"昨日涨停")
                                    if k_line_data[1]['attribute'] not in data_cache.limit_up_type and k_line_data[2]['attribute'] not in data_cache.limit_up_type:
                                        # logger.info(f"前日大前日未涨停")
                                    # logger_info(f"昨日涨停")
                                    if k_line_data[1]['attribute'] not in data_cache.limit_up_type and k_line_data[2][
                                        'attribute'] not in data_cache.limit_up_type:
                                        # logger_info(f"前日大前日未涨停")
                                        if today_open_growth > 1:
                                            logger.info(
                                            logger_info(
                                                f"【{k_line_data[0]['sec_name']}】--------------------------------------------------------------------------------------------------------[昨日涨停视界]")
                                            logger.info(
                                            logger_info(
                                                f"【{k_line_data[0]['sec_name']}】,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,最新价: {current_price},,当日当时涨幅:{today_growth}%,当前时间:{current_created_at}")
                                            logger.info(f"昨日首板涨停,当日中等以上高开 {today_open_growth}% !")
                                            logger_info(f"昨日首板涨停,当日中等以上高开 {today_open_growth}% !")
                                            if limit_up_day > 6 and any(
                                                    'attribute' in d and d['attribute'] in data_cache.limit_up_type for
                                                    d in k_line_data[1:3]) and current_volume <= k_line_data[0]['volume'] * 1.5:
                                                logger.info(
                                                    d in k_line_data[1:3]) and current_volume <= k_line_data[0][
                                                'volume'] * 1.5:
                                                logger_info(
                                                    f"【不利】过于显著票 且 前日或上前日涨停板 当日量还不足昨日量的1.5倍!不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                            elif len(data_cache.addition_position_symbols_set) >= 3:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】当日已经买了3只票!不买!!")
                                            elif now_time < data_cache.OPENING_TIME or now_time > data_cache.MORN_MARKET_TIME:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】不在9:30-9:35时间内!不买!!")
                                            else:
                                                # logger.info(
                                                # logger_info(
                                                #     f"************************************************【昨日首板指标下单】************************************************")
                                                logger.info(
                                                logger_info(
                                                    f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")  # 输出当前价格和3秒涨幅信息
                                                # order_methods.buy_order_by_value(symbol, 10000,k_line_data[0]['sec_name'],today_limit_up_price)
                                                logger.info(f"昨日首版涨停,今日高开5%!考虑下叉")
                                                logger_info(f"昨日首版涨停,今日高开5%!考虑下叉")
                                '''
                                昨日炸板,今日涨停预期盯视界
                                '''
                                if k_line_data[0]['attribute'] in data_cache.frying_plate_type:
                                    # logger.info(
                                    # logger_info(
                                    #     f"昨日炸板!公司名称:{k_line_data[0]['sec_name']},当前时间:{current_data['created_at']}")
                                    if k_line_data[0]['attribute'] == 'first_frying_plate':
                                        # logger.info(
                                        # logger_info(
                                        #     f"昨日首炸板!公司名称:{k_line_data[0]['sec_name']},当前时间:{current_data['created_at']}")
                                        if today_open_growth > 4:
                                            logger.info(
                                            logger_info(
                                                f"【{k_line_data[0]['sec_name']}】--------------------------------------------------------------------------------------------------------[昨日首炸板视界]")
                                            logger.info(
                                            logger_info(
                                                f"【{k_line_data[0]['sec_name']}】,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,最新价: {current_price},,当日当时涨幅:{today_growth}%,当前时间:{current_created_at}")
                                            logger.info(f"昨日首板炸板,当日中等以上高开 {today_open_growth}% !")
                                            logger_info(f"昨日首板炸板,当日中等以上高开 {today_open_growth}% !")
                                            # 在买票预设时间段 视界
                                            if limit_up_day > 6 and any(
                                                    'attribute' in d and d['attribute'] in data_cache.limit_up_type for d in k_line_data[1:3]) and current_volume <= k_line_data[0]['volume'] * 1.5:
                                                logger.info(
                                                    'attribute' in d and d['attribute'] in data_cache.limit_up_type for
                                                    d in k_line_data[1:3]) and current_volume <= k_line_data[0][
                                                'volume'] * 1.5:
                                                logger_info(
                                                    f"【不利】过于显著票 且 上日或上上涨停板 当日量还不足昨日量的1.5倍!不买!! 今日当时成交量为昨日等比量的{round(current_volume / k_line_data[0]['volume'], 2)}倍,90天内涨停天数:{limit_up_day}")
                                            elif len(data_cache.addition_position_symbols_set) >= 3:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】当日已经买了3只票!不买!!")
                                            elif now_time < data_cache.OPENING_TIME or now_time > data_cache.MORN_MARKET_TIME:
                                                logger.info(
                                                logger_info(
                                                    f"【不利】不在9:30-9:05时间内!不买!!")
                                            else:
                                                # logger.info(
                                                # logger_info(
                                                #     f"************************************************【昨日首炸板指标下单】************************************************")
                                                logger.info(
                                                logger_info(
                                                    f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")  # 输出当前价格和3秒涨幅信息
                                                # order_methods.buy_order_by_value(symbol, 10000,k_line_data[0]['sec_name'],today_limit_up_price)
                                                logger.info(f"昨日首版炸板,今日高开5%!考虑下叉")
                                                logger_info(f"昨日首版炸板,今日高开5%!考虑下叉")
                                '''
                                昨日跌停,今日涨停预期盯视界
                                '''
                                if k_line_data[0]['attribute'] in data_cache.limit_down_type:
                                    # logger.info(
                                    # logger_info(
                                    #     f"昨日跌停!公司名称:{k_line_data[0]['sec_name']},当前时间:{current_data['created_at']}")
                                    pass
                            else:
                                logger.info(
                                logger_info(
                                    f"当前高位风险 或 其他二次近前高等风险,不买!公司名称:【{k_line_data[0]['sec_name']}】")
                        else:
                            logger.info(
                            logger_info(
                                f"当日当时涨幅不在预设范围,不买!公司名称:【{k_line_data[0]['sec_name']}】,当日当时涨幅:{round(today_growth, 2)}%")
                    else:
                        logger.info(
                        logger_info(
                            f"当日最低跌幅低于 -3% ,不买!公司名称:【{k_line_data[0]['sec_name']}】,当日当时最低价:{current_low} 当日当时最大跌幅:{deep_low} ,当日当时最新价:{current_price},买五档:{current_quotes_buy},K线昨收价{k_line_data[0]['close']}")
                else:
                    logger.info(f"已持仓,不买!公司名称:【{k_line_data[0]['sec_name']}】")
                    logger_info(f"已持仓,不买!公司名称:【{k_line_data[0]['sec_name']}】")
                # 以下部分主要计算整体的花费时间
                # 将current_created_at转换为datetime对象,这里假设是今天的日期
                # 注意:这里使用了datetime.now()来获取当前日期,但你可以根据需要调整
@@ -741,19 +761,18 @@
                # print(f"now_end===={now_end}")
                # print(f"now_end type===={type(now_end)}")
                now_start_to_end = abs(created_at - now_end)
                logger.info(f"获取到判断花费==={round(now_start_to_end,2)} 秒")
                logger_info(f"获取到判断花费==={round(now_start_to_end, 2)} 秒")
                # print(f" now_end=={now_end}  created_at=={created_at}")
                # 设定一个时间阈值(比如9秒)
                threshold_4 = datetime.timedelta(seconds=4).total_seconds()
                if now_start_to_end > threshold_4:
                    logger.info(f"获取到判断花费大于4秒啦!!!")
                    logger_info(f"获取到判断花费大于4秒啦!!!")
                threshold_6 = datetime.timedelta(seconds=6).total_seconds()
                if now_start_to_end > threshold_6:
                    logger.info(f"获取到判断花费大于6秒啦!!!")
                logger.info(
                    logger_info(f"获取到判断花费大于6秒啦!!!")
                logger_info(
                    f"完成时间======================================{tool.to_time_str(now_end)}======================================")
    else:
        pass
        # 如果K线数据为空,则不进入后续判断
        # print(f"代码:{symbol},k_line_data is None,未get到该股的K线属性,或为新股、次新股第一天的时候确实没有历史K线")