修改数据结构

This commit is contained in:
Porter
2025-09-22 10:16:06 +08:00
parent e84108cb80
commit 275e644f5a
2 changed files with 7 additions and 5 deletions
+5 -4
View File
@@ -32,10 +32,11 @@ class ChanLun():
time8h = 480
time12h = 720
time1d = 1440
timeframes = [time1, time3, time5, time15]
timeframes = [time1, time3, time5, time15, time30, time60]
tf_df_dict = {}
def init_data(self, dataframe, ticker_indicator):
for timeframe in self.timeframes:
klu_list, klc_list, bi_list = self.get_list_by_time(dataframe, ticker_indicator, timeframe)
self.tf_df_dict[timeframe] = TF_DF(timeframe, dataframe, ticker_indicator)
def calculate_bsp(self, dataframe, ticker_indicator):
return dataframe
@@ -54,14 +55,14 @@ class ChanLun():
if klc.high > klc.pre.high and klc.high > klc.next.high:
if klc.pre.pre and klc.high > klc.pre.pre.high and klc.next.next and klc.high > klc.next.next.high:
if klc.pre.pre.pre and klc.high > klc.pre.pre.pre.high and klc.next.next.next and klc.high > klc.next.next.next.high:
if klc.macd > 0 and klc.macd > klc.signal and klc.signal > klc.macdhist:
if klc.signal > 0 and klc.macd > klc.signal:
klc.set_fx(Chan_FX_TYPE.TOP)
#print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time,klc.fx, "TOP")
return Chan_FX_TYPE.TOP
elif klc.low < klc.pre.low and klc.low < klc.next.low:
if klc.pre.pre and klc.low < klc.pre.pre.low and klc.next.next and klc.low < klc.next.next.low:
if klc.pre.pre.pre and klc.low < klc.pre.pre.pre.low and klc.next.next.next and klc.low < klc.next.next.next.low:
if klc.macd < 0 and klc.macd < klc.signal and klc.signal < klc.macdhist:
if klc.signal < 0 and klc.macd < klc.signal:
klc.set_fx(Chan_FX_TYPE.BOTTOM)
#print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time,klc.fx, "BOTTOM")
return Chan_FX_TYPE.BOTTOM
+2 -1
View File
@@ -37,7 +37,8 @@ class TF_DF():
self.bi_list = self.cal_bi_list(self.klc_list)
self.seg_list = self.cal_seg_list(self.bi_list)
self.zs_list = self.cal_zs_list(self.bi_list, self.seg_list)
return True
self.chanmacd = ChanMACD(self.klu_list)
self.klu_list = self.chanmacd.cal_macd_state()
def check_fx(self, klc):
if klc.pre and klc.next:
if klc.high > klc.pre.high and klc.high > klc.next.high: