| | |
| | | |
| | | 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)) |
| | | |
| | | rate_info_dict = {} |
| | | for t in tss: |
| | | rate_info_dict[t[0]] = [0,0] |
| | | |
| | | # 统计大单撤单比例 |
| | | BIG_ORDER_NUM_THRESHOLD = l2_data_util.get_big_money_val( |
| | | gpcode_manager.get_limit_up_price_as_num(code), tool.is_ge_code(code)) |
| | | # 撤单的大单信息:[(大单总手数, 大单总笔数), (大单撤单手数, 大单撤单笔数), ] |
| | | canceled_info_of_big_orders = [[0,0],[0,0]] |
| | | for x in before_watch_indexed_info: |
| | | money = limit_up_price * x[1] |
| | | for t in tss: |
| | | if t[0] <= money < t[1]: |
| | | rate_info_dict[t[0]][0] += x[1] |
| | | money = limit_up_price * x[1] * 100 |
| | | if money < BIG_ORDER_NUM_THRESHOLD: |
| | | continue |
| | | canceled_info_of_big_orders[0][0] += x[1] |
| | | canceled_info_of_big_orders[0][1] += 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]))}") |
| | | canceled_info_of_big_orders[1][0] += x[1] |
| | | canceled_info_of_big_orders[1][1] += 1 |
| | | #(大单撤单比例,大单总金额,大单总笔数,大单撤单金额,大单撤单笔数) |
| | | if canceled_info_of_big_orders[0][0] > 0: |
| | | big_order_canceled_rate = int(round(canceled_info_of_big_orders[1][0]*100/canceled_info_of_big_orders[0][0])) |
| | | else: |
| | | watch_index_info_details.append(f"--") |
| | | fresults.append(watch_index_info_details) |
| | | big_order_canceled_rate = -1 |
| | | fresults.append((big_order_canceled_rate,int(canceled_info_of_big_orders[0][0]*limit_up_price*100),canceled_info_of_big_orders[0][1],int(canceled_info_of_big_orders[1][0]*limit_up_price*100), canceled_info_of_big_orders[1][1])) |
| | | return fresults |
| | | |
| | | |