diff --git a/ChanLun.py b/ChanLun.py index a42f307..4616d14 100644 --- a/ChanLun.py +++ b/ChanLun.py @@ -91,6 +91,7 @@ class ChanLun(): klc_list = self.get_klc_list(dataframe) bi_list= self.cal_bi_list(klc_list) def get_klc_state_list(self, dataframe): + klu_list = self.get_klu_list(dataframe) klc_list = self.get_klc_list(dataframe) bi_list= self.cal_bi_list(klc_list) state_list = [] @@ -116,10 +117,23 @@ class ChanLun(): state_list.append("00") else: state_list.append("00") + klu = klu_list[index] + if klu.volume_ratio > 4.0: + if klu.close < klu.open: + state_list[-1] = "99" + print(klu.time, klu.volume_ratio, "99") + else: + state_list[-1] = "-99" + print(klu.time, klu.volume_ratio, "-99") else: for index in range(0, len(dataframe)): state_list.append("00") return state_list + def get_all_state(self, df_list): + state_list = [] + for df in df_list: + state_list.append(self.get_klc_state_list(df)) + return state_list def print_data(self, dataframe): klc_list = self.get_klc_list(dataframe) bi_list = self.cal_bi_list(klc_list) diff --git a/__pycache__/ChanBI.cpython-312.pyc b/__pycache__/ChanBI.cpython-312.pyc index b454148..9b13e87 100644 Binary files a/__pycache__/ChanBI.cpython-312.pyc and b/__pycache__/ChanBI.cpython-312.pyc differ diff --git a/__pycache__/ChanBSP.cpython-312.pyc b/__pycache__/ChanBSP.cpython-312.pyc index 177daec..cc05b4c 100644 Binary files a/__pycache__/ChanBSP.cpython-312.pyc and b/__pycache__/ChanBSP.cpython-312.pyc differ diff --git a/__pycache__/ChanCTime.cpython-312.pyc b/__pycache__/ChanCTime.cpython-312.pyc index b9efe3f..c08bfc5 100644 Binary files a/__pycache__/ChanCTime.cpython-312.pyc and b/__pycache__/ChanCTime.cpython-312.pyc differ diff --git a/__pycache__/ChanEnum.cpython-312.pyc b/__pycache__/ChanEnum.cpython-312.pyc index 0e8de31..4df116d 100644 Binary files a/__pycache__/ChanEnum.cpython-312.pyc and b/__pycache__/ChanEnum.cpython-312.pyc differ diff --git a/__pycache__/ChanKLC.cpython-312.pyc b/__pycache__/ChanKLC.cpython-312.pyc index 5ff9b25..97b3c82 100644 Binary files a/__pycache__/ChanKLC.cpython-312.pyc and b/__pycache__/ChanKLC.cpython-312.pyc differ diff --git a/__pycache__/ChanKLU.cpython-312.pyc b/__pycache__/ChanKLU.cpython-312.pyc index 07069a1..a8a3768 100644 Binary files a/__pycache__/ChanKLU.cpython-312.pyc and b/__pycache__/ChanKLU.cpython-312.pyc differ diff --git a/__pycache__/ChanLun.cpython-312.pyc b/__pycache__/ChanLun.cpython-312.pyc index 97cb6fb..f2d5fb6 100644 Binary files a/__pycache__/ChanLun.cpython-312.pyc and b/__pycache__/ChanLun.cpython-312.pyc differ diff --git a/__pycache__/ChanSBI.cpython-312.pyc b/__pycache__/ChanSBI.cpython-312.pyc index 143d523..39238c4 100644 Binary files a/__pycache__/ChanSBI.cpython-312.pyc and b/__pycache__/ChanSBI.cpython-312.pyc differ diff --git a/__pycache__/ChanSEG.cpython-312.pyc b/__pycache__/ChanSEG.cpython-312.pyc index dac2f10..309ff07 100644 Binary files a/__pycache__/ChanSEG.cpython-312.pyc and b/__pycache__/ChanSEG.cpython-312.pyc differ diff --git a/__pycache__/ChanZS.cpython-312.pyc b/__pycache__/ChanZS.cpython-312.pyc index c3d3626..db18ccb 100644 Binary files a/__pycache__/ChanZS.cpython-312.pyc and b/__pycache__/ChanZS.cpython-312.pyc differ diff --git a/strategies/ChanLun_SOL_5.py b/strategies/ChanLun_SOL_5.py index b27ebea..f65bbe1 100644 --- a/strategies/ChanLun_SOL_5.py +++ b/strategies/ChanLun_SOL_5.py @@ -61,7 +61,8 @@ class ChanLun_SOL_5(IStrategy): "3600": 0 } can_short = False - stoploss = -0.30 + lev = 5.0 + stoploss = -0.3 * lev trailing_stop = False trailing_stop_positive = 0.025 trailing_stop_positive_offset = 0.045 @@ -177,7 +178,7 @@ class ChanLun_SOL_5(IStrategy): #self.print_macd_div_list(dataframe) #self.print_resample_df(dataframe, 1, 50) #self.chan.get_bi_list(dataframe_30) - if self.last_time + timedelta(minutes=1) < datetime.now(): + if self.last_time + timedelta(minutes=1) < datetime.now() and False: #print(informative.iloc[-1]) #self.print_klc(dataframe, "1m: ") #self.print_klc(dataframe_5, "5m: ") @@ -474,7 +475,8 @@ class ChanLun_SOL_5(IStrategy): dataframe.loc[ ( #(dataframe['state'] == "-30") - (dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "-10") + (dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "-10") | + (dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)] == "99") #(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "-10") & #(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time30)] == "-10") & #(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "-10") @@ -496,7 +498,8 @@ class ChanLun_SOL_5(IStrategy): dataframe.loc[ ( #(dataframe['state']== "30") - (dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "10") + (dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)].shift(self.time5) == "10") | + (dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time5)] == "-99") #(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time30)] == "10") & #(dataframe['resample_{}_state'.format(self.get_ticker_indicator()*self.time60)] == "10") ), @@ -513,7 +516,7 @@ class ChanLun_SOL_5(IStrategy): def leverage(self, pair: str, current_time: datetime, current_rate: float, proposed_leverage: float, max_leverage: float, entry_tag: Optional[str], side: str, **kwargs) -> float: - return 1.0 + return self.lev def get_ticker_indicator(self): return int(self.timeframe[:-1]) \ No newline at end of file