| | |
| | | from code_attribute import code_nature_analyse |
| | | from db.redis_manager_delegate import RedisUtils |
| | | from third_data import kpl_block_util, kpl_api, kpl_util |
| | | from utils import global_util, tool |
| | | from trade.trade_manager import MarketSituationManager |
| | | from utils import global_util, tool, buy_condition_util |
| | | from log_module import log, async_log_util |
| | | from db import redis_manager_delegate as redis_manager |
| | | |
| | |
| | | |
| | | # 返回内容(是否可买, 是否为独苗, 描述信息) |
| | | @classmethod |
| | | def __is_block_can_buy(cls, code, block, current_limit_up_datas, code_limit_up_reason_dict, |
| | | def __is_block_can_buy(cls, code, block, current_limit_up_datas, code_limit_up_reasons_dict, |
| | | yesterday_current_limit_up_codes, limit_up_record_datas, current_limit_up_block_codes_dict, |
| | | high_level_code_blocks=None, high_level_block_codes=None): |
| | | # 独苗判断 |
| | |
| | | # ---------------------------判断强势主线------------------------- |
| | | is_strong_block = False |
| | | for d in current_limit_up_datas: |
| | | if d[5] != block: |
| | | bs = kpl_util.get_current_limit_up_reasons(d) |
| | | if block not in bs: |
| | | general_blocks = high_level_code_blocks.get(d[0]) |
| | | if not general_blocks or block not in general_blocks: |
| | | # 没在泛化板块中 |
| | |
| | | # 获取主板实时身位,剔除高位板 |
| | | current_shsz_rank, front_current_shsz_rank_codes = kpl_block_util.get_code_current_rank(code, block, |
| | | current_limit_up_datas, |
| | | code_limit_up_reason_dict, |
| | | code_limit_up_reasons_dict, |
| | | yesterday_current_limit_up_codes, |
| | | exclude_first_codes, |
| | | len( |
| | |
| | | # 看自由流通市值是否小于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) |
| | | if zyltgb and zyltgb < 20 * 100000000: |
| | | return True, False, f"【{block}】强势板块 自由流通市值({zyltgb})小于20亿", is_strong_block |
| | | situation = MarketSituationManager().get_situation_cache() |
| | | zylt_threshold = buy_condition_util.get_zyltgb_threshold(situation) |
| | | if zyltgb and zylt_threshold[1] <= zyltgb <= zylt_threshold[2]: |
| | | return True, False, f"【{block}】强势板块 自由流通市值({zyltgb})大于{zylt_threshold[1]//100000000}亿 小于{zylt_threshold[2]//100000000}亿", is_strong_block |
| | | return False, False, f"【{block}】前排代码:{front_current_shsz_rank_codes} 超过{len(current_open_limit_up_codes) + max_rank}个", is_strong_block |
| | | |
| | | # 过时的代码 |
| | |
| | | if limit_up_record_datas: |
| | | for d in limit_up_record_datas: |
| | | if d[2] in constant.KPL_INVALID_BLOCKS and d[3] in before_blocks_dict: |
| | | code_limit_up_reason_dict[d[3]] = list(before_blocks_dict.get(d[3]))[0] |
| | | code_limit_up_reasons_dict[d[3]] = {list(before_blocks_dict.get(d[3]))[0]} |
| | | else: |
| | | code_limit_up_reason_dict[d[3]] = d[2] |
| | | return code_limit_up_reason_dict |
| | | code_limit_up_reasons_dict[d[3]] = {d[2]} |
| | | if d[6]: |
| | | code_limit_up_reasons_dict[d[3]] |= set(d[6].split("、")) |
| | | return code_limit_up_reasons_dict |
| | | |
| | | if current_limit_up_datas is None: |
| | | current_limit_up_datas = [] |
| | |
| | | fresults = [] |
| | | if not keys: |
| | | return fresults, set() |
| | | code_limit_up_reason_dict = {} |
| | | code_limit_up_reasons_dict = {} |
| | | load_code_block() |
| | | for block in keys: |
| | | can_buy, unique, msg, is_strong = cls.__is_block_can_buy(code, block, current_limit_up_datas, |
| | | code_limit_up_reason_dict, |
| | | code_limit_up_reasons_dict, |
| | | yesterday_current_limit_up_codes, |
| | | limit_up_record_datas, |
| | | current_limit_up_block_codes_dict, |