Administrator
2025-07-18 8f2d9ed1cb23e87c7ee0d682403fecbd5427cd1c
测试
1个文件已修改
41 ■■■■■ 已修改文件
cancel_strategy/s_l_h_cancel_strategy.py 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cancel_strategy/s_l_h_cancel_strategy.py
@@ -2099,30 +2099,37 @@
            before_watch_indexed_info, before_canceled_watch_indexes_info = rate_info[2][0], rate_info[2][1]
            canceled_indexes = set([x[0] for x in before_canceled_watch_indexes_info])
            # [累计手数,累计撤单手数]
            ts = [50, 200, 300, 10000]
            tss = []
            for i in range(len(ts) - 1):
                start_money, end_money = ts[i] * 100, ts[i + 1] * 100
                tss.append((start_money, end_money))
            watch_index_info_less_of_200 = [0, 0]
            watch_index_info_200_to_300 = [0, 0]
            watch_index_info_more_than_300 = [0, 0]
            rate_info_dict = {}
            for x in before_watch_indexed_info:
                money = limit_up_price * x[1]
                if money >= 300 * 100:
                    watch_index_info_more_than_300[0] += x[1]
                    if x[0] in canceled_indexes:
                        watch_index_info_more_than_300[1] += x[1]
                elif money >= 200 * 100:
                    watch_index_info_200_to_300[0] += x[1]
                    if x[0] in canceled_indexes:
                        watch_index_info_200_to_300[1] += x[1]
                for t in tss:
                    if t[0] <= money < t[1]:
                        if t[0] not in rate_info_dict:
                            rate_info_dict[t[0]] = [0,0]
                        rate_info_dict[t[0]][0] += x[1]
                        if x[0] in canceled_indexes:
                            rate_info_dict[t[0]][1] += x[1]
                        break
            watch_index_info = [(k,v) for k,v in rate_info_dict.items()]
            watch_index_info.sort(key= lambda x:x[0])
            watch_index_info = [x[1] for x in watch_index_info]
            watch_index_info_details = []
            for x in watch_index_info:
                if x[0] > 0:
                    watch_index_info_details.append(f"{int(round(x[1] * 100 / x[0]))}")
                else:
                    watch_index_info_less_of_200[0] += x[1]
                    if x[0] in canceled_indexes:
                        watch_index_info_less_of_200[1] += x[1]
            fresults.append((
                round(watch_index_info_less_of_200[1] * 100 / max(watch_index_info_less_of_200[0], 1)),
                round(watch_index_info_200_to_300[1] * 100 / max(watch_index_info_200_to_300[0], 1)),
                round(watch_index_info_more_than_300[1] * 100 / max(watch_index_info_more_than_300[0], 1)),
            ))
                    watch_index_info_details.append(f"--")
            fresults.append(watch_index_info_details)
        return fresults