Change app and other py
This commit is contained in:
+16
-12
@@ -8,7 +8,7 @@ import os
|
||||
sys.path.append(os.path.abspath("/Users/jack/Documents/GitHub/freqtrade/user_data/Chan"))
|
||||
from ChanLun import ChanLun
|
||||
from ChanLun_Classifier import ChanLunClassifier
|
||||
from ChanEnum import Chan_FX_TYPE
|
||||
from ChanEnum import Chan_FX_TYPE, Chan_KLC_FX
|
||||
# --------------------------------
|
||||
from technical.util import resample_to_interval, resampled_merge
|
||||
import talib.abstract as ta
|
||||
@@ -118,29 +118,33 @@ class ChanLun_SOL_5(IStrategy):
|
||||
self.classifier.train_model(dataframe_1d, model_name="1d_model")
|
||||
"""
|
||||
|
||||
|
||||
model_name = "60m_model"
|
||||
df = dataframe_60
|
||||
if self.classifier.model is None:
|
||||
#self.classifier.train_model(dataframe_30, model_name="30m_model")
|
||||
self.classifier.load_model(model_name="30m_model")
|
||||
klc_list = self.chan.get_klc_list(dataframe_30)
|
||||
#self.classifier.train_model(df, model_name=model_name)
|
||||
self.classifier.load_model(model_name=model_name)
|
||||
klc_list = self.chan.get_klc_list(df)
|
||||
bi_list = self.chan.cal_bi_list(klc_list)
|
||||
top_avg = 0
|
||||
bottom_avg = 0
|
||||
top_count = 0
|
||||
bottom_count = 0
|
||||
for index in range(int(len(klc_list) * 0.8), len(klc_list)):
|
||||
klc = klc_list[index]
|
||||
if self.classifier.predict(klc) > 0.45 and klc.fx == Chan_FX_TYPE.BOTTOM:
|
||||
if self.classifier.predict(klc) > 0.37 and (klc.klc_fx_type == Chan_KLC_FX.BOTTOM1 or klc.klc_fx_type == Chan_KLC_FX.BOTTOM2):
|
||||
features = klc.get_feature_data()
|
||||
print(klc.end_time, klc.fx, self.classifier.predict(klc), features['klc_macd'], features['klc_macd_hist'], features['klc_rsi'], features['klc_macd_signal'])
|
||||
print(klc.bi.start_time, klc.start_time, klc.fx, self.classifier.predict(klc), features['klc_macd'], features['klc_macd_hist'], features['klc_rsi'], features['klc_macd_signal'])
|
||||
bottom_avg += self.classifier.predict(klc)
|
||||
bottom_count += 1
|
||||
if self.classifier.predict(klc) > 0.44 and klc.fx == Chan_FX_TYPE.TOP:
|
||||
if self.classifier.predict(klc) > 0.42 and (klc.klc_fx_type == Chan_KLC_FX.TOP1 or klc.klc_fx_type == Chan_KLC_FX.TOP2):
|
||||
features = klc.get_feature_data()
|
||||
print(klc.end_time, klc.fx, self.classifier.predict(klc), features['klc_macd'], features['klc_macd_hist'], features['klc_rsi'], features['klc_macd_signal'])
|
||||
print(klc.bi.start_time, klc.start_time, klc.fx, self.classifier.predict(klc), features['klc_macd'], features['klc_macd_hist'], features['klc_rsi'], features['klc_macd_signal'])
|
||||
top_avg += self.classifier.predict(klc)
|
||||
top_count += 1
|
||||
bottom_avg /= bottom_count
|
||||
top_avg /= top_count
|
||||
if bottom_count > 0:
|
||||
bottom_avg /= bottom_count
|
||||
if top_count > 0:
|
||||
top_avg /= top_count
|
||||
print(bottom_avg, top_avg)
|
||||
print("-------------------------------------------------------------------------------")
|
||||
|
||||
@@ -163,7 +167,7 @@ class ChanLun_SOL_5(IStrategy):
|
||||
#dataframe_60['state'] = self.chan.cal_klu_state(dataframe_60)
|
||||
#dataframe_4h['state'] = self.chan.resample_klc_list(dataframe_4h)
|
||||
|
||||
#self.chan.plot_dual(dataframe_30, dataframe_60)
|
||||
self.chan.plot_dual(dataframe_30, dataframe_60)
|
||||
dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14)
|
||||
#self.print_macd_div_list(dataframe)
|
||||
#self.print_resample_df(dataframe, 1, 50)
|
||||
|
||||
Reference in New Issue
Block a user