| | |
| | | can_buy_result = RadicalBuyDataManager.is_code_can_buy(code) |
| | | if can_buy_result[0]: |
| | | # 获取激进买的板块 |
| | | result_cache = self.__radical_buy_by_blocks_result_cache.get(code) |
| | | if not result_cache or result_cache[0] < time.time(): |
| | | # 不存在/过期 |
| | | yesterday_codes = kpl_data_manager.get_yesterday_limit_up_codes() |
| | | if yesterday_codes is None: |
| | | yesterday_codes = set() |
| | | # 计算是否可以扫入 |
| | | radical_result = RadicalBuyBlockManager.is_radical_buy(code, yesterday_codes) |
| | | async_log_util.info(logger_l2_radical_buy, f"计算板块结果:{code}-{radical_result}") |
| | | result_cache = (time.time() + 3, radical_result) |
| | | self.__radical_buy_by_blocks_result_cache[code] = result_cache |
| | | RadicalBuyDealCodesManager().set_code_blocks(code, radical_result[0]) |
| | | if not radical_result[0]: |
| | | async_log_util.info(logger_l2_not_buy_reasons, f"{code}#{radical_result[1]}") |
| | | # 取缓存 |
| | | result = result_cache[1] |
| | | if result[0]: |
| | | f_buy_blocks, orgin_buy_blocks = radical_buy_strategy.compute_can_radical_buy_blocks(code, deal_codes) |
| | | if orgin_buy_blocks: |
| | | if not f_buy_blocks: |
| | | return True |
| | | # 买入的板块 |
| | | buy_blocks = result[0] |
| | | # 如果关键词包含已成交的原因就不再下单 |
| | | # 获取已经成交代码的板块 |
| | | try: |
| | | # ---------------判断板块是否还可以买入---------------- |
| | | f_buy_blocks = radical_buy_data_manager.is_block_can_radical_buy(code, buy_blocks, deal_codes) |
| | | if not f_buy_blocks: |
| | | return True |
| | | buy_blocks = f_buy_blocks |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | | |
| | | buy_blocks = f_buy_blocks |
| | | # 判断当前时间段是否可以买入 |
| | | mode = OrderBeginPosInfo.MODE_RADICAL |
| | | can_buy, money, msg = BuyMoneyUtil.get_buy_data(tool.get_now_time_str(), mode, |