Add classifier to the code
This commit is contained in:
+11
-11
@@ -21,10 +21,10 @@ logger = logging.getLogger(__name__)
|
||||
### Now you can use logger.info('asfd') to log
|
||||
# freqtrade plot-dataframe --strategy ChanLun_SOL_5 --datadir user_data/data/binance -c ./user_data/ChanLun_SOL.json --timerange=20250309-
|
||||
|
||||
# freqtrade trade -c ./user_data/ChanLun_SOL.json --strategy ChanLun_SOL_5 --strategy-path ./user_data/strategies
|
||||
# freqtrade backtesting -c ./user_data/ChanLun_SOL.json --strategy ChanLun_SOL_5 --strategy-path ./user_data/strategies --timerange=20250416-
|
||||
# freqtrade download-data -c ./user_data/ChanLun_SOL.json -t 1m --pairs SOL/USDT:USDT --timerange=20250405-
|
||||
# freqtrade hyperopt --hyperopt-loss SharpeHyperOptLossDaily --spaces roi stoploss --strategy ChanLun_SOL_5 --strategy-path ./user_data/strategies -c ./user_data/ChanLun_SOL.json -e 200 --timerange=20250201-20250401
|
||||
# freqtrade trade -c ./user_data/Chan/config/ChanLun_SOL.json --strategy ChanLun_SOL_5 --strategy-path ./user_data/Chan/strategies
|
||||
# freqtrade backtesting -c ./user_data/Chan/config/ChanLun_SOL.json --strategy ChanLun_SOL_5 --strategy-path ./user_data/Chan/strategies --timerange=20250416-
|
||||
# freqtrade download-data -c ./user_data/Chan/config/ChanLun_SOL.json -t 1m --pairs SOL/USDT:USDT --timerange=20250405-
|
||||
# freqtrade hyperopt --hyperopt-loss SharpeHyperOptLossDaily --spaces roi stoploss --strategy ChanLun_SOL_5 --strategy-path ./user _data/Chan/strategies -c ./user_data/Chan/config/ChanLun_SOL.json -e 200 --timerange=20250201-20250401
|
||||
|
||||
# sudo docker compose run --rm chan_btc backtesting -c ./user_data/ChanLun_SOL.json --strategy ChanLun_SOL --strategy-path ./user_data/strategies --timerange=20250101-
|
||||
# sudo docker compose run --rm chan_btc download-data -c ./user_data/ChanLun_SOL.json --pairs SOL/USDT:USDT -t 1m --timerange 20240101-
|
||||
@@ -118,9 +118,9 @@ class ChanLun_SOL_5(IStrategy):
|
||||
self.classifier.train_model(dataframe_1d, model_name="1d_model")
|
||||
"""
|
||||
|
||||
"""
|
||||
|
||||
if self.classifier.model is None:
|
||||
self.classifier.train_model(dataframe_30, model_name="30m_model")
|
||||
#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)
|
||||
top_avg = 0
|
||||
@@ -129,12 +129,12 @@ class ChanLun_SOL_5(IStrategy):
|
||||
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.01 and klc.fx == Chan_FX_TYPE.BOTTOM:
|
||||
if self.classifier.predict(klc) > 0.45 and klc.fx == Chan_FX_TYPE.BOTTOM:
|
||||
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'])
|
||||
bottom_avg += self.classifier.predict(klc)
|
||||
bottom_count += 1
|
||||
if self.classifier.predict(klc) > 0.05 and klc.fx == Chan_FX_TYPE.TOP:
|
||||
if self.classifier.predict(klc) > 0.44 and klc.fx == Chan_FX_TYPE.TOP:
|
||||
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'])
|
||||
top_avg += self.classifier.predict(klc)
|
||||
@@ -143,7 +143,7 @@ class ChanLun_SOL_5(IStrategy):
|
||||
top_avg /= top_count
|
||||
print(bottom_avg, top_avg)
|
||||
print("-------------------------------------------------------------------------------")
|
||||
"""
|
||||
|
||||
"""
|
||||
self.print_xgb(dataframe, "1m_model")
|
||||
self.print_xgb(dataframe_5, "5m_model")
|
||||
@@ -163,11 +163,11 @@ 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)
|
||||
self.chan.get_bi_list(dataframe_30)
|
||||
#self.chan.get_bi_list(dataframe_30)
|
||||
if self.last_time + timedelta(minutes=1) < datetime.now():
|
||||
#print(informative.iloc[-1])
|
||||
#self.log_macd_div_list(dataframe)
|
||||
|
||||
Reference in New Issue
Block a user