| | |
| | | # ---------------------------------L撤------------------------------- |
| | | class LCancelRateManager: |
| | | __block_limit_up_count_dict = {} |
| | | __block_limit_up_count_for_l_up_dict = {} |
| | | __big_num_deal_rate_dict = {} |
| | | __MustBuyCodesManager = gpcode_manager.MustBuyCodesManager() |
| | | |
| | |
| | | base_rate = constant.L_CANCEL_RATE |
| | | if is_up: |
| | | base_rate = constant.L_CANCEL_RATE_UP |
| | | if tool.is_sh_code(code): |
| | | base_rate = constant.L_CANCEL_RATE_UP_SH |
| | | try: |
| | | block_rate = 0 |
| | | if code in cls.__block_limit_up_count_dict: |
| | | count = cls.__block_limit_up_count_dict[code] |
| | | count_dict = cls.__block_limit_up_count_dict |
| | | if is_up: |
| | | count_dict = cls.__block_limit_up_count_for_l_up_dict |
| | | if code in count_dict: |
| | | count = count_dict[code] |
| | | rates = [0, 0.03, 0.06, 0.08, 0.12] |
| | | if count >= len(rates): |
| | | block_rate = rates[-1] |
| | |
| | | |
| | | # 设置板块涨停数量(除开自己) |
| | | @classmethod |
| | | def set_block_limit_up_count(cls, reason_codes_dict): |
| | | def set_block_limit_up_count(cls, reason_codes_dict, limit_up_time_dict: dict): |
| | | for reason in reason_codes_dict: |
| | | codes = reason_codes_dict[reason] |
| | | for c in codes: |
| | | codes = list(codes) |
| | | # 目标票在确认的涨停原因中,在总的身位的≤50%以外,则L前的涨停影响比例因素不生效。 |
| | | codes.sort(key=lambda x: ( |
| | | int(limit_up_time_dict.get(x).replace(":", "")) if x in limit_up_time_dict else int("150000"))) |
| | | for i in range(len(codes)): |
| | | c = codes[i] |
| | | cls.__block_limit_up_count_dict[c] = len(codes) - 1 |
| | | if i < len(codes) / 2: |
| | | cls.__block_limit_up_count_for_l_up_dict[c] = len(codes) - 1 |
| | | else: |
| | | cls.__block_limit_up_count_for_l_up_dict[c] = 0 |
| | | |
| | | @classmethod |
| | | def set_big_num_deal_info(cls, code, buy_money, sell_money): |
| | |
| | | # 取后1/5的数据 |
| | | if temp_count >= 30: |
| | | temp_index = int(temp_count * 4 / 5) |
| | | if tool.is_sh_code(code): # 上证取后3/10 |
| | | temp_index = int(temp_count * 7 / 10) |
| | | re_start_index = not_cancel_indexes_with_num[temp_index][0] |
| | | MAX_COUNT = len(not_cancel_indexes_with_num[temp_index:]) |
| | | else: |
| | |
| | | # 更新后半段 |
| | | watch_indexes = self.__compute_l_down_watch_index_after_real_place_order_index(code) |
| | | if watch_indexes: |
| | | l2_log.l_cancel_debug(code,"L后后半段囊括:{}", watch_indexes) |
| | | l2_log.l_cancel_debug(code, "L后后半段囊括:{}", watch_indexes) |
| | | watch_indexes_info = self.__get_watch_indexes_cache(code) |
| | | if watch_indexes_info and watch_indexes_info[2]: |
| | | # 没有囊括 |