admin
3 天以前 084d7337165d6d17b77392054c984dbf9916169a
1.已成交股票详情列表 添加逻辑提前
2.打印收盘涨停概念列表
3个文件已修改
72 ■■■■ 已修改文件
main.py 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/basic_methods.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/buying_strategy.py 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.py
@@ -92,8 +92,11 @@
    #  开盘啦的涨停概念的回调函数
    def kpl_limit_up_process(datas):
        # print(f"回调成功==={datas}")
        now_time = tool.get_now_time_str()
        if datas is not None and len(datas) > 0:
            data_cache.limit_up_block_names = datas
            if data_cache.CLOSING_TIME < now_time < data_cache.AFTER_CLOSING_TIME:
                logger_common.info(f"收盘涨停概念列表更新==={now_time}=={datas}")
        else:
            data_cache.limit_up_block_names = []
strategy/basic_methods.py
@@ -211,7 +211,7 @@
# 充分交易量公式 用于计算日内涨幅段理论的安全交易量值
def sufficient_volume(current_volume, yesterday_volume, today_growth):
    if today_growth > 0 and round(current_volume / yesterday_volume, 2) >= 0.01:
        if current_volume > yesterday_volume * (today_growth/10) * 0.4:
        if current_volume > yesterday_volume * (today_growth/10) * 0.5:
            return True
        else:
            return False
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}")
                                '''
                                无概念无强度 有小量换大涨幅度视界
                                '''