| | |
| | | from code_attribute import code_nature_analyse, code_volumn_manager, gpcode_manager |
| | | from code_attribute.code_l1_data_manager import L1DataManager |
| | | from l2.l2_sell_manager import L2MarketSellManager |
| | | from log_module import async_log_util |
| | | from log_module.log import logger_l2_radical_buy |
| | | from third_data import kpl_data_manager |
| | | from trade.buy_money_count_setting import RadicalBuyBlockCodeCountManager |
| | | from trade.trade_data_manager import RadicalBuyDealCodesManager |
| | | |
| | | |
| | | class RedicalBuyDataManager(): |
| | |
| | | # 拉黑且不是已经买入性质的拉黑 |
| | | return False, "已拉黑" |
| | | return True, "" |
| | | |
| | | |
| | | def is_block_can_radical_buy(code, radical_buy_blocks, deal_codes): |
| | | # 原因下面的代码个数 |
| | | deal_reason_codes = {} |
| | | |
| | | for dc in deal_codes: |
| | | # 获取涨停原因 |
| | | reasons = set() |
| | | limit_up_reason = kpl_data_manager.LimitUpDataConstant.get_limit_up_reason_with_history(dc) |
| | | if limit_up_reason and limit_up_reason in constant.KPL_INVALID_BLOCKS: |
| | | limit_up_reason = None |
| | | # 如果涨停原因为空就需要获取上次激进买的原因 |
| | | if limit_up_reason: |
| | | reasons.add(limit_up_reason) |
| | | if not limit_up_reason: |
| | | radical_buy_blocks = RadicalBuyDealCodesManager.radical_buy_blocks_dict.get(dc) |
| | | if radical_buy_blocks: |
| | | reasons |= radical_buy_blocks |
| | | for r in reasons: |
| | | if r not in deal_reason_codes: |
| | | deal_reason_codes[r] = set() |
| | | deal_reason_codes[r].add(dc) |
| | | async_log_util.info(logger_l2_radical_buy, f"已经成交的板块:{code}-{deal_reason_codes.keys()}") |
| | | |
| | | f_buy_blocks = set() |
| | | for b in radical_buy_blocks: |
| | | # 获取板块的最大买入个数 |
| | | max_count = RadicalBuyBlockCodeCountManager().get_block_code_count(b) |
| | | if b in deal_reason_codes and len(deal_reason_codes[b])>=max_count: |
| | | continue |
| | | f_buy_blocks.add(b) |
| | | async_log_util.info(logger_l2_radical_buy, f"还可以买入的板块:{code}-{f_buy_blocks}") |
| | | return f_buy_blocks |