admin
3 天以前 0b0d0e790fec8c7edfdbcab5c31d625e0c2eadd6
strategy/all_K_line.py
@@ -11,7 +11,8 @@
import json
import constant
from log_module.log import logger_common
from log_module import async_log_util
from log_module.log import logger_common, logger_k_bars
from strategy import data_cache
# 引入基础算法模块
@@ -160,8 +161,8 @@
                # 最高位据昨日较远 且 昨收价距历史最高价差距较小(小于5%,涨幅5%是左右是最容易把低吸骗进去的日内涨幅) 且 整体涨跌幅度较大  【当前二度突破近前高风险】
                # 【双成药业 2024-11-08 这样的二次近前高,实际数值为1.4646...,为安全起见还是设置为1.5】
                if (2 < historical_high_price_index < 15 and len(it_K_line) >= 90) and (
                        historical_high_price / round(it_K_line[0]['close'], 2) < 1.5) and (
                        historical_high_price > historical_low_price * 1.8):
                        historical_high_price / round(it_K_line[0]['close'], 2) < 1.2) and (
                        historical_high_price > historical_low_price * 2):
                    it_K_line[0]['risk_position'] = 'recent_second_break_near_high_position_risk'
                # 昨日就是最高位 且 整体涨跌幅度较大 【当前高位风险】
                if (historical_high_price_index < 2 and len(it_K_line) >= 90) and (
@@ -378,6 +379,7 @@
        # 将转换后的JSON字符串写入文件
        with open(constant.K_BARS_PATH, 'w', encoding='utf-8') as f:
            f.write(json_data)
        async_log_util.info(logger_k_bars, json_data)
    except Exception as error:
        print(f"An error occurred while converting the data to JSON: {error}")
    logger.info(f"标的个股历史k线写完了!{tool.get_now_time_str()}")