| | |
| | | # 设置历史量 |
| | | def set_histry_volumn(code, max60, yesterday, max60_day, max60_day_count): |
| | | redis = __redis_manager.getRedis() |
| | | global_util.max60_volumn[code] = (max60, max60_day) |
| | | global_util.max60_volumn[code] = (max60, max60_day,max60_day_count) |
| | | global_util.yesterday_volumn[code] = yesterday |
| | | try: |
| | | RedisUtils.setex_async(0, "volumn_max60-{}".format(code), tool.get_expire(), |
| | |
| | | has_limit_down_in_5 = True if k_format and len(k_format) >= 13 and k_format[12] else False |
| | | # 是否是强势10分钟 |
| | | is_in_strong_time = now_timestamp <= int("094000") |
| | | # 是否是强势30分钟 |
| | | is_in_strong_time_30 = now_timestamp <= int("100000") |
| | | |
| | | |
| | | # 量参考是否在最近30天 |
| | | # is_refer_volume_date_in_30_days = False |
| | |
| | | |
| | | # 获取市场行情 |
| | | situation = cls.__MarketSituationManager.get_situation_cache() |
| | | zylt_threshold = buy_condition_util.get_zyltgb_threshold(situation) |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | zylt_threshold_as_yi = buy_condition_util.get_zyltgb_threshold(situation) |
| | | zyltgb_as_yi = round(global_util.zyltgb_map.get(code) / 100000000, 2) |
| | | |
| | | if zyltgb >= zylt_threshold[1]: |
| | | return False, True, f"{zylt_threshold[1] // 100000000}亿以上的都不买({zyltgb})" |
| | | if zyltgb_as_yi >= zylt_threshold_as_yi[1]: |
| | | return False, True, f"{zylt_threshold_as_yi[1]}亿以上的都不买({zyltgb_as_yi})" |
| | | |
| | | if zyltgb < zylt_threshold[0]: |
| | | return False, True, f"{zylt_threshold[0] // 100000000}亿以下的都不买({zyltgb})" |
| | | if zyltgb_as_yi < zylt_threshold_as_yi[0]: |
| | | return False, True, f"{zylt_threshold_as_yi[0]}亿以下的都不买({zyltgb_as_yi})" |
| | | |
| | | # 最优市值 |
| | | is_best_zylt = True if zylt_threshold_as_yi[4] <= zyltgb_as_yi <= zylt_threshold_as_yi[5] else False |
| | | |
| | | if is_special: |
| | | # 具有辨识度,算作最优市值 |
| | | zyltgb = zylt_threshold[2] + 1 |
| | | zyltgb_as_yi = zylt_threshold_as_yi[2] + 1 |
| | | |
| | | # 是否是最优自由流通市值 |
| | | is_best_zylt = True if zylt_threshold[2] <= zyltgb <= zylt_threshold[3] else False |
| | | is_better_zylt = True if zylt_threshold_as_yi[2] <= zyltgb_as_yi <= zylt_threshold_as_yi[3] else False |
| | | |
| | | if is_in_strong_time_30 and is_best_zylt and can_buy_result[0]: |
| | | # 强势30分钟,最优市值, 有可以下单的板块,不看量 |
| | | return True, False, can_buy_result[2] |
| | | |
| | | if HighIncreaseCodeManager().is_in(code): |
| | | if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < 0.8: |
| | |
| | | if not is_best_zylt: |
| | | # 如果没有辨识度才不买 |
| | | if not is_special: |
| | | return False, True, f"强势10分钟,无辨识度, 独苗({can_buy_result[4]})不下单({can_buy_result[4]})自由流通市值({zyltgb})不是最优" |
| | | return False, True, f"强势10分钟,无辨识度, 独苗({can_buy_result[4]})不下单({can_buy_result[4]})自由流通市值({zyltgb_as_yi})不是特优市值" |
| | | if k_format and (k_format[1][0] or k_format[3][0]): |
| | | msg_list.append("股价创新高或者逼近前高") |
| | | # 股价创新高或者逼近前高 |
| | |
| | | return False, True, f"强势10分钟,无辨识度,独苗({can_buy_result[4]}),当日量比({cls.volume_rate_info[code][0]})小于{volume_rate_thresholds[0]}" |
| | | else: |
| | | msg_list.append("非独苗") |
| | | if not is_best_zylt: |
| | | if not is_better_zylt: |
| | | msg_list.append("不满足自由流通") |
| | | if k_format and (k_format[1][0] or k_format[3][0]): |
| | | # 股价创新高或者逼近前高 |
| | |
| | | # 非强势10分钟只买主线 |
| | | if not can_buy_result[0] and can_buy_result[1]: |
| | | if not is_special and not is_best_zylt: |
| | | return False, True, f"非强势10分钟,无辨识度,非最优自由流通市值,独苗({can_buy_result[4]})不下单" |
| | | return False, True, f"非强势10分钟,无辨识度,非特优市值,独苗({can_buy_result[4]})不下单" |
| | | if can_buy_result[3]: |
| | | # 强势主线 |
| | | if not is_best_zylt: |
| | | if not is_better_zylt: |
| | | 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[0]}" |
| | | else: |
| | | # 非强势主线 |
| | | if not is_best_zylt: |
| | | if not is_better_zylt: |
| | | if code in cls.volume_rate_info and cls.volume_rate_info[code][0] < volume_rate_thresholds[ |
| | | 1] and not is_special: |
| | | return False, True, f"非强势10分钟,非强势主线后排【主线后排】,不满足自由市值,无辨识度, 当日量比({cls.volume_rate_info[code][0]})小于{volume_rate_thresholds[1]}" |
| | |
| | | # return True, False, f"【{block}】具有辨识度", is_strong_block |
| | | # 看自由流通市值是否小于20亿 |
| | | if is_strong_block and current_shsz_rank < len(current_open_limit_up_codes) + max_rank + 1: |
| | | zyltgb = global_util.zyltgb_map.get(code) |
| | | zyltgb_as_yi = round(global_util.zyltgb_map.get(code) / 100000000, 2) if code in global_util.zyltgb_map else None |
| | | situation = MarketSituationManager().get_situation_cache() |
| | | zylt_threshold = buy_condition_util.get_zyltgb_threshold(situation) |
| | | if zyltgb and zylt_threshold[2] <= zyltgb <= zylt_threshold[3]: |
| | | return True, False, f"【{block}】强势板块 自由流通市值({zyltgb})大于{zylt_threshold[2]//100000000}亿 小于{zylt_threshold[3]//100000000}亿", is_strong_block |
| | | zylt_threshold_as_yi = buy_condition_util.get_zyltgb_threshold(situation) |
| | | if zyltgb_as_yi and zylt_threshold_as_yi[2] <= zyltgb_as_yi <= zylt_threshold_as_yi[3]: |
| | | return True, False, f"【{block}】强势板块 自由流通市值({zyltgb_as_yi})大于{zylt_threshold_as_yi[2]}亿 小于{zylt_threshold_as_yi[3]}亿", is_strong_block |
| | | return False, False, f"【{block}】前排代码:{front_current_shsz_rank_codes} 超过{len(current_open_limit_up_codes) + max_rank}个", is_strong_block |
| | | |
| | | # 过时的代码 |
| | |
| | | |
| | | |
| | | # 获取自由流通市值的阈值范围 |
| | | # (最小流通,最大流通,优秀开始,优秀结束,最优开始,最优结束) |
| | | def get_zyltgb_threshold(market_sitation: int): |
| | | if market_sitation == MarketSituationManager.SITUATION_GOOD: |
| | | return 8.9 * 100000000, 100 * 100000000, 8.9 * 100000000, 50 * 100000000 |
| | | return 8.9 * 100000000, 31 * 100000000, 8.9 * 100000000, 25 * 100000000 |
| | | return 8.9, 100, 8.9, 50, 8.9, 19 |
| | | return 8.9, 31, 8.9, 25, 8.9, 19 |
| | | |
| | | |
| | | # 获取量比的等级获取量 |
| | | def get_volume_rate_by_level(level: int): |
| | | volume_rates = [0, 0.19, 0.49, 0.89] |
| | | return volume_rates[level] |
| | | |