cancel_strategy/s_l_h_cancel_strategy.py | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
constant.py | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
third_data/code_plate_key_manager.py | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
third_data/data_server.py | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
third_data/kpl_api.py | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
cancel_strategy/s_l_h_cancel_strategy.py
@@ -529,6 +529,7 @@ # ---------------------------------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() @@ -548,10 +549,15 @@ 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] @@ -578,11 +584,20 @@ # 设置板块涨停数量(除开自己) @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): @@ -834,6 +849,8 @@ # 取后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: @@ -1487,7 +1504,7 @@ # 更新后半段 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]: # 没有囊括 constant.py
@@ -140,6 +140,8 @@ # L上撤单比例 L_CANCEL_RATE_UP = 0.79 # L前 L_CANCEL_RATE_UP_SH = 0.69 # 上证L前 L_CANCEL_RATE_UP_WITH_MUST_BUY = 0.95 # 加红L前 # 大金额 third_data/code_plate_key_manager.py
@@ -760,7 +760,7 @@ is_strong_block = False # 最多买老几 RANKS = [5, 4, 3, 3, 3, 2, 2] RANKS = [6, 5, 4, 4, 3, 3, 2] RANK_TIMES = ["10:00:00", "10:30:00", "11:00:00", "11:30:00", "13:30:00", "14:00:00", "15:00:00"] now_time_str = tool.get_now_time_str() max_rank = 2 third_data/data_server.py
@@ -717,13 +717,15 @@ # 保存涨停时间 codes_set = set() limit_up_reasons = {} limit_up_time_dict = {} for d in result_list_: code = d[0] limit_up_reasons[code] = d[5] codes_set.add(code) limit_up_time = time.strftime("%H:%M:%S", time.localtime(d[2])) if tool.is_can_buy_code(code): limit_up_time = time.strftime("%H:%M:%S", time.localtime(d[2])) code_price_manager.Buy1PriceManager().set_limit_up_time(code, limit_up_time) limit_up_time_dict[code] = limit_up_time add_codes = codes_set - self.__latest_limit_up_codes_set self.__latest_limit_up_codes_set = codes_set @@ -735,7 +737,8 @@ if b not in limit_up_reason_code_dict: limit_up_reason_code_dict[b] = set() limit_up_reason_code_dict[b].add(code) LCancelRateManager.set_block_limit_up_count(limit_up_reason_code_dict) # 涨停时间code LCancelRateManager.set_block_limit_up_count(limit_up_reason_code_dict, limit_up_time_dict) if add_codes: for code in add_codes: third_data/kpl_api.py
@@ -258,4 +258,9 @@ if __name__ == "__main__": print(getZYLTAmount("300198")) # getCodeBlocks("300198") data = (getMarketJingXuanRealRankingInfo()) data=json.loads(data) print(len(data["list"])) # data = json.loads(getCodesByPlate("801235")) # print(data)