| | |
| | | # 获取委托中的代码 |
| | | current_delegates = huaxin_trade_record_manager.DelegateRecordManager().list_current_delegates() |
| | | fdatas = [] |
| | | for c in current_delegates: |
| | | if int(c["direction"]) != huaxin_util.TORA_TSTP_D_Buy: |
| | | continue |
| | | code = c["securityID"] |
| | | code_name = gpcode_manager.get_code_name(code) |
| | | # 获取下单位置信息 |
| | | order_begin_pos = TradePointManager().get_buy_compute_start_data_cache(code) |
| | | if order_begin_pos is None or order_begin_pos.buy_single_index is None: |
| | | continue |
| | | l2_data_util.load_l2_data(code) |
| | | total_datas = l2_data_util.local_today_datas.get(code) |
| | | trade_index, is_default = transaction_progress.TradeBuyQueue().get_traded_index(code) |
| | | # 下单位置 |
| | | place_order_index = SecondCancelBigNumComputer().get_real_place_order_index_cache(code) |
| | | # 计算信号位置到真实下单位置的总买(不管是否已撤) |
| | | total_nums = 0 |
| | | for i in range(order_begin_pos.buy_single_index, place_order_index): |
| | | data = total_datas[i] |
| | | val = data["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | total_nums += val["num"] |
| | | # 计算已成交/已撤单的数量 |
| | | deal_or_cancel_num = 0 |
| | | for i in range(order_begin_pos.buy_single_index, trade_index + 1): |
| | | data = total_datas[i] |
| | | val = data["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | deal_or_cancel_num += val["num"] |
| | | # 获取剩下的笔数 |
| | | total_left_count = 0 |
| | | total_left_num = 0 |
| | | for i in range(trade_index + 1, place_order_index): |
| | | data = total_datas[i] |
| | | val = data["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | if val["num"] * float(val["price"]) < 5000: |
| | | continue |
| | | left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(code, |
| | | i, |
| | | total_datas, |
| | | l2_data_util.local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if left_count > 0: |
| | | total_left_count += left_count |
| | | total_left_num += val["num"] * left_count |
| | | # 获取正在成交 |
| | | dealing_info = HuaXinTransactionDataManager.get_dealing_order_info(code) |
| | | if dealing_info: |
| | | if str(total_datas[trade_index]["val"]["orderNo"]) == str(dealing_info[0]): |
| | | total_left_num += (total_datas[trade_index]["val"]["num"] - dealing_info[1] // 100) |
| | | limit_up_price = gpcode_manager.get_limit_up_price(code) |
| | | buy1_money = Buy1PriceManager().get_latest_buy1_money(code) |
| | | if buy1_money is None: |
| | | buy1_money = 0 |
| | | # 获取已经成交的大单数量 |
| | | total_big_num = 0 |
| | | total_big_count = 0 |
| | | if current_delegates: |
| | | for c in current_delegates: |
| | | try: |
| | | if int(c["direction"]) != huaxin_util.TORA_TSTP_D_Buy: |
| | | continue |
| | | code = c["securityID"] |
| | | code_name = gpcode_manager.get_code_name(code) |
| | | # 获取下单位置信息 |
| | | order_begin_pos = TradePointManager().get_buy_compute_start_data_cache(code) |
| | | if order_begin_pos is None or order_begin_pos.buy_single_index is None: |
| | | continue |
| | | l2_data_util.load_l2_data(code) |
| | | total_datas = l2_data_util.local_today_datas.get(code) |
| | | trade_index, is_default = transaction_progress.TradeBuyQueue().get_traded_index(code) |
| | | # 下单位置 |
| | | place_order_index = SecondCancelBigNumComputer().get_real_place_order_index_cache(code) |
| | | # 计算信号位置到真实下单位置的总买(不管是否已撤) |
| | | total_nums = 0 |
| | | for i in range(order_begin_pos.buy_single_index, place_order_index): |
| | | data = total_datas[i] |
| | | val = data["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | total_nums += val["num"] |
| | | # 计算已成交/已撤单的数量 |
| | | deal_or_cancel_num = 0 |
| | | for i in range(order_begin_pos.buy_single_index, trade_index + 1): |
| | | data = total_datas[i] |
| | | val = data["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | deal_or_cancel_num += val["num"] |
| | | # 获取剩下的笔数 |
| | | total_left_count = 0 |
| | | total_left_num = 0 |
| | | for i in range(trade_index + 1, place_order_index): |
| | | data = total_datas[i] |
| | | val = data["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | if val["num"] * float(val["price"]) < 5000: |
| | | continue |
| | | left_count = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_no_canceled_count_v2(code, |
| | | i, |
| | | total_datas, |
| | | l2_data_util.local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if left_count > 0: |
| | | total_left_count += left_count |
| | | total_left_num += val["num"] * left_count |
| | | # 获取正在成交 |
| | | dealing_info = HuaXinTransactionDataManager.get_dealing_order_info(code) |
| | | if dealing_info: |
| | | if str(total_datas[trade_index]["val"]["orderNo"]) == str(dealing_info[0]): |
| | | total_left_num += (total_datas[trade_index]["val"]["num"] - dealing_info[1] // 100) |
| | | limit_up_price = gpcode_manager.get_limit_up_price(code) |
| | | buy1_money = Buy1PriceManager().get_latest_buy1_money(code) |
| | | if buy1_money is None: |
| | | buy1_money = 0 |
| | | # 获取已经成交的大单数量 |
| | | total_big_num = 0 |
| | | total_big_count = 0 |
| | | |
| | | for i in range(0, trade_index): |
| | | val = total_datas[i]["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | # 是不是大单 |
| | | if not l2_data_util.is_big_money(val): |
| | | continue |
| | | for i in range(0, trade_index): |
| | | val = total_datas[i]["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | # 是不是大单 |
| | | if not l2_data_util.is_big_money(val): |
| | | continue |
| | | |
| | | canceled_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2(code, |
| | | i, |
| | | total_datas, |
| | | l2_data_util.local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if not canceled_data: |
| | | total_big_count += 1 |
| | | else: |
| | | total_big_num -= canceled_data["val"]["num"] |
| | | total_big_num += val["num"] |
| | | canceled_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2(code, |
| | | i, |
| | | total_datas, |
| | | l2_data_util.local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if not canceled_data: |
| | | total_big_count += 1 |
| | | else: |
| | | total_big_num -= canceled_data["val"]["num"] |
| | | total_big_num += val["num"] |
| | | |
| | | not_deal_total_big_num = 0 |
| | | not_deal_total_big_count = 0 |
| | | for i in range(trade_index, total_datas[-1]["index"] + 1): |
| | | val = total_datas[i]["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | # 是不是大单 |
| | | if not l2_data_util.is_big_money(val): |
| | | continue |
| | | not_deal_total_big_num = 0 |
| | | not_deal_total_big_count = 0 |
| | | for i in range(trade_index, total_datas[-1]["index"] + 1): |
| | | val = total_datas[i]["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | # 是不是大单 |
| | | if not l2_data_util.is_big_money(val): |
| | | continue |
| | | |
| | | canceled_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2(code, |
| | | i, |
| | | total_datas, |
| | | l2_data_util.local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if not canceled_data: |
| | | not_deal_total_big_count += 1 |
| | | else: |
| | | not_deal_total_big_num -= canceled_data["val"]["num"] |
| | | not_deal_total_big_num += val["num"] |
| | | canceled_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2(code, |
| | | i, |
| | | total_datas, |
| | | l2_data_util.local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if not canceled_data: |
| | | not_deal_total_big_count += 1 |
| | | else: |
| | | not_deal_total_big_num -= canceled_data["val"]["num"] |
| | | not_deal_total_big_num += val["num"] |
| | | |
| | | real_place_order_after_count = 0 |
| | | real_place_order_after_num = 0 |
| | | real_place_order_after_count = 0 |
| | | real_place_order_after_num = 0 |
| | | |
| | | # 统计真实下单位置后面未撤的金额 |
| | | for i in range(place_order_index, total_datas[-1]["index"]): |
| | | val = total_datas[i]["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | # 是不是大单 |
| | | if not l2_data_util.is_big_money(val): |
| | | continue |
| | | # 统计真实下单位置后面未撤的金额 |
| | | for i in range(place_order_index, total_datas[-1]["index"]): |
| | | val = total_datas[i]["val"] |
| | | if not L2DataUtil.is_limit_up_price_buy(val): |
| | | continue |
| | | # 是不是大单 |
| | | if not l2_data_util.is_big_money(val): |
| | | continue |
| | | |
| | | canceled_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2(code, |
| | | i, |
| | | total_datas, |
| | | l2_data_util.local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if not canceled_data: |
| | | real_place_order_after_count += 1 |
| | | real_place_order_after_num += val["num"] |
| | | canceled_data = l2_data_source_util.L2DataSourceUtils.get_limit_up_buy_canceled_data_v2(code, |
| | | i, |
| | | total_datas, |
| | | l2_data_util.local_today_canceled_buyno_map.get( |
| | | code)) |
| | | if not canceled_data: |
| | | real_place_order_after_count += 1 |
| | | real_place_order_after_num += val["num"] |
| | | |
| | | # 获取当日的量比 |
| | | volume_rate = code_volumn_manager.get_volume_rate(code) |
| | | # 获取当日的量比 |
| | | volume_rate = code_volumn_manager.get_volume_rate(code) |
| | | |
| | | # 是否需要注意 |
| | | need_pay_attention = (total_left_count <= 10 or total_left_num * float( |
| | | limit_up_price) * 100 < 1000 * 10000) and ( |
| | | real_place_order_after_count <= 10 or real_place_order_after_num * float( |
| | | limit_up_price) * 100 < 1000 * 10000) |
| | | fdata = {"code_info": (code, code_name), "total_num": total_nums, "finish_num": deal_or_cancel_num, |
| | | "buy1_money": output_util.money_desc(buy1_money), |
| | | "big_num_count": total_big_count, |
| | | "big_num_money": output_util.money_desc(total_big_num * float(limit_up_price) * 100), |
| | | "not_deal_big_num_count": not_deal_total_big_count, |
| | | "not_deal_big_num_money": output_util.money_desc( |
| | | not_deal_total_big_num * float(limit_up_price) * 100), |
| | | "left_count": total_left_count, |
| | | "volume_rate": volume_rate, |
| | | "left_money": output_util.money_desc(total_left_num * float(limit_up_price) * 100), |
| | | "pay_attention": need_pay_attention |
| | | } |
| | | fdatas.append(fdata) |
| | | # 是否需要注意 |
| | | need_pay_attention = (total_left_count <= 10 or total_left_num * float( |
| | | limit_up_price) * 100 < 1500 * 10000) and ( |
| | | real_place_order_after_count <= 10 or real_place_order_after_num * float( |
| | | limit_up_price) * 100 < 1500 * 10000) |
| | | fdata = {"code_info": (code, code_name), "total_num": total_nums, "finish_num": deal_or_cancel_num, |
| | | "buy1_money": output_util.money_desc(buy1_money), |
| | | "big_num_count": total_big_count, |
| | | "big_num_money": output_util.money_desc(total_big_num * float(limit_up_price) * 100), |
| | | "not_deal_big_num_count": not_deal_total_big_count, |
| | | "not_deal_big_num_money": output_util.money_desc( |
| | | not_deal_total_big_num * float(limit_up_price) * 100), |
| | | "left_count": total_left_count, |
| | | "volume_rate": volume_rate, |
| | | "left_money": output_util.money_desc(total_left_num * float(limit_up_price) * 100), |
| | | "pay_attention": need_pay_attention |
| | | } |
| | | fdatas.append(fdata) |
| | | except Exception as e: |
| | | logger_debug.exception(e) |
| | | |
| | | result = {"code": 0, "data": fdatas} |
| | | self.send_response(result, client_id, request_id) |
| | | elif ctype == "set_real_place_order_index": |