1.删除有强度逻辑分支中【不利】无领涨次数
2.在主要分支逻辑中打印充分交易量函数
3.同时启用修改后的分时段安全交易量函数
4.
3个文件已修改
57 ■■■■■ 已修改文件
strategy/basic_methods.py 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/buying_strategy.py 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/plate_strength_analysis.py 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
strategy/basic_methods.py
@@ -185,7 +185,7 @@
def secure_volume(now_date_time):
    # 定义时间段的开始和结束时间(使用字符串格式)
    time_slots = [
        (("09:30:00", "09:30:30"), 0.05),
        (("09:30:00", "09:30:30"), 0.04),
        (("09:30:30", "09:31:00"), 0.08),
        (("09:31:00", "09:31:30"), 0.1),
        (("09:31:30", "09:32:00"), 0.15),
@@ -208,9 +208,13 @@
    return 0
# 示例使用
# now = datetime.now()
# print(f"secure_volume(now)=={secure_volume(now)}")
# 充分交易量公式 用于计算日内涨幅段理论的安全交易量值
def sufficient_volume(current_volume, yesterday_volume, today_growth):
    if current_volume < yesterday_volume * today_growth:
        return False
    else:
        return True
# 计算 委买和委卖的比例函数(获取买盘强度数据)【掘金数据结构】
def buying_and_selling_ratio(current_quotes):
strategy/buying_strategy.py
@@ -313,17 +313,18 @@
                                    intersection_plate = bought_plate_set.intersection(limit_up_plate_included)
                                    if len(intersection_plate) > 0:
                                        logger_info(f"重复相交概念==={intersection_plate}")
                                    logger_info(
                                        f"【有概念】(涨停列表中包含自身概念 且 不是唯一包含概念不可用) !最新价: {current_price},,当日当时涨幅:{today_growth}%。")
                                    # 调用充分交易量函数
                                    sufficient_volume = basic_methods.sufficient_volume(current_volume, k_line_data[0]['volume'], today_growth)
                                    logger_info(f"【{k_line_data[0]['sec_name']}】当日当时量是否相对涨幅充足?===【{sufficient_volume}】 !当日当时总成交量:{round(current_volume / 10000, 2)}万,昨日的总成交量{round(k_line_data[0]['volume'] / 10000, 2)}万,当日当时涨幅:{today_growth}%。")
                                    logger_info(f"【有概念】(涨停列表中包含自身概念 且 不是唯一包含概念不可用) !最新价: {current_price},,当日当时涨幅:{today_growth}%。")
                                    # 有概念有强度视界
                                    if strength_list_have_it is True:
                                        logger_info(f"【有概念 有强度】出现在板块强度大于2的列表中 瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,当日当时涨幅:{today_growth}%。")
                                        # if tick_growth >= 0.8:
                                        #     logger_info(
                                        #         f"【有概念 有强度 有强拉】瞬时涨幅 > 0.8% !瞬时涨幅:{round(tick_growth, 2)}%")
                                        if tick_growth < 0.8 and (free_market_value <= 100 and current_price <= 10):
                                            logger_info(f"【有概念 有强度 有强拉】瞬时涨幅 > 0.8% !瞬时涨幅:{round(tick_growth, 2)}%")
                                            return
                                        if last_volume_to_growth_ratio > 0.8 and (free_market_value <= 100 and current_price <= 10):
                                            logger_info(
                                                f"【不利】瞬时量幅比> 0.8 且 (小自由市值<40亿 或 最新价小于20元 )!,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,自由市值:{free_market_value} 亿。")
                                            logger_info(f"【不利】瞬时量幅比> 0.8 且 (小自由市值<40亿 或 最新价小于20元 )!,瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,自由市值:{free_market_value} 亿。")
                                            return
                                        if now_time <= datetime.time(9, 30, 5).strftime("%H:%M:%S"):
                                            logger_info(
@@ -379,6 +380,10 @@
                                            logger_info(
                                                f"【不利】自由市值大于100亿,且未发现大单!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                            return
                                        if current_volume < k_line_data[0]['volume'] * ratios:
                                            logger_info(
                                                f"【不利】当日成交量小于昨日成交量的{ratios}倍!不买!!公司名称:{k_line_data[0]['sec_name']},当日当时总成交量:{current_volume},最新价: {current_price}")
                                            return
                                        if len(intersection_plate) > 0:
                                            logger_info(
                                                f"【不利】同概念只买一次,不买了,公司名称:{k_line_data[0]['sec_name']},重复相交概念==={intersection_plate}")
@@ -394,7 +399,6 @@
                                        if now_time < data_cache.OPENING_TIME or now_time > data_cache.NOON_MARKET_TIME:
                                            logger_info(f"【不利】不在9:30-13:05时间内!不买!!")
                                            return
                                        logger_info(
                                            f"************************************************【有概念有强度指标下单】************************************************")
                                        logger_info(
@@ -542,6 +546,12 @@
                                        intersection_plate = bought_plate_set.intersection(strength_plate_set)
                                        if len(intersection_plate) > 0:
                                            logger_info(f"重复相交强度==={intersection_plate}")
                                        # 调用充分交易量函数
                                        sufficient_volume = basic_methods.sufficient_volume(current_volume,
                                                                                            k_line_data[0]['volume'],
                                                                                            today_growth)
                                        logger_info(
                                            f"【{k_line_data[0]['sec_name']}】当日当时量是否相对涨幅充足?===【{sufficient_volume}】 !当日当时总成交量:{round(current_volume / 10000, 2)}万,昨日的总成交量{round(k_line_data[0]['volume'] / 10000, 2)}万,当日当时涨幅:{today_growth}%。")
                                        if last_volume_to_growth_ratio < 1:
                                            logger_info(
                                                f"【有强度 有小量换大涨幅】瞬时量幅比< 1 !瞬时量幅比:{round(last_volume_to_growth_ratio, 2)}%,最新价: {current_price},瞬时涨幅:{round(tick_growth, 2)}%,当日当时涨幅:{today_growth}%,当前时间:{current_created_at}。")
@@ -594,10 +604,10 @@
                                                    logger_info(
                                                        f"【不利】自由市值小于6亿!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                                    return
                                                if have_leading_increase is False:
                                                    logger_info(
                                                        f"【不利】有强度的板块中没有发现领涨次数!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                                    return
                                                # if have_leading_increase is False:
                                                #     logger_info(
                                                #         f"【不利】有强度的板块中没有发现领涨次数!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
                                                #     return
                                                if (free_market_value == 0 or free_market_value == 0.0) and free_market_value > 100 and L2_found_big_order is False:
                                                    logger_info(
                                                        f"【不利】自由市值大于100亿,且未发现大单!不买!! 公司名称:{k_line_data[0]['sec_name']},最新价: {current_price}")
@@ -657,8 +667,7 @@
                                                if current_volume < k_line_data[0]['volume'] * ratios:
                                                    logger_info(
                                                        f"【不利】今日成交量 < 昨日的{ratios}倍,不买!!公司名称:{k_line_data[0]['sec_name']},今日目前成交量为昨日的{round(current_volume / k_line_data[0]['volume'], 2)}")
                                                elif buying_strong is not True and current_volume <= k_line_data[0][
                                                    'volume'] * ratios and now_time > data_cache.MORN_MARKET_TIME:
                                                elif buying_strong is not True and current_volume <= k_line_data[0]['volume'] * ratios and now_time > data_cache.MORN_MARKET_TIME:
                                                    logger_info(
                                                        f"【不利】买一量小于卖一量 且 挂买总量小于挂卖总量 且 当日量不足 (9:35后实施)!不买!!公司名称:{k_line_data[0]['sec_name']},自由市值:{free_market_value} 亿,最新价: {current_price}")
                                                    # logger_info(
strategy/plate_strength_analysis.py
@@ -70,15 +70,16 @@
        return log_data
    # 定义一个时间段,在这个时间段内才会执行下面的代码,主要就是把强度数据作为日志打印存储下来。
    now_time = tool.get_now_time_str()
    if not (data_cache.OPENING_TIME < now_time < data_cache.NOON_MARKET_TIME):
        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.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):
        return
    # 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]
    # 行情精选板块列表 前20 中的 第一个板块列表数据 = 【代码,板块名称,强度,涨幅?,0.666?,成交额?,现额?,主买,主卖,1.183?,流通值?,-0.12?,300W大单净额?,总市值?,上季度机构增仓,今年平均PE,次年平均PE,强度,未知0值】
    # logger.info(f"market_sift_plate['list'][0]  ======{market_sift_plate['list'][0]}")
@@ -87,7 +88,6 @@
    if 'list' in market_sift_plate:
        ds = []
        for d in market_sift_plate['list']:
            # todo 获取板块名称和板块代码 主要是板块的强度和主力净额这些
            ds.append(request_plate_codes(d))
        dask_result = batch_get_plate_codes(ds)
        compute_results = dask_result.compute()