| | |
| | | l2_trade_util.forbidden_trade(code, msg=msg) |
| | | logger_kpl_block_can_buy.info(msg) |
| | | |
| | | # 是否需要激进买 |
| | | # 是否需要积极买 |
| | | @classmethod |
| | | def __is_need_active_buy(cls, code, block, current_rank, open_limit_up_count): |
| | | """ |
| | | 板块是否需要激进买入 |
| | | 规则:根据身位判断是否需要激进买,根据时间划分 |
| | | 板块是否需要积极买入 |
| | | 规则:根据身位判断是否需要积极买,根据时间划分 |
| | | @param code: 代码 |
| | | @param block: 板块名称 |
| | | @param current_rank: 目前在板块中的身位,从0开始 |
| | |
| | | break |
| | | return False |
| | | |
| | | # 返回内容(是否可买, 是否为独苗, 描述信息, 是否为强势主线, 是否需要激进买) |
| | | # 返回内容(是否可买, 是否为独苗, 描述信息, 是否为强势主线, 是否需要积极买) |
| | | @classmethod |
| | | def __is_block_can_buy(cls, code, block, current_limit_up_datas, code_limit_up_reasons_dict, |
| | | yesterday_current_limit_up_codes, limit_up_record_datas, current_limit_up_block_codes_dict, |
| | |
| | | current_open_limit_up_codes), |
| | | shsz=True, |
| | | limit_up_time=first_limit_up_time) |
| | | # 计算是否需要激进买入 |
| | | # 计算是否需要积极买入 |
| | | is_active_buy = cls.__is_need_active_buy(code, block, current_shsz_rank, len(current_open_limit_up_codes)) |
| | | |
| | | # record_shsz_rank, record_shsz_rank_codes = kpl_block_util.get_code_record_rank(code, block, |
| | |
| | | shsz=True, |
| | | limit_up_time=first_limit_up_time) |
| | | |
| | | # 计算是否需要激进买入 |
| | | # 计算是否需要积极买入 |
| | | is_active_buy = cls.__is_need_active_buy(code, block, current_shsz_rank, len(current_open_limit_up_codes)) |
| | | |
| | | if current_shsz_rank < len(current_open_limit_up_codes) + max_rank: |
| | |
| | | |
| | | # 是否可以下单 |
| | | # 返回:可以买的板块,是否独苗,消息 |
| | | # 可买的板块, 是否独苗, 消息, 可买的强势板块, 关键词, 激进买的板块 |
| | | # 可买的板块, 是否独苗, 消息, 可买的强势板块, 关键词, 积极买的板块 |
| | | @classmethod |
| | | def can_buy(cls, code): |
| | | if constant.TEST: |
| | |
| | | # return True, "不判断板块身位" |
| | | return cls.__can_buy_compute_result_dict.get(code) |
| | | |
| | | # 返回:(可以买的板块列表, 是否是独苗, 消息简介,可买的强势主线, 激进买入板块列表) |
| | | # 返回:(可以买的板块列表, 是否是独苗, 消息简介,可买的强势主线, 积极买入板块列表) |
| | | @classmethod |
| | | def __compute_can_buy_blocks(cls, code, current_limit_up_datas, limit_up_record_datas, |
| | | yesterday_current_limit_up_codes, before_blocks_dict, |
| | |
| | | msg_list = [] |
| | | active_buy_blocks = [] |
| | | for r in blocks_compute_results: |
| | | # r的数据结构(板块,是否可以买,是否独苗,消息,是否是强势板块, 激进买入信息) |
| | | # r的数据结构(板块,是否可以买,是否独苗,消息,是否是强势板块, 积极买入信息) |
| | | if r[2]: |
| | | # 独苗 |
| | | unique_count += 1 |
| | |
| | | msg_list.append(r[3]) |
| | | if r[5]: |
| | | active_buy_blocks.append(r[0]) |
| | | msg_list.append(f"【{r[0]}】激进买入({r[5]})") |
| | | msg_list.append(f"【{r[0]}】积极买入({r[5]})") |
| | | else: |
| | | if r[3]: |
| | | msg_list.append(r[3]) |