| | |
| | | # 最大的时间差,最大的索引差, 数据 |
| | | # 深证与执行位置相差时间>=10ms以上,上证与执行位置相差时间>=100ms以上 |
| | | data_ = temp_volumes_info_list[0][2] |
| | | MIN_SPCE_MS = 30 if tool.is_sh_code(code) else 10 |
| | | |
| | | if tool.trade_time_sub_with_ms(L2DataUtil.get_time_with_ms(data_["val"]), exec_time_with_ms) < MIN_SPCE_MS: |
| | | continue |
| | | match_list.append((max_sub_time, max_sub_index, data_)) |
| | | if not match_list: |
| | | # 没有找到真实下单位 |
| | | return None |
| | | THRESHOLD_MIN_MS = 0 if tool.is_sz_code(code) else 70 |
| | | if strict_match and tool.is_sz_code(code) and len(match_list) == 1: |
| | | # 防止下单下在本10ms |
| | | # 严格匹配,且只匹配到1个数据 |
| | | pass |
| | | else: |
| | | MIN_SPCE_MS = 30 if tool.is_sh_code(code) else 10 |
| | | new_match_list = [] |
| | | for m in match_list: |
| | | if tool.trade_time_sub_with_ms(L2DataUtil.get_time_with_ms(m[2]["val"]), |
| | | exec_time_with_ms) < MIN_SPCE_MS: |
| | | # 与执行时间相差指定时间 |
| | | continue |
| | | new_match_list.append(m) |
| | | match_list = new_match_list |
| | | |
| | | # 最合适的是时间相差为0,索引相差为1 |
| | | for m in match_list: |
| | | if m[0] == 0 and m[1] == 1: |
| | |
| | | order_info_list = order_info[0] # [(量,价格, order_ref)] |
| | | exec_data = order_info[1] |
| | | place_order_data = cls.__compute_real_place_order_position(code, exec_data, order_info_list, |
| | | total_datas[trade_index + 1:end_index], strict_match= True) |
| | | total_datas[trade_index + 1:end_index], |
| | | strict_match=True) |
| | | if not place_order_data: |
| | | return None |
| | | real_place_index_info = place_order_data["index"], RELIABILITY_TYPE_REAL |