| | |
| | | from code_attribute.code_nature_analyse import HighIncreaseCodeManager |
| | | from code_attribute.gpcode_manager import WantBuyCodesManager |
| | | from log_module import async_log_util |
| | | from log_module.log import logger_first_code_record, logger_l2_codes_subscript |
| | | from log_module.log import logger_first_code_record, logger_l2_codes_subscript, logger_debug |
| | | from third_data import history_k_data_manager |
| | | from third_data.code_plate_key_manager import CodesHisReasonAndBlocksManager |
| | | from third_data.history_k_data_manager import HistoryKDataManager |
| | | from third_data.history_k_data_util import HistoryKDatasUtils, JueJinApi |
| | | from ths import l2_code_operate |
| | | from trade import trade_data_manager, l2_trade_util |
| | | from trade import l2_trade_util |
| | | from settings.trade_setting import MarketSituationManager |
| | | from trade.buy_radical import new_block_processor |
| | | from trade.buy_radical.block_special_codes_manager import BlockSpecialCodesManager |
| | | from utils import global_util, tool, init_data_util, buy_condition_util |
| | | |
| | | __CodesPlateKeysManager = CodesHisReasonAndBlocksManager() |
| | |
| | | |
| | | |
| | | def process_first_codes_datas(dataList, request_id=None): |
| | | logger_l2_codes_subscript.info(f"{request_id}加载l2代码相关数据") |
| | | async_log_util.info(logger_l2_codes_subscript, f"{request_id}加载l2代码相关数据") |
| | | # 获取最近5天的交易日期,为后面的数据计算做准备 |
| | | dates = HistoryKDatasUtils.get_latest_trading_date_cache(5) |
| | | latest_trading_date = None |
| | |
| | | async_log_util.info(logger_l2_codes_subscript, f"{request_id}从网络加载K线数据:{code}") |
| | | if not volumes_data: |
| | | continue |
| | | volumes = init_data_util.parse_max_volume(code, volumes_data[:90], |
| | | code_nature_analyse.is_new_top(code, |
| | | limit_up_price, |
| | | volumes_data[ |
| | | :90]) or code_nature_analyse.is_near_top( |
| | | code, |
| | | limit_up_price, |
| | | volumes_data[:90])) |
| | | volumes = init_data_util.parse_max_volume_new(code, volumes_data[:60]) |
| | | max_volume_in_5_days = init_data_util.parse_max_volume_in_days(volumes_data, 5) |
| | | |
| | | async_log_util.info(logger_first_code_record, f"{code} 获取到首板60天最大量:{volumes}") |
| | | code_volumn_manager.set_histry_volumn(code, volumes[0], volumes[1], volumes[2], volumes[3]) |
| | | code_volumn_manager.CodeVolumeManager().set_histry_volumn(code, volumes[0], volumes[1], volumes[2], |
| | | volumes[3], max_volume_in_5_days) |
| | | |
| | | # 保存K线形态 |
| | | k_format = code_nature_analyse.get_k_format(code, limit_up_price, volumes_data) |
| | | code_nature_analyse.CodeNatureRecordManager().save_k_format(code, k_format) |
| | | |
| | | # 是否具有辨识度 |
| | | is_special = True if k_format and k_format[8][0] else False |
| | | if not WantBuyCodesManager().is_in_cache(code): |
| | | if not is_special: |
| | | situation = MarketSituationManager().get_situation_cache() |
| | | zylt_threshold_as_yi = buy_condition_util.get_zyltgb_threshold(situation) |
| | | if global_util.zyltgb_map.get(code) and global_util.zyltgb_map.get(code) > zylt_threshold_as_yi[ |
| | | 1] * 100000000: |
| | | l2_trade_util.forbidden_trade(code, |
| | | f"无辨识度,自由流通市值({global_util.zyltgb_map.get(code) // 100000000})>{zylt_threshold_as_yi[1]}亿") |
| | | if not WantBuyCodesManager().is_in_cache( |
| | | code) and not gpcode_manager.BuyOpenLimitUpCodeManager().is_in_cache(code): |
| | | # 新题材破前高就不需要加黑 |
| | | # 新题材该拉黑还是拉黑 |
| | | need_forbidden = True #new_block_processor.is_can_forbidden(code) |
| | | if need_forbidden: |
| | | if code_nature_analyse.is_price_too_high_in_days(code, volumes_data, limit_up_price)[0]: |
| | | # 判断是否太高 |
| | | l2_trade_util.forbidden_trade(code, "6天内股价长得太高") |
| | | continue |
| | | elif limit_up_price and float(limit_up_price) >= 50: |
| | | l2_trade_util.forbidden_trade(code, |
| | | f"无辨识度,涨停价({limit_up_price})>50") |
| | | |
| | | if tool.is_ge_code(code) and float(limit_up_price) < 10: |
| | | l2_trade_util.forbidden_trade(code, "创业板股价10块内") |
| | | continue |
| | | if code_nature_analyse.is_price_too_high_in_days(code, volumes_data, limit_up_price)[ |
| | | 0] and code.find("30") != 0: |
| | | # 判断是否太高 |
| | | l2_trade_util.forbidden_trade(code, "6天内股价长得太高") |
| | | continue |
| | | pass |
| | | |
| | | if code_nature_analyse.is_continue_limit_up_not_enough_fall_dwon(code, volumes_data): |
| | | # 判断是否太高 |
| | | l2_trade_util.forbidden_trade(code, "回踩不够") |
| | | continue |
| | | if len(k_format) > 14 and k_format[14]: |
| | | l2_trade_util.forbidden_trade(code, "上个交易日涨停/炸板") |
| | | continue |
| | | |
| | | if not __is_normal_in_5d(code): |
| | | l2_trade_util.forbidden_trade(code, "最近5天有ST/非正常状态") |
| | | continue |
| | | if len(k_format) > 15 and k_format[15]: |
| | | l2_trade_util.forbidden_trade(code, "上个交易日跌停") |
| | | continue |
| | | |
| | | if len(k_format) > 12 and k_format[12]: |
| | | l2_trade_util.forbidden_trade(code, "上个交易日振幅过大") |
| | | continue |
| | | |
| | | # if code_nature_analyse.is_continue_limit_up_not_enough_fall_dwon(code, volumes_data): |
| | | # # 判断是否太高 |
| | | # l2_trade_util.forbidden_trade(code, "回踩不够") |
| | | # continue |
| | | try: |
| | | if not __is_normal_in_5d(code): |
| | | l2_trade_util.forbidden_trade(code, "最近5天有ST/非正常状态") |
| | | continue |
| | | except Exception as e: |
| | | logger_debug.error(f"{code}出错__is_normal_in_5d") |
| | | logger_debug.exception(e) |
| | | |
| | | if code_nature_analyse.is_up_too_high_in_10d_with_limit_up(code, volumes_data): |
| | | # 判断是否太高 |
| | |
| | | # 纠正数据 |
| | | if is_limit_up and limit_up_time is None: |
| | | limit_up_time = tool.get_now_time_str() |
| | | if is_limit_up: |
| | | # 加入首板涨停 |
| | | gpcode_manager.FirstCodeManager().add_limited_up_record([code]) |
| | | pricePre = gpcode_manager.CodePrePriceManager.get_price_pre_cache(code) |
| | | if pricePre is None: |
| | | history_k_data_manager.re_set_price_pres([code]) |