From ab662be5c523b75c1bd28fc6bfcab2872b9623b3 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 12 六月 2025 15:22:06 +0800 Subject: [PATCH] bug修复 --- strategy/strategy_script_v6.py | 34 +++++++++++++++++++++++++--------- 1 files changed, 25 insertions(+), 9 deletions(-) diff --git "a/strategy/\344\275\216\345\220\270\350\204\232\346\234\254_\350\276\250\350\257\206\345\272\246_v6.py" b/strategy/strategy_script_v6.py similarity index 81% rename from "strategy/\344\275\216\345\220\270\350\204\232\346\234\254_\350\276\250\350\257\206\345\272\246_v6.py" rename to strategy/strategy_script_v6.py index 6ef315a..8f481a6 100644 --- "a/strategy/\344\275\216\345\220\270\350\204\232\346\234\254_\350\276\250\350\257\206\345\272\246_v6.py" +++ b/strategy/strategy_script_v6.py @@ -85,7 +85,7 @@ if rate >= settings.avaiable_rates[1] or rate < settings.avaiable_rates[0]: return False, f"娑ㄥ箙涓嶅湪鍖洪棿鍐咃紙{settings.avaiable_rates[0]}-{settings.avaiable_rates[1]}锛�:{rate}" - if sv.鑷敱娴侀�氬競鍊� > settings.zyltgb_range[1] or sv.鑷敱娴侀�氬競鍊� < settings.zyltgb_range[0]: + if sv.鑷敱娴侀�氬競鍊� > settings.zyltgb_range[1] * 1e8 or sv.鑷敱娴侀�氬競鍊� < settings.zyltgb_range[0] * 1e8: return False, f"鑷敱甯傚�硷紙{sv.鑷敱娴侀�氬競鍊紏锛変笉婊¤冻瑕佹眰" if sv.鍏釜浜ゆ槗鏃ユ定骞呰繃楂�: @@ -111,11 +111,12 @@ # 鐩爣绁ㄦ澘鍧楁定鍋滀釜鏁�>=2 - if sv.鏉垮潡鎴愪氦浠g爜: - can_buy_plates -= set(sv.鏉垮潡鎴愪氦浠g爜.keys()) + # 鏉垮潡鍙兘涔板叆涓�涓唬鐮� + # if sv.鏉垮潡鎴愪氦浠g爜: + # can_buy_plates -= set(sv.鏉垮潡鎴愪氦浠g爜.keys()) if not can_buy_plates: - return False, "娌℃湁娑ㄥ仠鐨勬澘鍧�" + return False, f"娌℃湁娑ㄥ仠鐨勬澘鍧�: {[(plate, sv.寮�鐩樺暒鏈�姝f澘鍧楁定鍋�.get(plate)) for plate in sv.浠g爜鏉垮潡 if sv.寮�鐩樺暒鏈�姝f澘鍧楁定鍋淽} 杩炵画鑰侀鏉愶細{sv.杩炵画鑰侀鏉恾" # new_plates = set(can_buy_plates) - sv.鏃ュ嚭鐜扮殑鏉垮潡_2 # if new_plates: # # 鏈夋柊棰樻潗锛屽垽鏂槸鍚﹁繃鏄ㄦ棩鍓嶉珮 @@ -137,7 +138,7 @@ if sv.浠婃棩澶у崟鏁版嵁: # print(sv.浠婃棩澶у崟鏁版嵁[-1][3], format_time(sv.浠婃棩澶у崟鏁版嵁[-1][3])) # filter_orders = [(o[0], o[2]) for o in sv.浠婃棩澶у崟鏁版嵁 if format_time(o[3]) >= sv.浠婃棩閲忓淇℃伅[0]] - filter_orders = [(o[0], o[2]) for o in sv.浠婃棩澶у崟鏁版嵁] + filter_orders = [(o[0], o[2]) for o in sv.浠婃棩澶у崟鏁版嵁 if o[2] >= 200e4] filter_orders.reverse() orderids = set() for o in filter_orders: @@ -145,19 +146,34 @@ continue orderids.add(o[0]) big_order_money += o[1] + big_sell_order_money = 0 + if sv.浠婃棩鍗栧ぇ鍗曟暟鎹�: + filter_orders = [(o[0], o[2]) for o in sv.浠婃棩鍗栧ぇ鍗曟暟鎹� if o[2] >= 200e4] + filter_orders.reverse() + orderids = set() + for o in filter_orders: + if o[0] in orderids: + continue + orderids.add(o[0]) + big_sell_order_money += o[1] + threshold_money = max(sv.鑷敱娴侀�氬競鍊� // 1000, 200e4) limit_up_codes_count = max([(p, len(sv.寮�鐩樺暒鏈�姝f澘鍧楁定鍋�.get(p, []))) for p in can_buy_plates], key=lambda x: x[1])[1] - threshold_money *= max(min(10 - limit_up_codes_count + 1, 10), 5) / 10 + # threshold_money *= max(min(10 - limit_up_codes_count + 1, 10), 5) / 10 + threshold_money *= 0.5 # print(target_code, sv.鑷敱娴侀�氬競鍊�, threshold_money, limit_up_codes_count) # threshold_money = 200e4 # int(sv.鏄ㄦ棩鎴愪氦閲� * 0.2 * sv.浠婃棩娑ㄥ仠浠� * 0.05) - if big_order_money < threshold_money: - return False, f"({big_order_money}/{threshold_money})澶у崟閲戦涓嶈冻" - return True, f" \n\t澶у崟淇℃伅锛歿big_order_money}/{threshold_money}\n\t閲忓淇℃伅锛歿sv.浠婃棩閲忓淇℃伅}\n\t浠婃棩鏈�楂樹环:{sv.浠婃棩鏈�楂樹环淇℃伅} \n\t5鏃ユ渶楂樹环锛歿sv.鏃ユ渶楂樹环_5}", f"\n\t鏉垮潡淇℃伅锛歿[(p, sv.寮�鐩樺暒鏈�姝f澘鍧楁定鍋�.get(p)) for p in can_buy_plates]}", can_buy_plates + final_big_order_money = big_order_money - big_sell_order_money + + if final_big_order_money < threshold_money: + return False, f"({round(final_big_order_money / 1e4, 2)}涓�/{round(threshold_money / 1e4, 2)}涓�)澶у崟閲戦涓嶈冻" + + return True, f" \n\t澶у崟淇℃伅锛歿round(final_big_order_money / 1e4, 2)}涓囷紙涔帮細{round(big_order_money / 1e4, 2)}涓� 鍗栵細{round(big_sell_order_money / 1e4, 2)}涓囷級/{round(threshold_money / 1e4, 2)}涓� \n\t閲忓淇℃伅锛歿sv.浠婃棩閲忓淇℃伅}\n\t浠婃棩鏈�楂樹环:{sv.浠婃棩鏈�楂樹环淇℃伅} \n\t5鏃ユ渶楂樹环锛歿sv.鏃ユ渶楂樹环_5}", f"\n\t鏉垮潡淇℃伅锛歿[(p, sv.寮�鐩樺暒鏈�姝f澘鍧楁定鍋�.get(p)) for p in can_buy_plates]}", can_buy_plates compute_result = can_buy() -- Gitblit v1.8.0