Administrator
2024-01-03 ef54e22b293741354a9de3050e69816c33975c10
取消测试
4个文件已修改
73 ■■■■■ 已修改文件
l2/l2_data_manager_new.py 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/test_code_attribute.py 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
third_data/kpl_data_manager.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/init_data_util.py 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
l2/l2_data_manager_new.py
@@ -1101,15 +1101,15 @@
                # 非强势主线
                if zyltgb < zylt_threshold[1] or zyltgb > zylt_threshold[2]:
                    if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < volume_rate_thresholds[1]:
                        return False, True, f"非强势10分钟,非强势主线后排,不满足自由市值, 当日量比({cls.volume_rate_info[code][0]})小于{volume_rate_thresholds[1]}"
                        return False, True, f"非强势10分钟,非强势主线后排【主线后排】,不满足自由市值, 当日量比({cls.volume_rate_info[code][0]})小于{volume_rate_thresholds[1]}"
                else:
                    if k_format and (k_format[1][0] or k_format[3][0]):
                        # 股价创新高或者逼近前高
                        if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < volume_rate_thresholds[1]:
                            return False, True, f"非强势10分钟,非强势主线后排,满足自由市值,股价创新高或者逼近前高, 当日量比({cls.volume_rate_info[code][0]})小于{volume_rate_thresholds[1]}"
                            return False, True, f"非强势10分钟,非强势主线后排【主线后排】,满足自由市值,股价创新高或者逼近前高, 当日量比({cls.volume_rate_info[code][0]})小于{volume_rate_thresholds[1]}"
                    else:
                        if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < volume_rate_thresholds[0]:
                            return False, True, f"非强势10分钟,非强势主线后排, 满足自由市值,当日量比({cls.volume_rate_info[code][0]})小于{volume_rate_thresholds[0]}"
                            return False, True, f"非强势10分钟,非强势主线后排【主线后排】, 满足自由市值,当日量比({cls.volume_rate_info[code][0]})小于{volume_rate_thresholds[0]}"
            return True, False, can_buy_result[2]
    @classmethod
test/test_code_attribute.py
@@ -10,16 +10,13 @@
if __name__ == "__main__":
    # code_str = "002103,002108,002176,002189,002328,002397,002457,002495,002578,002903,002933,003028,003040,600234,600293,600764,603090,603162,603193,603270,603332,603380,603615,603711"
    code_str = "000656,000779,000892,000995,001255,001269,001300,002103,002127,002292,002306,002323,002494,002518,002613,002615,002697,002748,002771,002799,002855,002875,002878,002931,002942,300530,301168,600159,600321,600630,600805,603188,603392,603600,603608,603628,603729,603836,605117,688685"
    codes = code_str.split(",")
    for code in codes:
        if not tool.is_shsz_code(code):
            continue
        try:
            # limit_up_price = 16.96
            volumes_data = init_data_util.get_volumns_by_code(code, 150)
            volumes_data = volumes_data[4:]
            print(code, code_nature_analyse.is_special(volumes_data))
        except:
            print(code, "出错")
    code = "000897"
    limit_up_price = 2.39
    volumes_data = init_data_util.get_volumns_by_code(code, 150)
    volumes = init_data_util.parse_max_volume(volumes_data[:90],
                                              code_nature_analyse.is_new_top(
                                                  limit_up_price,
                                                  volumes_data[:90]) or code_nature_analyse.is_near_top(
                                                  limit_up_price,
                                                  volumes_data[:90]))
    print(volumes)
third_data/kpl_data_manager.py
@@ -401,7 +401,7 @@
    def get_limit_up():
        while True:
            if tool.is_trade_time() or True:
            if tool.is_trade_time():
                try:
                    results = kpl_api.getLimitUpInfoNew()
                    result = json.loads(results)
utils/init_data_util.py
@@ -47,7 +47,8 @@
                break
        if latest_limit_up_index is not None:
            # 突破前高或者接近前高,30个交易日内有涨停
            if latest_limit_up_index > 0 and datas[latest_limit_up_index - 1]["volume"] > datas[latest_limit_up_index]["volume"]:
            if latest_limit_up_index > 0 and datas[latest_limit_up_index - 1]["volume"] > datas[latest_limit_up_index][
                "volume"]:
                return datas[latest_limit_up_index - 1]["volume"], datas[latest_limit_up_index - 1]["volume"], \
                       datas[latest_limit_up_index - 1]['bob'].strftime("%Y-%m-%d")
            else:
@@ -73,7 +74,8 @@
                max_volume_date = item['bob']
            # 是否有涨停
            limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(item["pre_close"]))
            if abs(limit_up_price - item["high"]) < 0.01:
            # 不看超过60天的涨停
            if abs(limit_up_price - item["high"]) < 0.01 and i <= 59:
                # 涨停
                next_volume = 0
                if i > 0:
@@ -84,27 +86,17 @@
                    date = datas[i - 1]["bob"]
                target_volume = (volume, date)
                break
        # 90个交易日无涨停,取最近30天内的最高量作为参考量
        if not target_volume:
            target_volume = (max_volume, max_volume_date)
        # --判断近60天无涨停的最大量
        max_60_volume_info = [0, None]
        # 60天内是否有涨停
        has_60_limit_up = False
        for i in range(60):
            if i >= len(datas):
                break
            item = datas[i]
            volume = item["volume"]
            if max_60_volume_info[0] < volume:
                max_60_volume_info = [volume, item["bob"]]
            limit_up_price = float(gpcode_manager.get_limit_up_price_by_preprice(item["pre_close"]))
            if abs(limit_up_price - item["high"]) < 0.01:
                has_60_limit_up = True
                break
        if not has_60_limit_up and target_volume[0] > max_60_volume_info[0] * 3:
            # 60天内无涨停,且60天内最大量小于最大量的1/3,判断为地量,返回近60个交易日的最大量
            return max_60_volume_info[0], max_60_volume_info[0], max_60_volume_info[1].strftime("%Y-%m-%d")
        else:
            return target_volume[0], target_volume[0], target_volume[1].strftime("%Y-%m-%d")
            # --判断近30天无涨停的最大量
            max_30_volume_info = [0, None]
            for i in range(30):
                if i >= len(datas):
                    break
                item = datas[i]
                volume = item["volume"]
                if max_30_volume_info[0] < volume:
                    max_30_volume_info = [volume, item["bob"]]
            target_volume = max_30_volume_info
        return target_volume[0], target_volume[0], target_volume[1].strftime("%Y-%m-%d")