| | |
| | | hx_logger_l2_orderdetail, hx_logger_l2_market_data, logger_l2_g_cancel, logger_debug, \ |
| | | logger_system, logger_trade, logger_local_huaxin_l1_trade_info, logger_l2_codes_subscript, logger_l2_radical_buy |
| | | from third_data import block_info, kpl_data_manager, history_k_data_manager, huaxin_l1_data_manager |
| | | from third_data.code_plate_key_manager import KPLCodeJXBlockManager, CodePlateKeyBuyManager, RadicalBuyBlockManager |
| | | from third_data.code_plate_key_manager import KPLCodeJXBlockManager, CodePlateKeyBuyManager, RadicalBuyBlockManager, \ |
| | | TargetCodePlateKeyManager |
| | | from third_data.history_k_data_util import JueJinApi |
| | | from trade import trade_manager, l2_trade_util, \ |
| | | trade_data_manager, trade_constant |
| | |
| | | result = RadicalBuyBlockManager.is_radical_buy(code, yesterday_codes) |
| | | async_log_util.info(logger_l2_radical_buy, f"计算板块结果:{code}-{result}") |
| | | self.__radical_buy_by_blocks_result_cache[code] = (time.time() + 3, result) |
| | | RadicalBuyDealCodesManager.radical_buy_blocks_dict[code] = result[0] |
| | | else: |
| | | # 取缓存 |
| | | result = result[1] |
| | | |
| | | if result[0]: |
| | | # 如果关键词包含已成交的原因就不再下单 |
| | | # 获取已经成交代码的板块 |
| | | # ---------------获取已经成交代码的板块---------------- |
| | | deal_reasons = set() |
| | | for dc in deal_codes: |
| | | # 获取涨停原因 |
| | | limit_up_reason = kpl_data_manager.LimitUpDataConstant.get_limit_up_reason_with_history(dc) |
| | | if limit_up_reason in constant.KPL_INVALID_BLOCKS: |
| | | limit_up_reason = None |
| | | # 如果涨停原因为空就需要获取上次激进买的原因 |
| | | if limit_up_reason is None: |
| | | radical_buy_blocks = RadicalBuyDealCodesManager.radical_buy_blocks_dict.get(dc) |
| | | deal_reasons |= radical_buy_blocks |
| | | else: |
| | | deal_reasons.add(limit_up_reason) |
| | | # 成交代码的板块如果和目标代码板块有交集就不扫 |
| | | keys_, k1_, k11_, k2_, k3_, k4_ = TargetCodePlateKeyManager().get_plate_keys(code, |
| | | contains_today=False) |
| | | match_blocks = keys_ & deal_reasons |
| | | if match_blocks: |
| | | async_log_util.info(logger_l2_radical_buy, f"板块有成交:{code}-{match_blocks}") |
| | | return |
| | | |
| | | # 有可以扫的板块 |
| | | # 判断最近的主动买占了总买额的多少 |
| | | refer_sell_data = L2MarketSellManager().get_refer_sell_data(code, l2_huaxin_util.convert_time( |