admin
3 天以前 084d7337165d6d17b77392054c984dbf9916169a
strategy/buying_strategy.py
@@ -249,6 +249,7 @@
                                    async_log_util.info(logger,
                                                        f"单一板块内瞬时拉升数为:{len(values)},分别为===={values}")
                                    # 如果子列表长度大于1且第二个元素包含 当前进入涨幅视界的symbol_code
                                    # 有强度视界
                                    strength_list_have_it = True
                                    strength_plate = correlation_plate_list
                                if stock_list[6] >= 1:
@@ -420,6 +421,16 @@
                                                                         get_order_money(),
                                                                         k_line_data[0]['sec_name'],
                                                                         current_price)
                                        # 传给GUI显示
                                        purchased_stock_details = {
                                            "name": k_line_data[0]['sec_name'],
                                            "policy_name": "有概念有强度策略分支",
                                            "plate_name": list(limit_up_plate_included),
                                            "buy_time_trading_volume_ratio": (
                                                        current_volume / k_line_data[0]['volume']),
                                        }
                                        data_cache.purchased_stocks_details_list.append(purchased_stock_details)
                                        logger_info(f"已成交股票详情列表:{data_cache.purchased_stocks_details_list} ")
                                        # 检测持仓代码集合中有无下单个股,才认为交易成功
                                        if symbol_code not in data_cache.position_symbols_set:
                                            logger_info(
@@ -431,16 +442,6 @@
                                            data_cache.bought_plate.extend(limit_up_plate_included_list)
                                            logger_info(
                                                f"【{k_line_data[0]['sec_name']}】交易成功!持仓集合:{data_cache.position_symbols_set}")
                                            # 传给GUI显示
                                            purchased_stock_details = {
                                                "name": k_line_data[0]['sec_name'],
                                                "policy_name": "有概念有强度策略分支",
                                                "plate_name": list(limit_up_plate_included),
                                                "buy_time_trading_volume_ratio": (current_volume / k_line_data[0]['volume']),
                                            }
                                            data_cache.purchased_stocks_details_list.append(purchased_stock_details)
                                            logger_info(f"已成交股票详情列表:{data_cache.purchased_stocks_details_list} ")
                                    # 有概念无强度视界
                                    if strength_list_have_it is False:
                                        logger_info(
@@ -540,17 +541,6 @@
                                                f"************************************************【有概念无强度指标下单】************************************************")
                                            logger_info(
                                                f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,瞬时量幅比:{last_volume_to_growth_ratio:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")
                                            # 检测持仓代码集合中有无下单个股,才认为交易成功
                                            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}")
                                                # 传给GUI显示
                                                purchased_stock_details = {
                                                    "name": k_line_data[0]['sec_name'],
@@ -562,6 +552,18 @@
                                                data_cache.purchased_stocks_details_list.append(purchased_stock_details)
                                                logger_info(
                                                    f"已成交股票详情列表:{data_cache.purchased_stocks_details_list} ")
                                            # 检测持仓代码集合中有无下单个股,才认为交易成功
                                            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}")
                                '''
                                无概念 有强度视界
                                '''
@@ -665,17 +667,6 @@
                                                                                 get_order_money(),
                                                                                 k_line_data[0]['sec_name'],
                                                                                 current_price)
                                                # 检测持仓代码集合中有无下单个股,才认为交易成功
                                                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}")
                                                    # 传给GUI显示
                                                    purchased_stock_details = {
                                                        "name": k_line_data[0]['sec_name'],
@@ -688,6 +679,18 @@
                                                        purchased_stock_details)
                                                    logger_info(
                                                        f"已成交股票详情列表:{data_cache.purchased_stocks_details_list} ")
                                                # 检测持仓代码集合中有无下单个股,才认为交易成功
                                                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}")
                                '''
                                无概念无强度 有小量换大涨幅度视界
                                '''