admin
2025-03-28 6f3c0956667cb4383151bdc1d3a7f31f2d048bda
strategy/kpl_api.py
@@ -770,24 +770,27 @@
                    data_cache.index_trend_expectation_score = index_trend_expectation()
                    logger.info(f"大盘指数情绪预期分数==={data_cache.index_trend_expectation_score}分")
                    # 目前大盘指数情绪预期分数 尚不科学 强制设置为初始0值
                    index_trend_expectation_score = 0
                    # # 目前大盘指数情绪预期分数 尚不科学 强制设置为初始0值
                    # index_trend_expectation_score = 0
                    # 获取计算今天新增的持仓数量
                    addition_position_number = len(data_cache.addition_position_symbols_set)
                    # 定义一个今日的剩余新增持仓数量的变量
                    Unfinished_opening_plan_number = 3 - addition_position_number
                    logger.info(f"今日的剩余新增持仓数量==={Unfinished_opening_plan_number}")
                    if Unfinished_opening_plan_number != 0:
                        # 如果GUI看盘上没有手动设置具体的下单金额,就按照评分策略的金额下单,否则就按照GUI设置的金额下单。
                        if data_cache.BUY_MONEY_PER_CODE < 0:
                            # 根据账户可用金额 计算今日计划下单金额
                            # 账户可用金额 默认乘以0.9,永远留一点钱,一方面也冗余一些计算误差
                            #  ((大盘综合强度分数 + 大盘指数情绪预期分数) * 0.01) * (账户可用金额 * 0.9 * 极端低迷情绪比例 / 今日最大新增持仓票数)
                            # data_cache.today_planned_order_amount = ((data_cache.real_time_market_strong + index_trend_expectation_score) * 0.01) * (
                            # data_cache.today_planned_order_amount = ((data_cache.real_time_market_strong + data_cache.index_trend_expectation_score) * 0.01) * (
                            #                                                 usefulMoney * 0.9 * low_emotion_mood_ratio / Unfinished_opening_plan_number)
                            data_cache.today_planned_order_amount = (index_trend_expectation_score * 0.01) * (usefulMoney * 0.95 * low_emotion_mood_ratio / Unfinished_opening_plan_number)
                            data_cache.today_planned_order_amount = (data_cache.index_trend_expectation_score * 0.01) * (usefulMoney * 0.95 * low_emotion_mood_ratio / Unfinished_opening_plan_number)
                            logger.info(f"采用开仓策略计算方式=》今日计划下单金额:{data_cache.today_planned_order_amount},")
                        else:
                            data_cache.today_planned_order_amount = data_cache.BUY_MONEY_PER_CODE
                            logger.info(f"采用GUI设置方式=》今日计划下单金额:{data_cache.today_planned_order_amount}")
        except Exception as error:
            logger.error(f"获取实时大盘行情情绪综合强度[分数] 函数报错: {error}")