From 9a8a924d75fd4e29c4c14c86c041c00ba89f615a Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 10 四月 2024 18:07:22 +0800 Subject: [PATCH] 下单策略修改 --- l2/l2_data_manager_new.py | 34 +++++++++++++++++++++------------- 1 files changed, 21 insertions(+), 13 deletions(-) diff --git a/l2/l2_data_manager_new.py b/l2/l2_data_manager_new.py index 4e5c9f0..710d5bc 100644 --- a/l2/l2_data_manager_new.py +++ b/l2/l2_data_manager_new.py @@ -458,8 +458,9 @@ cls.__process_order(code, start_index, end_index, capture_timestamp, is_first_code) else: # 鏈寕鍗�,鏃堕棿鐩稿樊涓嶅ぇ鎵嶈兘鎸傚崟 - # 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) + 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) l2_log.info(code, logger_l2_process, "code:{} 澶勭悊鏁版嵁鑼冨洿: {}-{} 澶勭悊鏃堕棿:{} 绾跨▼ID锛歿}", code, add_datas[0]["index"], add_datas[-1]["index"], round(t.time() * 1000) - __start_time, @@ -1305,6 +1306,9 @@ # ------------------------------纭畾淇″彿绉嶇被---------------------------------- # 绗竴姝ワ細鑾峰彇婵�杩涗笅鍗曚俊鍙� continue_count = cls.__l2PlaceOrderParamsManagerDict[code].get_begin_continue_buy_count() + # if code.find('60') == 0: + # 婵�杩涗拱 + continue_count = 1 has_single, _index, sell_info = cls.__compute_active_order_begin_pos(code, continue_count, max( (compute_start_index - continue_count - 1) if new_add else compute_start_index, 0), compute_end_index) fast_msg = None @@ -1651,18 +1655,22 @@ # 鏈夊彲涔版澘鍧楋紝鏈夋縺杩涗拱鏉垮潡 # 绗竴姝ワ細 璁$畻鎬诲崠棰� threshold_money, sell_1_price = refer_sell_data[1], refer_sell_data[3][0] - for i in range(start_index - 1, -1, -1): - val = total_datas[i]["val"] - if tool.compare_time(val["time"], refer_sell_data[0]) <= 0: - break - if L2DataUtil.is_sell(val): - threshold_money += val["num"] * int(float(val["price"]) * 100) - elif L2DataUtil.is_sell_cancel(val): - threshold_money -= val["num"] * int(float(val["price"]) * 100) - elif L2DataUtil.is_buy(val): - # 鍒ゆ柇浠锋牸锛堝ぇ浜庡崠1锛� 琚拱鍚冩帀 - if round(float(val["price"]), 2) - sell_1_price >= 0: + if code.find("60") == 0: + threshold_money = 0 + else: + for i in range(start_index - 1, -1, -1): + val = total_datas[i]["val"] + if tool.compare_time(val["time"], refer_sell_data[0]) < 0: + # 灏嗘湰s鐨勮绠椾笂鍘� + break + if L2DataUtil.is_sell(val): + threshold_money += val["num"] * int(float(val["price"]) * 100) + elif L2DataUtil.is_sell_cancel(val): threshold_money -= val["num"] * int(float(val["price"]) * 100) + elif L2DataUtil.is_buy(val): + # 鍒ゆ柇浠锋牸锛堝ぇ浜庡崠1锛� 琚拱鍚冩帀 + if round(float(val["price"]), 2) - sell_1_price >= 0: + threshold_money -= val["num"] * int(float(val["price"]) * 100) # 绗簩姝ワ細璁$畻璧峰淇″彿 second_930 = 9 * 3600 + 30 * 60 + 0 total_datas = local_today_datas.get(code) -- Gitblit v1.8.0