优化index的自动刷新,不占用内存了

This commit is contained in:
jackyu66git
2025-10-11 20:46:41 +08:00
parent ea24371930
commit eb6d4dae1e
5 changed files with 118 additions and 9 deletions
+10 -5
View File
@@ -60,7 +60,7 @@ class ChanKLC():
def set_klc_fx_type(self, klc_fx_type):
#print(self.start_time, klc_fx_type, self.get_feature_data()['klu_macd'], self.get_feature_data()['klu_macdhist'], self.get_feature_data()['klu_rsi'])
self.klc_fx_type = klc_fx_type
#self.cal_invisible()
#self.cal_fx()
self.cal_bb_out()
def add_klu(self, klu):
self.klus.append(klu)
@@ -76,12 +76,9 @@ class ChanKLC():
if klu.macd_state != Chan_MACD_STATE.UNKNOWN:
self.state = klu.macd_state
self.cal_indicators()
def cal_invisible(self):
def cal_fx(self):
if self.klc_fx_type == Chan_KLC_FX.TOP1 or self.klc_fx_type == Chan_KLC_FX.TOP2:
#print(self.end_time, self.fx, self.macd, self.macdhist, len(self.klus))
if self.macdhist < 0 and self.macd > 0:
self.klc_fx_type = Chan_KLC_FX.TOP5
return
if self.state == Chan_MACD_STATE.HIGH_EMPTY and self.macd > 0:
#print(self.end_time, self.state, self.macd, self.klc_fx_type)
self.klc_fx_type = Chan_KLC_FX.TOP6
@@ -191,6 +188,14 @@ class ChanKLC():
return False
def set_fx(self, fx: Chan_FX_TYPE):
self.fx = fx
def cal_invisible(self):
if self.fx == Chan_FX_TYPE.TOP:
if self.macdhist < 0 and self.macd > 0:
self.klc_fx_type = Chan_KLC_FX.TOP5
else:
if self.fx == Chan_FX_TYPE.BOTTOM:
if self.macdhist > 0 and self.macd < 0:
self.klc_fx_type = Chan_KLC_FX.BOTTOM5
def set_pre_fx(self):
if self.pre and self.pre.pre:
self.pre.fx = self.check_fx(self.pre.pre, self.pre)