strategy/plate_strength_analysis.py
@@ -4,8 +4,10 @@
import time
import dask
import constant
from log_module import async_log_util
from log_module.log import logger_common, logger_kpl_jingxuan_in, logger_debug, logger_kpl_market_sift_plate
from log_module.log import logger_common, logger_kpl_jingxuan_in, logger_debug, logger_kpl_market_sift_plate, \
    logger_kpl_limit_up, logger_kpl_code_plates
from strategy import kpl_api, data_cache, basic_methods
from strategy.kpl_data_manager import KPLMarketStockHeatLogManager
from utils import tool, hx_qc_value_util
@@ -56,7 +58,7 @@
            # 初始化股票强度列表
            stock_power_list = []
            for s in its_stock['list']:
                # 过滤掉涨幅大于  当日涨幅s[6] < 0% 的 和 名称中包含ST的 和 涨速小于等于0%的 和 只要昨日未涨停 和 上证或深证的正股    and s[9] > 0.0025  上季度机构持仓 >0
                # 过滤掉涨幅大于  当日涨幅s[6] < 0% 的 和 名称中包含ST的 和 涨速小于等于0%的 和 只要昨日未涨停 和 上证或深证的正股    and s[9] > 1(s[9]=涨速)  上季度机构持仓 >0
                if s[6] > 0 and s[1].find("ST") < 0 and s[1].find("XD") < 0 and s[23].find("板") < 0 and s[24].find("板") < 0 and (s[0].startswith('60') or s[0].startswith('00')) and s[9] > 1 and int(s[42]) >= 0:
                    # print(f"{s[1]},个股代码:{s[0]},   涨幅:{s[6]}%   涨速:{s[9]}%   概念:{s[4]}   主力资金推测:{s[2]}   领涨次数:{s[40]}  今日第几板:{s[23]} 是否破版{s[24]}")
                    # 对个股强度 主要 属性列表进行装填
@@ -75,15 +77,17 @@
        return log_data
    # 定义一个时间段,在这个时间段内才会执行下面的代码,主要就是把强度数据作为日志打印存储下来。
    now_time = tool.get_now_time_str()
    if '11:30:10' < now_time < '12:59:50':
        return
    data = (kpl_api.getMarketJingXuanRealRankingInfo())
    market_sift_plate = json.loads(data)
    # print(f"market_sift_plate 数 ======{len(market_sift_plate['list'])}")
    # 精选板块【前20】 market_sift_plate['list'] ======
    if data_cache.OPENING_TIME < now_time < data_cache.AFTER_CLOSING_TIME:
    if data_cache.OPEN_BIDDING_TIME < now_time < data_cache.AFTER_CLOSING_TIME:
        logger_kpl_market_sift_plate.info(f"{market_sift_plate['list']}")
    # 总控制时间段
    if not (data_cache.OPENING_TIME < now_time < data_cache.NOON_MARKET_TIME):
    if not (data_cache.OPEN_BIDDING_TIME < now_time < data_cache.NOON_MARKET_TIME):
        return
    # ['801235', '化工', 6996, 0.027, 2.43, 117836347690, -122548038, 8105997595, -8228545633, 0.92, 8595377775454, 0.09, 332297449, 9954902621130, -192457252, 24.0487, 17.1809, 6996, 0.027]
    # market_sift_plate['list'][0] = ['801062', '军工', 3520, -0.49, 0.666, 139133934669, 383864272, 9077352839, -8693488567, 1.183, 6129448037490,-0.12, 168245858, 7088854452019, -290614763, 50.2408, 30.3672, 3520, 0]
@@ -140,7 +144,7 @@
    # 设定当前时间点
    now_time = tool.get_now_time_str()
    # print(f"now_time===={now_time}")
    if data_cache.SERVER_RESTART_TIME < now_time < data_cache.UPDATE_DATA_TIME:
    if data_cache.OPEN_BIDDING_TIME < now_time < data_cache.CLOSING_TIME:
        # print(f"在时间内使用--------------------------")
        # 获取涨停信息列表
        limit_up_info = kpl_api.get_limit_up_info()
@@ -159,6 +163,8 @@
        # most_common_element, most_common_count = counter.most_common(1)[0]
        # # 打印出现次数最多的元素
        # print(f"主线概念:{most_common_element},出现了 {most_common_count} 次")
        async_log_util.info(logger_kpl_limit_up, f"{limit_up_info}")
        return limit_up_block_names
@@ -455,6 +461,8 @@
    # 写入文件
    with open(constant.ALL_STOCKS_PLATE_PATH, 'w', encoding='utf-8') as f:
        f.write(json_data)
    # 记录到日志
    async_log_util.info(logger_kpl_code_plates, json_data)
    now_time = datetime.datetime.now()  # 获取本机时间
    logger_common.info(f"写入所有个股板块文件完成!::{now_time}")