From 7ca9e90febd61dbcc5357349294affe95ea04105 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期五, 30 八月 2024 00:34:33 +0800 Subject: [PATCH] 激进买入完善 --- third_data/kpl_data_constant.py | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 46 insertions(+), 3 deletions(-) diff --git a/third_data/kpl_data_constant.py b/third_data/kpl_data_constant.py index 665e086..3c15aa3 100644 --- a/third_data/kpl_data_constant.py +++ b/third_data/kpl_data_constant.py @@ -1,5 +1,48 @@ # 褰撳墠娑ㄥ仠鏁版嵁 -current_limit_up_datas = [] +import constant +from third_data import kpl_block_util -# 鐢ㄤ簬璁$畻婵�杩涗拱寮�1鐨勬澘鏁帮細{"浠g爜":(鍑犵増,鏉垮潡)} -open_limit_up_code_dict_for_radical_buy = None \ No newline at end of file +# 鐢ㄤ簬璁$畻婵�杩涗拱寮�1鐨勬澘鏁帮細{"浠g爜":(鍑犵増,{鏉垮潡})} +open_limit_up_code_dict_for_radical_buy = None + + +class LimitUpDataConstant: + """ + 褰撳墠娑ㄥ仠鏁版嵁鐨勬暟鎹� + """ + __history_code_blocks_dict = {} + __history_code_data_dict = {} + history_limit_up_datas = [] + current_limit_up_datas = [] + + @classmethod + def set_current_limit_up_datas(cls, current_limit_up_datas): + cls.current_limit_up_datas = current_limit_up_datas + + @classmethod + def set_history_limit_up_datas(cls, history_limit_up_datas_): + cls.history_limit_up_datas = history_limit_up_datas_ + for d in cls.history_limit_up_datas: + blocks = {d[2]} + # 寮�1鎵嶈兘鍖呭惈鎺ㄨ崘鍘熷洜 + if d[6] and kpl_block_util.open_limit_up_time_range[0] <= int(d[5]) < \ + kpl_block_util.open_limit_up_time_range[1]: + blocks |= set(d[6].split("銆�")) + blocks -= constant.KPL_INVALID_BLOCKS + cls.__history_code_blocks_dict[d[3]] = blocks + cls.__history_code_data_dict[d[3]] = d + + @classmethod + def get_blocks_with_history(cls, code): + """ + 鏍规嵁鍘嗗彶娑ㄥ仠鑾峰彇鏉垮潡 + @param code: + @return: + """ + return cls.__history_code_blocks_dict.get(code) + + @classmethod + def get_first_limit_up_time(cls, code): + if code in cls.__history_code_data_dict: + return int(cls.__history_code_data_dict[code][5]) + return None -- Gitblit v1.8.0