修改数据结构
This commit is contained in:
+5
-4
@@ -32,10 +32,11 @@ class ChanLun():
|
|||||||
time8h = 480
|
time8h = 480
|
||||||
time12h = 720
|
time12h = 720
|
||||||
time1d = 1440
|
time1d = 1440
|
||||||
timeframes = [time1, time3, time5, time15]
|
timeframes = [time1, time3, time5, time15, time30, time60]
|
||||||
|
tf_df_dict = {}
|
||||||
def init_data(self, dataframe, ticker_indicator):
|
def init_data(self, dataframe, ticker_indicator):
|
||||||
for timeframe in self.timeframes:
|
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):
|
def calculate_bsp(self, dataframe, ticker_indicator):
|
||||||
|
|
||||||
return dataframe
|
return dataframe
|
||||||
@@ -54,14 +55,14 @@ class ChanLun():
|
|||||||
if klc.high > klc.pre.high and klc.high > klc.next.high:
|
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 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.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)
|
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")
|
#print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time,klc.fx, "TOP")
|
||||||
return Chan_FX_TYPE.TOP
|
return Chan_FX_TYPE.TOP
|
||||||
elif klc.low < klc.pre.low and klc.low < klc.next.low:
|
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 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.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)
|
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")
|
#print(klc.start_time, klc.end_time,klc.next.start_time, klc.next.end_time,klc.fx, "BOTTOM")
|
||||||
return Chan_FX_TYPE.BOTTOM
|
return Chan_FX_TYPE.BOTTOM
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ class TF_DF():
|
|||||||
self.bi_list = self.cal_bi_list(self.klc_list)
|
self.bi_list = self.cal_bi_list(self.klc_list)
|
||||||
self.seg_list = self.cal_seg_list(self.bi_list)
|
self.seg_list = self.cal_seg_list(self.bi_list)
|
||||||
self.zs_list = self.cal_zs_list(self.bi_list, self.seg_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):
|
def check_fx(self, klc):
|
||||||
if klc.pre and klc.next:
|
if klc.pre and klc.next:
|
||||||
if klc.high > klc.pre.high and klc.high > klc.next.high:
|
if klc.high > klc.pre.high and klc.high > klc.next.high:
|
||||||
|
|||||||
Reference in New Issue
Block a user