From 32203dcb2d06b93e4b6c81f9121b00531a91395e Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期五, 06 六月 2025 18:43:07 +0800 Subject: [PATCH] bug修复 --- strategy/strategy_params_settings.py | 75 +++++++++++++++++++++++++++++++++++++ 1 files changed, 75 insertions(+), 0 deletions(-) diff --git a/strategy/strategy_params_settings.py b/strategy/strategy_params_settings.py new file mode 100644 index 0000000..72f6498 --- /dev/null +++ b/strategy/strategy_params_settings.py @@ -0,0 +1,75 @@ +""" +绛栫暐鍙傛暟璁剧疆 +""" +import json + + +class StrategyParamsSettings: + # 绂佹涔板叆 + STATE_FORBIDDEN_BUY = 0 + # 姝e父涔板叆 + STATE_NORMAL_BUY = 1 + + def __init__(self): + # 浜ゆ槗鐘舵�� + self.trade_state = 1 + # 涔板叆閲戦 + self.buy_money = 2000 + # 浠锋牸鍖洪棿 + self.price_range = (3, 60) + # 鑰侀鏉愭定鍋滄暟 + self.limit_up_count_of_old_plate = 2 + # 鏂伴鏉愭定鍋滄暟 + self.limit_up_count_of_new_plate = 2 + # 鏄ㄦ棩涓嶈兘娑ㄥ仠 + self.cant_yesterday_limit_up = True + # 鏄ㄦ棩涓嶈兘璺屽仠 + self.cant_yesterday_limit_down = True + # 鏄ㄦ棩涓嶈兘鐐告澘 + self.cant_yesterday_open_limit_up = False + # 鏈夋定鍋滅殑浜ゆ槗鏃ユ暟閲� + self.has_limit_up_days = 10 + # xx涓氦鏄撴棩鍐呬笉鑳芥湁xx娆℃定鍋� + self.trade_days_count_of_limit_up = 5 + # 娑ㄥ仠娆℃暟 + self.count_of_limit_up = 3 + + # xx涓氦鏄撴棩鍐呬笉鑳芥湁xx娆℃定鍋� + self.trade_days_count_of_limit_down = 5 + # 璺屽仠娆℃暟 + self.count_of_limit_down = 3 + + # xx涓氦鏄撴棩鍐呬笉鑳芥湁xx娆$偢鏉� + self.trade_days_count_of_open_limit_up = 5 + # 鐐告澘娆℃暟 + self.count_of_open_limit_up = 3 + # 鏄惁鍙拱鍒涗笟鏉� + self.can_buy_ge_code = True + # 鑷敱甯傚�艰寖鍥� + self.zyltgb_range = (10e8, 300e8) + # 鏄惁鍙拱浠婃棩娑ㄥ仠杩囩殑绁� + self.can_buy_limited_up = False + # 鏈�浣庡紑鐩樻定骞� + self.min_open_rate = -0.03 + # 鍙拱鐨勬定骞呮瘮渚� + self.avaiable_rates = (-0.03, 0.07) + # 浠婃棩娑ㄥ仠浠烽渶绐佺牬XX鏃ユ渶楂樹环,None琛ㄧず姝ゆ潯鏁版嵁涓嶇敓鏁� + self.trade_days_count_of_limit_up_price_over_high = None + # 浠婃棩涔颁环涓庢渶楂樹环鐨勫樊鍊煎湪XX姣斾緥浠ュ唴 + self.min_rate_of_highest_and_price = 0.04 + # 鏈�澶氶珮浜庡潎浠穢x姣斾緥 + self.max_rate_than_average_price = 0.03 + + def to_json_str(self): + d = self.__dict__ + return json.dumps(d) + + @classmethod + def to_obj(cls, json_str): + result = json.loads(json_str) + obj = StrategyParamsSettings() + for k in result: + setattr(obj, k, result[k]) + return obj + + -- Gitblit v1.8.0