admin
2025-03-25 5acb6f700c6ffaf1c7470664c2f06dc6ecf2efba
bug修改
5个文件已修改
34 ■■■■ 已修改文件
main.py 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/check_timer.py 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/data_cache.py 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/index_market_trend_strategy.py 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/local_data_management.py 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.py
@@ -102,6 +102,8 @@
        # print(f"回调成功==={datas}")
        if datas is not None and len(datas) > 0:
            data_cache.limit_up_block_names = datas
        else:
            data_cache.limit_up_block_names = []
    # # 计算当前线程数量
    # get_current_thread_count()
strategy/check_timer.py
@@ -37,9 +37,12 @@
                # 完成了后将是否执行的开个标记为真
                data_cache.execution = True
            # 本地数据更新时间
            if data_cache.UPDATE_DATA_TIME < now_time:
            if data_cache.UPDATE_DATA_TIME < now_time and data_cache.index_K_line_write_execution is False:
                # 写入所有指数K线
                index_market_trend_strategy.all_index_k_line_dict_write()
                logger.info(f"写入所有带属性指数K线 已经运行完成")
                # 完成了后将是否执行的开个标记为真
                data_cache.index_K_line_write_execution = True
        except Exception as error:
            logger.error(f"实时检测定时器线程报错: {error}")
        finally:
strategy/data_cache.py
@@ -155,8 +155,10 @@
yesterday_limit_up_code_list = []
# 初始化开盘啦昨日炸板但通过K线数据计算涨停的股票代码列表
yesterday_frying_plate_last_minute_list = []
# 初始化每日涨停信息方法被执行记录
# 初始化每日涨停信息方法 和 获取所有个股的板块概念 是否被执行
execution = False
# 初始化 写入带属性指数K线的方法 是否被执行
index_K_line_write_execution = False
# 初始化实时涨停概念板块
limit_up_block_names = []
# 初始化板块强度下的个股强度
strategy/index_market_trend_strategy.py
@@ -283,6 +283,9 @@
            start = None
        #  确保不会出现除以零的报错
        if current_yesterday_volume != 0:
            if str(it_K_line[i]['bob']).find('2025-03-21')>=0:
                print(f"")
            print(f"{it_K_line[i]['bob']} 的 current_today_volume=={current_today_volume},, current_yesterday_volume=={current_yesterday_volume}")
            if round(current_today_volume / current_yesterday_volume, 2) > 1.1:
                # print(f"i=={i} {it_K_line[i]['bob']} {round(current_today_volume/current_yesterday_volume,2)} 【放量】")
                if current_today_growth > 0:
@@ -403,8 +406,10 @@
        print(f"An error occurred while converting the data to JSON: {error}")
    logger.info(f"加属性的指数k线写完了!{tool.get_now_time_str()}")
if __name__ == '__main__':
    # all_index_K_line_dict = get_index_K_line()
    # all_index_k_line_dict_write()
    print(f"指数K线{data_cache.all_index_k_line_property_dict}")
    # print(f"指数K线{data_cache.all_index_k_line_property_dict}")
    all_index_k_line_dict_write()
strategy/local_data_management.py
@@ -16,15 +16,17 @@
    if os.path.exists(constant.K_BARS_PATH):
        with open(constant.K_BARS_PATH, 'r', encoding='utf-8') as f:
            data_cache.all_stocks_all_K_line_property_dict = json.load(f)
            print(
                f"data_cache.all_stocks_all_K_line_property_dict的个数==={len(data_cache.all_stocks_all_K_line_property_dict)}")
            # print(
            #     f"data_cache.all_stocks_all_K_line_property_dict的个数==={len(data_cache.all_stocks_all_K_line_property_dict)}")
    # 先使用json.load()直接从文件中读取【已经存储在本地的K线指标属性字典】并解析JSON数据
    if os.path.exists(constant.INDEX_K_BARS_PATH):
        with open(constant.INDEX_K_BARS_PATH, 'r', encoding='utf-8') as f:
            data_cache.all_index_k_line_property_dict = json.load(f)
            print(
                f"data_cache.all_index_k_line_property_dict==={len(data_cache.all_index_k_line_property_dict)}")
            all_index_k_line_property_dict = data_cache.all_index_k_line_property_dict
            # print(
            #     f"data_cache.all_index_k_line_property_dict==={len(data_cache.all_index_k_line_property_dict)}")
    return all_index_k_line_property_dict
# 读取本地的个股所属概念板块数据
@@ -42,4 +44,8 @@
if __name__ == '__main__':
    read_local_K_line_data()
    all_index_k_line_property_dict = read_local_K_line_data()
    print(f"all_index_k_line_property_dict=={all_index_k_line_property_dict}")
    if all_index_k_line_property_dict['SHSE.000001'][1]['today_volume_shape'] == 'remained_down':
        print(f"昨日平量下跌")