From 1cc94691202a82c8f0cbe6586de648985f1fd58f Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 12 二月 2025 12:28:50 +0800 Subject: [PATCH] 添加监测日志 --- l2/l2_limitup_sell_data_manager.py | 41 ++++++++++++++++++++++++++--------------- 1 files changed, 26 insertions(+), 15 deletions(-) diff --git a/l2/l2_limitup_sell_data_manager.py b/l2/l2_limitup_sell_data_manager.py index d4406f9..b7ec02a 100644 --- a/l2/l2_limitup_sell_data_manager.py +++ b/l2/l2_limitup_sell_data_manager.py @@ -45,7 +45,7 @@ val = d["val"] if L2DataUtil.is_limit_up_price_sell(val): # 鍗� - order_no, price, volume = val["orderNo"], val["price"], val["num"]*100 + order_no, price, volume = val["orderNo"], val["price"], val["num"] * 100 cls.__order_no_data_map_dict[code][order_no] = (order_no, price, volume) cls.__order_no_set_dict[code].add(order_no) cls.__delegating_sell_num_dict[code] += volume @@ -80,18 +80,17 @@ """ try: limit_up_price = gpcode_manager.get_limit_up_price_as_num(code) - has_limit_up_active_buy = False order_no_set = cls.__order_no_set_dict.get(code) if order_no_set is None: order_no_set = set() + limit_up_active_buy_datas = [] for d in datas: if d[1] != limit_up_price: continue # 鏄惁鏈夋定鍋滀富鍔ㄤ拱鎴愪氦 if d[6] < d[7]: continue - has_limit_up_active_buy = True - break + limit_up_active_buy_datas.append(d) total_deal_volume = 0 if code in cls.__delegating_sell_num_dict: for d in datas: @@ -100,7 +99,9 @@ total_deal_volume += d[2] cls.__delegating_sell_num_dict[code] -= total_deal_volume - if has_limit_up_active_buy: + if len(limit_up_active_buy_datas): + async_log_util.l2_data_log.info(hx_logger_l2_sell_deal, + f"娑ㄥ仠涓诲姩涔版垚浜わ細{limit_up_active_buy_datas}") # 鎵撳嵃鏃ュ織 async_log_util.l2_data_log.info(hx_logger_l2_sell_deal, f"鏈夋定鍋滀富鍔ㄥ崠锛歿code}-{datas[-1][3]}-{cls.__delegating_sell_num_dict.get(code)}, 鎴愪氦閲�-{total_deal_volume}") @@ -127,22 +128,32 @@ if __name__ == "__main__": - code = "300479" + # 娴嬭瘯娑ㄥ仠鎬诲崠鍚冩帀鐨勬儏鍐� + code = "000887" datas = log_export.load_huaxin_l2_sell_deal(code).get(code) print(datas) + deal_datas = [] + deal_order_no = set() for i in range(len(datas)): - if tool.trade_time_sub(datas[i][0], "09:44:00") > 0: - datas = datas[:i] - break - total_volume = sum([x[1] for x in datas]) - print("娑ㄥ仠鍗栨垚浜�", total_volume) + if 102245 <= int(datas[i][0].replace(":", "")) <= 102318: + deal_datas.append(datas[i]) + total_deal_volume = sum([x[1] for x in deal_datas]) + print("娑ㄥ仠鍗栨垚浜ら噺", total_deal_volume) datas = log_export.load_huaxin_l2_sell_delegate(code).get(code) fdatas = [] for x in datas: - if int("093206") < int(x[0].replace(":", "")) < int("094254"): - fdatas.append(x) - total_delegate = sum([x[2][2] for x in fdatas]) + if int("102245") < int(x[0].replace(":", "")) < int("102318"): + if x[2][0]>=21531404: + fdatas.append(x) + total_delegate = 0 + for x in fdatas: + if x[1] == '鍗�': + total_delegate += x[2][2] + elif x[1] == '鍗栨挙': + total_delegate -= x[2][2] print(fdatas) for d in fdatas: print(d) - print("鎬诲鎵�", total_delegate, total_delegate * 20.41) + print("鎬绘垚浜�", total_deal_volume, total_deal_volume * 17.28) + print("鎬诲鎵�", total_delegate, total_delegate * 17.28) + print("濮旀墭鍓╀綑", total_delegate-total_deal_volume, (total_delegate-total_deal_volume) * 17.28) -- Gitblit v1.8.0