admin
2025-04-03 afa67819ac4c995cb0dbe0cba16c73ddaae3bcb6
strategy/buying_strategy.py
@@ -338,19 +338,15 @@
                                                                             current_price)
                                            # 查看一下该股有无大单
                                            L2_data_analysis.find_L2_big_order_of_code(symbol_code)
                                            # 检测持仓信息中有无下单个股且有该个股的当前持仓,只有当前持仓数量不为0时,才认为交易成功
                                            for i in data_cache.account_positions_dict:
                                                # print(i)
                                                if i['securityID'] == symbol_code:
                                                    # print(i['currentPosition'])
                                                    if i['currentPosition'] == 0:
                                                        logger.info(f"【{i['securityName']}】交易失败~")
                                                    else:
                                                        # 将有概念买入次数自加1
                                                        data_cache.have_plate_buy_times += 1
                                                        # 将买入个股的当时概念添加到全局变量中存储
                                                        data_cache.bought_plate.extend(limit_up_plate_included_list)
                                                        logger.info(f"【{i['securityName']}】交易成功!")
                                            # 检测持仓代码集合中有无下单个股,才认为交易成功
                                            if symbol_code not in 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}")
@@ -435,20 +431,17 @@
                                                # data_cache.bought_plate.extend(limit_up_plate_included_list)
                                                # # 查看一下该股有无大单
                                                L2_data_analysis.find_L2_big_order_of_code(symbol_code)
                                                # 检测持仓信息中有无下单个股且有该个股的当前持仓,只有当前持仓数量不为0时,才认为交易成功
                                                for i in data_cache.account_positions_dict:
                                                    # print(i)
                                                    if i['securityID'] == symbol_code:
                                                        # print(i['currentPosition'])
                                                        if i['currentPosition'] == 0:
                                                            logger.info(f"【{i['securityName']}】交易失败~")
                                                        else:
                                                            # 将有概念买入次数自加1
                                                            data_cache.have_plate_buy_times += 1
                                                            # 将买入个股的当时概念添加到全局变量中存储
                                                            data_cache.bought_plate.extend(limit_up_plate_included_list)
                                                            logger.info(f"【{i['securityName']}】交易成功!")
                                                # 检测持仓代码集合中有无下单个股,才认为交易成功
                                                if symbol_code not in 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}")
                                '''
                                无概念 有强度视界
                                '''
@@ -535,19 +528,17 @@
                                                    # data_cache.bought_plate.extend(strength_plate)
                                                    # 查看一下该股有无大单
                                                    L2_data_analysis.find_L2_big_order_of_code(symbol_code)
                                                    # 检测持仓信息中有无下单个股且有该个股的当前持仓,只有当前持仓数量不为0时,才认为交易成功
                                                    for i in data_cache.account_positions_dict:
                                                        # print(i)
                                                        if i['securityID'] == symbol_code:
                                                            # print(i['currentPosition'])
                                                            if i['currentPosition'] == 0:
                                                                logger.info(f"【{i['securityName']}】交易失败~")
                                                            else:
                                                                # 将有概念买入次数自加1
                                                                data_cache.have_strength_buy_times += 1
                                                                # 将买入个股的当时概念添加到全局变量中存储
                                                                data_cache.bought_plate.extend(strength_plate)
                                                                logger.info(f"【{i['securityName']}】交易成功!")
                                                    # 检测持仓代码集合中有无下单个股,才认为交易成功
                                                    if symbol_code not in data_cache.position_symbols_set:
                                                        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(
                                                            f"【{k_line_data[0]['sec_name']}】交易成功!持仓集合:{data_cache.position_symbols_set}")
                                '''
                                无概念无强度 有小量换大涨幅度视界
                                '''
@@ -645,19 +636,18 @@
                                                    # data_cache.bought_plate.append(k_line_data[0]['sec_name'])
                                                    # 查看一下该股有无大单
                                                    L2_data_analysis.find_L2_big_order_of_code(symbol_code)
                                                    # 检测持仓信息中有无下单个股且有该个股的当前持仓,只有当前持仓数量不为0时,才认为交易成功
                                                    for i in data_cache.account_positions_dict:
                                                        # print(i)
                                                        if i['securityID'] == symbol_code:
                                                            # print(i['currentPosition'])
                                                            if i['currentPosition'] == 0:
                                                                logger.info(f"【{i['securityName']}】交易失败~")
                                                            else:
                                                                # 将有概念买入次数自加1
                                                                data_cache.have_small_turn_large_buy_times += 1
                                                                # 将买入个股的当时概念添加到全局变量中存储
                                                                data_cache.bought_plate.extend(k_line_data[0]['sec_name'])
                                                                logger.info(f"【{i['securityName']}】交易成功!")
                                                    # 检测持仓代码集合中有无下单个股,才认为交易成功
                                                    if symbol_code not in data_cache.position_symbols_set:
                                                        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(
                                                            f"【{k_line_data[0]['sec_name']}】交易成功!持仓集合:{data_cache.position_symbols_set}")
                                '''
                                昨日涨停视界,今日连板预期盯视界
                                '''
@@ -673,9 +663,7 @@
                                            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:
                                                    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: