| | |
| | | from code_attribute.gpcode_manager import WantBuyCodesManager |
| | | from log_module.log import logger_first_code_record, logger_l2_codes_subscript |
| | | from third_data.code_plate_key_manager import CodesHisReasonAndBlocksManager |
| | | from third_data.history_k_data_util import HistoryKDatasUtils |
| | | 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.trade_manager import MarketSituationManager |
| | | from settings.trade_setting import MarketSituationManager |
| | | from utils import global_util, tool, init_data_util, buy_condition_util |
| | | |
| | | __CodesPlateKeysManager = CodesHisReasonAndBlocksManager() |
| | | |
| | | |
| | | def __is_normal_in_5d(code): |
| | | """ |
| | | 最近5天是否处于正常状态 |
| | | @param code: |
| | | @return: |
| | | """ |
| | | now_day = tool.get_now_date_str() |
| | | results = JueJinApi.get_history_instruments(JueJinApi.get_juejin_code_list_with_prefix([code]), |
| | | tool.date_sub(now_day, 30), tool.date_sub(now_day, 1)) |
| | | results = results[-5:] |
| | | normal = True |
| | | for r in results: |
| | | if r["sec_level"] != 1: |
| | | normal = False |
| | | break |
| | | return normal |
| | | |
| | | |
| | | def process_first_codes_datas(dataList, request_id=None): |
| | |
| | | continue |
| | | try: |
| | | 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( |
| | | 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])) |
| | | logger_first_code_record.info("{} 获取到首板60天最大量:{}", code, volumes) |
| | | code_volumn_manager.set_histry_volumn(code, volumes[0], volumes[1], volumes[2], volumes[3]) |
| | | |
| | | # 保存K线形态 |
| | | k_format = code_nature_analyse.get_k_format(limit_up_price, volumes_data) |
| | | k_format = code_nature_analyse.get_k_format(code, limit_up_price, volumes_data) |
| | | code_nature_analyse.CodeNatureRecordManager().save_k_format(code, k_format) |
| | | |
| | | # 是否具有辨识度 |
| | |
| | | l2_trade_util.forbidden_trade(code, |
| | | f"无辨识度,涨停价({limit_up_price})>50") |
| | | continue |
| | | if code_nature_analyse.is_price_too_high_in_days(volumes_data, limit_up_price)[0]: |
| | | 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 |
| | | pass |
| | | |
| | | if code_nature_analyse.is_continue_limit_up_not_enough_fall_dwon(volumes_data): |
| | | if code_nature_analyse.is_continue_limit_up_not_enough_fall_dwon(code, volumes_data): |
| | | # 判断是否太高 |
| | | l2_trade_util.forbidden_trade(code, "回踩不够") |
| | | continue |
| | | |
| | | if code_nature_analyse.is_up_too_high_in_10d_with_limit_up(volumes_data): |
| | | if not __is_normal_in_5d(code): |
| | | l2_trade_util.forbidden_trade(code, "最近5天有ST/非正常状态") |
| | | continue |
| | | |
| | | if code_nature_analyse.is_up_too_high_in_10d_with_limit_up(code, volumes_data): |
| | | # 判断是否太高 |
| | | HighIncreaseCodeManager().add_code(code) |
| | | |
| | | if code_nature_analyse.is_up_too_high_in_120d(volumes_data): |
| | | if code_nature_analyse.is_up_too_high_in_120d(code, volumes_data): |
| | | # 判断是否太高 |
| | | # l2_trade_util.forbidden_trade(code, "120天内股价长得太高") |
| | | # HighIncreaseCodeManager().add_code(code) |
| | | pass |
| | | |
| | | if code_nature_analyse.is_have_latest_max_volume(volumes_data, 2): |
| | | if code_nature_analyse.is_have_latest_max_volume(code, volumes_data, 2): |
| | | # 最近2天是否是最高量 |
| | | code_nature_analyse.LatestMaxVolumeManager().set_has_latest_max_volume(code) |
| | | |