From 899d8485335023865f2b1055b72fe64124082961 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期日, 26 五月 2024 23:27:51 +0800 Subject: [PATCH] 分离LSH撤 --- cancel_strategy/s_l_h_cancel_strategy.py | 36 +++++++++++++++++++----------------- 1 files changed, 19 insertions(+), 17 deletions(-) diff --git a/cancel_strategy/s_l_h_cancel_strategy.py b/cancel_strategy/s_l_h_cancel_strategy.py index 1e36c64..578063a 100644 --- a/cancel_strategy/s_l_h_cancel_strategy.py +++ b/cancel_strategy/s_l_h_cancel_strategy.py @@ -38,31 +38,33 @@ can_buy_result = CodePlateKeyBuyManager.can_buy(code) if can_buy_result and can_buy_result[0]: if can_buy_result[0][1] <= 1 and can_buy_result[0][2] >= 3: - half_must_buy = True + # 鐐告澘鐜�>60%浠ヤ笂灏变笉鍔犲崐绾� + if can_buy_result[0][3]<=0 or can_buy_result[0][2]/can_buy_result[0][3]>0.4: + half_must_buy = True except: pass if cancel_type == cls.TYPE_S_FAST: if must_buy: - return constant.S_FAST_RATE_WITH_MUST_BUY + return constant.S_FAST_RATE_WITH_MUST_BUY, "鍔犵孩" elif half_must_buy: - return round((constant.S_FAST_RATE + constant.S_FAST_RATE_WITH_MUST_BUY) / 2, 2) + return round((constant.S_FAST_RATE + constant.S_FAST_RATE_WITH_MUST_BUY) / 2, 2),"鍗婄孩" else: - return constant.S_FAST_RATE + return constant.S_FAST_RATE,"甯歌" elif cancel_type == cls.TYPE_S_FAST_BIG: if must_buy: - return constant.S_FAST_BIG_RATE_WITH_MUST_BUY + return constant.S_FAST_BIG_RATE_WITH_MUST_BUY, "鍔犵孩" elif half_must_buy: - return round((constant.S_FAST_RATE + constant.S_FAST_BIG_RATE_WITH_MUST_BUY) / 2, 2) + return round((constant.S_FAST_RATE + constant.S_FAST_BIG_RATE_WITH_MUST_BUY) / 2, 2),"鍗婄孩" else: - return constant.S_FAST_RATE + return constant.S_FAST_RATE,"甯歌" elif cancel_type == cls.TYPE_S_SLOW: if must_buy: - return constant.S_SLOW_RATE_WITH_MUST_BUY + return constant.S_SLOW_RATE_WITH_MUST_BUY, "鍔犵孩" elif half_must_buy: - return round((constant.S_SLOW_RATE + constant.S_SLOW_RATE_WITH_MUST_BUY) / 2, 2) + return round((constant.S_SLOW_RATE + constant.S_SLOW_RATE_WITH_MUST_BUY) / 2, 2),"鍗婄孩" else: - return constant.S_SLOW_RATE - return None + return constant.S_SLOW_RATE,"甯歌" + return None,"" class SCancelBigNumComputer: @@ -290,9 +292,9 @@ total_datas[real_place_order_info[0]]['val']['orderNo'], min_sell_money=min_sell_money) sell_order_num = sum([x[1] for x in sell_orders]) // 100 rate = round(sell_order_num / total_num, 2) - threshold_rate = SCancelRateManager.get_threshhold_rate(code, SCancelRateManager.TYPE_S_SLOW) + threshold_rate,threshold_rate_msg = SCancelRateManager.get_threshhold_rate(code, SCancelRateManager.TYPE_S_SLOW) if rate > threshold_rate: - return True, f"鎱㈢牳鎴愪氦姣斾緥:{rate}/0.49 鎴愪氦锛歿sell_order_num}/{total_num}" + return True, f"鎱㈢牳鎴愪氦姣斾緥:{rate}/0.49({threshold_rate_msg}) 鎴愪氦锛歿sell_order_num}/{total_num}" else: return False, f"灏氭湭瑙﹀彂鎾ゅ崟姣斾緥:{rate}" @@ -378,11 +380,11 @@ if total_num == 0: total_num = 1 - threshold_rate = SCancelRateManager.get_threshhold_rate(code, SCancelRateManager.TYPE_S_FAST_BIG) + threshold_rate,threshold_rate_msg = SCancelRateManager.get_threshhold_rate(code, SCancelRateManager.TYPE_S_FAST_BIG) if total_deal_money / (total_num * limit_up_price * 100) >= threshold_rate: # 澶у崟鎴愪氦棰濆崰鎬诲墿浣欐�诲泭鎷殑30% - return True, f"1s鍐呭ぇ浜巤threshold_big_deal}澶у崠鍗曪紙{total_deal_money}锛�" + return True, f"1s鍐呭ぇ浜巤threshold_big_deal}({threshold_rate_msg})澶у崠鍗曪紙{total_deal_money}锛�" else: return True, f"1s鍐呭ぇ浜巤threshold_big_deal}澶у崠鍗曪紙{total_deal_money}锛�" except Exception as e: @@ -439,10 +441,10 @@ # 闃叉鍒嗘瘝涓�0 total_fast_money = 1 rate = round(total_deal_money / total_fast_money, 2) - threshold_rate = SCancelRateManager.get_threshhold_rate(code, SCancelRateManager.TYPE_S_FAST) + threshold_rate,threshold_rate_msg = SCancelRateManager.get_threshhold_rate(code, SCancelRateManager.TYPE_S_FAST) if total_deal_money >= threash_money_w * 10000 and rate >= threshold_rate: - return True, f"杩�1s鏈夊ぇ鍗栧崟({round(total_deal_money / 10000, 1)}涓�/{threash_money_w}涓囷紝鎴愪氦鍗犳瘮锛歿total_deal_money}/{total_fast_money})" + return True, f"杩�1s鏈夊ぇ鍗栧崟({round(total_deal_money / 10000, 1)}涓�/{threash_money_w}涓�({threshold_rate_msg})锛屾垚浜ゅ崰姣旓細{total_deal_money}/{total_fast_money})" else: l2_log.s_cancel_debug(code, f"S蹇挙娌¤揪鍒版挙鍗曟瘮渚嬶細鎴愪氦閲戦({total_deal_money})/鍥婃嫭閲戦({total_fast_money}),姣斾緥锛歿rate} 澶у崟闃堝�硷細{threash_money_w}w") -- Gitblit v1.8.0