| | |
| | | # 转换数据格式 |
| | | _start_index = 0 |
| | | total_datas = local_today_datas.get(code) |
| | | if code not in local_today_datas: |
| | | local_today_datas[code] = [] |
| | | if total_datas: |
| | | _start_index = total_datas[-1]["index"] + 1 |
| | | datas = l2_huaxin_util.get_format_l2_datas(code, origin_datas, |
| | |
| | | exec_data = order_info[2] |
| | | order_begin_pos = cls.__get_order_begin_pos( |
| | | code) |
| | | async_log_util.info(logger_debug, f"下单位矫正:真实下单位-{real_order_index} 订单信息-{order_info} 下单信息-{order_begin_pos}") |
| | | async_log_util.info(logger_debug, |
| | | f"下单位矫正:真实下单位-{real_order_index} 订单信息-{order_info} 下单信息-{order_begin_pos}") |
| | | if order_begin_pos and order_begin_pos.buy_exec_index == exec_data["index"]: |
| | | cls.set_real_place_order_index(code, real_order_index, order_begin_pos) |
| | | async_log_util.info(logger_real_place_order_position, |
| | |
| | | cls.__recompute_real_order_index, code, place_order_index, order_info) |
| | | except: |
| | | pass |
| | | async_log_util.info(logger_l2_process, "code:{} 获取到下单真实位置:{}", code, place_order_index) |
| | | async_log_util.info(logger_l2_process, f"code:{code} 获取到下单真实位置:{place_order_index}") |
| | | |
| | | except: |
| | | async_log_util.error(logger_l2_error, f"{code} 处理真实下单位置出错") |
| | | # 第1条数据是否为09:30:00 |
| | |
| | | price_data = global_util.cuurent_prices.get(code) |
| | | if price_data[1]: |
| | | # 当前涨停价,设置涨停时间 |
| | | async_log_util.info(logger_l2_process, "开盘涨停:{}", code) |
| | | async_log_util.info(logger_l2_process, f"开盘涨停:{code}") |
| | | # 保存涨停时间 |
| | | cls.__LimitUpTimeManager.save_limit_up_time(code, "09:30:00") |
| | | |
| | |
| | | # 未挂单,时间相差不大才能挂单 |
| | | # if tool.trade_time_sub(latest_time, "09:32:00") < 0 or l2.l2_data_util.L2DataUtil.is_same_time(now_time_str, latest_time): |
| | | cls.__process_not_order(code, start_index, end_index, capture_timestamp, is_first_code) |
| | | |
| | | async_log_util.info(logger_l2_process, "code:{} 处理数据范围: {}-{} 处理时间:{} 线程ID:{}", code, |
| | | add_datas[0]["index"], |
| | | add_datas[-1]["index"], round(t.time() * 1000) - __start_time, |
| | | l2_log.threadIds.get(code)) |
| | | l2_log.info(code, logger_l2_process, "code:{} 处理数据范围: {}-{} 处理时间:{} 线程ID:{}", code, |
| | | add_datas[0]["index"], |
| | | add_datas[-1]["index"], round(t.time() * 1000) - __start_time, |
| | | l2_log.threadIds.get(code)) |
| | | |
| | | # 处理未挂单 |
| | | @classmethod |
| | |
| | | _start_time = round(t.time() * 1000) |
| | | # S撤单计算,看秒级大单撤单 |
| | | try: |
| | | b_need_cancel, b_cancel_msg = cls.__SCancelBigNumComputer.need_cancel_for_down(code, start_index,end_index) |
| | | b_need_cancel, b_cancel_msg = cls.__SCancelBigNumComputer.need_cancel_for_down(code, start_index, |
| | | end_index) |
| | | if b_need_cancel: |
| | | async_log_util.error(logger_debug, f"{code} S后撤单:{b_cancel_msg}") |
| | | return total_data[end_index], f"S后撤({b_cancel_msg})" |
| | |
| | | if cls.__PauseBuyCodesManager.is_in_cache(code): |
| | | return False, True, f"该代码被暂停交易" |
| | | now_time_int = int(tool.get_now_time_str().replace(":", "")) |
| | | if now_time_int>= 145700: |
| | | if now_time_int >= 145700: |
| | | return False, True, f"14:57后不能交易" |
| | | if 130100>=now_time_int>= 112900: |
| | | if 130100 >= now_time_int >= 112900: |
| | | return False, True, f"11:29:00-13:01:00不能交易" |
| | | |
| | | limit_up_price = gpcode_manager.get_limit_up_price(code) |
| | |
| | | buy_nums += int(_val["num"]) * int(total_datas[i]["re"]) |
| | | buy_count += int(total_datas[i]["re"]) |
| | | if (buy_nums >= threshold_num and buy_count >= threshold_count) or buy_nums >= threshold_max_num: |
| | | async_log_util.info(logger_l2_trade_buy, |
| | | f"{code}获取到买入执行点:{i} 统计纯买手数:{buy_nums} 目标纯买手数:{threshold_num}/{threshold_max_num} 统计纯买单数:{buy_count} 目标纯买单数:{threshold_count}, 大单数量:{len(max_buy_num_set)}") |
| | | l2_log.info(code, logger_l2_trade_buy, |
| | | f"{code}获取到买入执行点:{i} 统计纯买手数:{buy_nums} 目标纯买手数:{threshold_num}/{threshold_max_num} 统计纯买单数:{buy_count} 目标纯买单数:{threshold_count}, 大单数量:{len(max_buy_num_set)}") |
| | | elif L2DataUtil.is_limit_up_price_buy_cancel(_val): |
| | | if _val["num"] >= bigger_num: |
| | | # 只统计59万以上的金额 |
| | |
| | | buy_nums += int(_val["num"]) * int(total_datas[i]["re"]) |
| | | buy_count += int(total_datas[i]["re"]) |
| | | if buy_nums >= threshold_num: |
| | | async_log_util.info(logger_l2_trade_buy, |
| | | f"{code}获取到买入执行点(快速买入):{i} 统计纯买手数:{buy_nums} 目标纯买手数:{threshold_num} 统计纯买单数:{buy_count}") |
| | | l2_log.info(code, logger_l2_trade_buy, |
| | | f"{code}获取到买入执行点(快速买入):{i} 统计纯买手数:{buy_nums} 目标纯买手数:{threshold_num} 统计纯买单数:{buy_count}") |
| | | elif L2DataUtil.is_limit_up_price_buy_cancel(_val): |
| | | # 判断买入位置是否在买入信号之前 |
| | | buy_index = l2_data_source_util.L2DataSourceUtils.get_buy_index_with_cancel_data_v2(total_datas[i], |