| | |
| | | __last_buy_single_dict = {} |
| | | __TradeBuyQueue = transaction_progress.TradeBuyQueue() |
| | | __latest_process_order_unique_keys = {} |
| | | __latest_process_not_order_unique_keys = {} |
| | | __latest_process_not_order_unique_keys_count = {} |
| | | # 初始化 |
| | | __TradePointManager = l2_data_manager.TradePointManager() |
| | | __SecondCancelBigNumComputer = SecondCancelBigNumComputer() |
| | |
| | | return False, True, f"尚未获取到当前成交价" |
| | | if float(limit_up_price) - float(trade_price) > 0.00001: |
| | | # 计算信号起始位置到当前的手数 |
| | | buy_single_index, buy_exec_index, buy_compute_index, num, count, max_num_set, buy_volume_rate = cls.__get_order_begin_pos(code) |
| | | buy_single_index, buy_exec_index, buy_compute_index, num, count, max_num_set, buy_volume_rate = cls.__get_order_begin_pos( |
| | | code) |
| | | num_operate_map = local_today_num_operate_map.get(code) |
| | | total_num = 0 |
| | | for i in range(buy_single_index, total_data[-1]["index"] + 1): |
| | |
| | | if compute_end_index < compute_start_index: |
| | | return |
| | | |
| | | unique_key = f"{compute_start_index}-{compute_end_index}" |
| | | if cls.__latest_process_not_order_unique_keys.get(code) == unique_key: |
| | | unique_key = f"{code}-{compute_start_index}-{compute_end_index}" |
| | | if cls.__latest_process_not_order_unique_keys_count.get(unique_key) and cls.__latest_process_not_order_unique_keys_count.get(unique_key) > 2: |
| | | async_log_util.error(logger_l2_error, |
| | | f"重复处理数据:code-{code} start_index-{compute_start_index} end_index-{compute_end_index}") |
| | | return |
| | | cls.__latest_process_not_order_unique_keys[code] = unique_key |
| | | if unique_key not in cls.__latest_process_not_order_unique_keys_count: |
| | | cls.__latest_process_not_order_unique_keys_count[unique_key] = 0 |
| | | cls.__latest_process_not_order_unique_keys_count[unique_key] += 1 |
| | | |
| | | _start_time = tool.get_now_timestamp() |
| | | total_datas = local_today_datas[code] |
| | |
| | | if cls.__last_buy_single_dict.get(code) == _index: |
| | | has_single = None |
| | | _index = None |
| | | |
| | | if _index == 106: |
| | | print("进入调试") |
| | | buy_single_index = _index |
| | | if has_single: |
| | | cls.__last_buy_single_dict[code] = buy_single_index |
| | |
| | | # compute_data_count 用于计算的l2数据数量 |
| | | @classmethod |
| | | def __compute_order_begin_pos(cls, code, start_index, continue_count, end_index): |
| | | |
| | | second_930 = 9 * 3600 + 30 * 60 + 0 |
| | | # 倒数100条数据查询 |
| | | datas = local_today_datas[code] |
| | |
| | | continue |
| | | |
| | | if L2DataUtil.is_limit_up_price_buy(_val): |
| | | |
| | | # 寻找前面continue_count-1个涨停买 |
| | | # for j in range(start_index - 1, -1, -1): |
| | | # if datas[j]["val"] |
| | | if last_index is None or (datas[last_index]["val"]["time"] == datas[i]["val"]["time"]): |
| | | if start is None: |
| | | start = i |