admin
2025-03-11 67f7c823c598057e63d5cf1014b2fdfceb133120
日志调整
6个文件已修改
30 ■■■■ 已修改文件
constant.py 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/all_K_line.py 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/buying_strategy.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/data_cache.py 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/index_market_trend_strategy.py 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/kpl_api.py 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constant.py
@@ -56,6 +56,7 @@
def get_path_prefix():
    return 'D:' if is_windows() else '/home/userzjj'
# 定义log日志的路径
LOG_PATH = f"{get_path_prefix()}/logs"
@@ -71,10 +72,8 @@
K_BARS_PATH = f"{DATA_DIR_PATH}/all_stocks_all_K_line_property_dict.json"
# 每日涨停概念记录数据
KPL_LIMIT_UP_DATA_PATH = f"{DATA_DIR_PATH}/limit_up_block_date_data.jsonl"
# 日内所有股票开盘数据存储
# 日内所有股票开盘数据存储  [只是在初步编写时测试使用]
KPL_LIMIT_UP_BLOCK_NAMES_PATH = f"{DATA_DIR_PATH}/limit_up_block_names.json"
# 订阅L2代码数据
SUBSCRIPT_L2_CODES = set()
strategy/all_K_line.py
@@ -534,8 +534,7 @@
    # 计算90天内涨停天数
    for i in k_line_data:
        if 'attribute' in i and (
                i['attribute'] == 'one_line_limit_up' or i['attribute'] == 'limit_down_then_limit_up' or i[
            'attribute'] == 'limit_up_then_limit_down_then_limit_up' or i['attribute'] == 'limit_up'):
                i['attribute'] == 'one_line_limit_up' or i['attribute'] == 'limit_down_then_limit_up' or i['attribute'] == 'limit_up_then_limit_down_then_limit_up' or i['attribute'] == 'limit_up'):
            limit_up_day += 1
            # print(f"涨停提日期:{i['bob']}")
        # print(f"涨停天数----limit_up_day======{limit_up_day}")
strategy/buying_strategy.py
@@ -331,7 +331,7 @@
                                            logger.info(
                                                f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")
                                            logger.info(
                                                f"大盘情绪分数:{data_cache.real_time_market_strong},设想的下单金额:{data_cache.today_planned_order_amount}")
                                                f"大盘综合强度分数:{data_cache.real_time_market_strong},大盘指数情绪预期分数==={data_cache.index_trend_expectation_score}分,设想的下单金额:{data_cache.today_planned_order_amount}")
                                            # 调用下单方法下单
                                            order_methods.buy_order_by_value(symbol, data_cache.today_planned_order_amount,
                                                                             k_line_data[0]['sec_name'],
@@ -494,7 +494,7 @@
                                                    logger.info(
                                                        f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}")  # 输出当前价格和3秒涨幅信息
                                                    logger.info(
                                                        f"大盘情绪分数:{data_cache.real_time_market_strong},设想的下单金额:{data_cache.today_planned_order_amount}")
                                                        f"大盘综合强度分数:{data_cache.real_time_market_strong},大盘指数情绪预期分数==={data_cache.index_trend_expectation_score}分,设想的下单金额:{data_cache.today_planned_order_amount}")
                                                    # 调用下单方法下单
                                                    order_methods.buy_order_by_value(symbol,
                                                                                     data_cache.today_planned_order_amount,
strategy/data_cache.py
@@ -246,6 +246,8 @@
TSXV_today_growth = 0
# 创业板指 开盘涨幅
TSXV_open_growth = 0
# 大盘指数情绪预期分数
index_trend_expectation_score = 0
# 每次买入的金额
BUY_MONEY_PER_CODE = -1
strategy/index_market_trend_strategy.py
@@ -29,7 +29,7 @@
        Shanghai_index_volume = round(Shanghai_index_data[1]/100000000, 2)  # 上证指数 当日当时成交量
        Shanghai_index_turnover = round(Shanghai_index_data[2]/100000000, 2)  # 上证指数 当日当时成交额度
        Shanghai_Yesterday_closing_index = round(Shanghai_index_data[3], 2)  # 上证指数 昨日收盘指数
        logger.info(f"上证 指数:{Shanghai_index}   昨日收盘指数:{Shanghai_Yesterday_closing_index}   成交量------------{Shanghai_index_volume}亿 手   成交额------------{Shanghai_index_turnover}亿 元")
        logger.info(f"上证 指数:{Shanghai_index}   昨日收盘指数:{Shanghai_Yesterday_closing_index}   成交量:{Shanghai_index_volume}亿 手   成交额:{Shanghai_index_turnover}亿 元")
        # 深证指数数据
        Shenzhen_index_data = current_info.get('399001')
@@ -37,7 +37,7 @@
        Shenzhen_index_volume = round(Shenzhen_index_data[1]/100000000, 2)  # 深证指数 当日当时成交量
        Shenzhen_index_turnover = round(Shenzhen_index_data[2]/100000000, 2)  # 深证指数 当日当时成交额度
        Shenzhen_Yesterday_closing_index = round(Shenzhen_index_data[3], 2)  # 深证指数 昨日收盘指数
        logger.info(f"深证 指数:{Shenzhen_index}   昨日收盘指数:{Shenzhen_Yesterday_closing_index}   成交量------------{Shenzhen_index_volume}亿 手   成交额------------{Shenzhen_index_turnover}亿 元")
        logger.info(f"深证 指数:{Shenzhen_index}   昨日收盘指数:{Shenzhen_Yesterday_closing_index}   成交量:{Shenzhen_index_volume}亿 手   成交额:{Shenzhen_index_turnover}亿 元")
        # 创业板指数数据
        TSXV_index_data = current_info.get('399006')
@@ -45,7 +45,7 @@
        TSXV_index_volume = round(TSXV_index_data[1]/100000000, 2)  # 创业板指 当日当时成交量
        TSXV_index_turnover = round(TSXV_index_data[2]/100000000, 2)  # 创业板指 当日当时成交额度
        TSXV_Yesterday_closing_index = round(TSXV_index_data[3], 2)  # 深证指数 昨日收盘指数
        logger.info(f"创业板 指数:{TSXV_index}   昨日收盘指数:{TSXV_Yesterday_closing_index}  成交量------------{TSXV_index_volume}亿 手   成交额------------{TSXV_index_turnover}亿 元")
        logger.info(f"创业板 指数:{TSXV_index}   昨日收盘指数:{TSXV_Yesterday_closing_index}  成交量:{TSXV_index_volume}亿 手   成交额:{TSXV_index_turnover}亿 元")
        # 调用涨幅公式计算对应的股票tick瞬时涨幅
        data_cache.Shanghai_tick_growth = basic_methods.tick_growth('000001', Shanghai_index)
strategy/kpl_api.py
@@ -278,7 +278,9 @@
            ds.append(request_plate_codes(d))
        dask_result = batch_get_plate_codes(ds)
        dask_result.compute()
        logger.info(f"精选板块股票强度数据更新 == {market_sift_plate_stock_dict}")
        now_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        if data_cache.L1_data_start_time < now_time < data_cache.closing_time:
            logger.info(f"精选板块股票强度数据更新 == {market_sift_plate_stock_dict}")
    return market_sift_plate_stock_dict
@@ -732,9 +734,9 @@
                            low_emotion_mood_ratio = 0
                    logger.info(f"极端低迷情绪比例===={low_emotion_mood_ratio * 100}%")
                    index_trend_expectation_score = index_trend_expectation()
                    logger.info(f"大盘指数情绪预期分数==={index_trend_expectation_score}分")
                    print(f"大盘指数情绪预期分数==={index_trend_expectation_score}分")
                    data_cache.index_trend_expectation_score = index_trend_expectation()
                    logger.info(f"大盘指数情绪预期分数==={data_cache.index_trend_expectation_score}分")
                    # print(f"大盘指数情绪预期分数==={data_cache.index_trend_expectation_score}分")
                    # 目前大盘指数情绪预期分数 尚不科学 强制设置为初始0值
                    index_trend_expectation_score = 0