diff --git a/Zeus_8_3_2_B_4_2.py b/Zeus_8_3_2_B_4_2.py index 25206ef..e04408f 100644 --- a/Zeus_8_3_2_B_4_2.py +++ b/Zeus_8_3_2_B_4_2.py @@ -254,8 +254,7 @@ class Zeus_8_3_2_B_4_2(IStrategy): # val = self.getProbaHausse144(last_candle) # allow_to_buy = True #(not self.stop_all) #& (not self.all_down) - allow_to_buy = not self.pairs[pair][ - 'stop'] # and val > self.buy_val.value #not last_candle['tendency'] in ('B-', 'B--') # (rate <= float(limit)) | (entry_tag == 'force_entry') + allow_to_buy = not self.pairs[pair]['stop'] # and val > self.buy_val.value #not last_candle['tendency'] in ('B-', 'B--') # (rate <= float(limit)) | (entry_tag == 'force_entry') # if allow_to_buy: # poly_func, x_future, y_future, count = self.polynomial_forecast( @@ -455,9 +454,16 @@ class Zeus_8_3_2_B_4_2(IStrategy): if self.columns_logged % 30 == 0: self.printLog( f"| {'Date':<16} | {'Action':<10} |{'Pair':<5}| {'Trade Type':<18} |{'Rate':>8} | {'Dispo':>6} | {'Profit':>8} | {'Pct':>6} | {'max_touch':>11} | {'last_lost':>12} | {'last_max':>7}|{'Buys':>4}| {'Stake':>5} |" - f"Tdc|{'val':>6}| sma5 |smooth |" + f"Tdc|{'val':>6}| sma5 |smooth |Distmax" ) self.printLineLog() + df = pd.DataFrame.from_dict(self.pairs, orient='index') + colonnes_a_exclure = ['last_candle', 'last_trade', 'last_palier_index', 'stop', + 'trade_info', 'last_date', 'expected_profit', 'last_count_of_buys', 'base_stake_amount', 'stop_buy'] + df_filtered = df[df['count_of_buys'] > 0].drop(columns=colonnes_a_exclure) + # df_filtered = df_filtered["first_buy", "last_max", "max_touch", "last_sell","last_buy", 'count_of_buys', 'current_profit'] + + print(df_filtered) self.columns_logged += 1 date = str(date)[:16] if date else "-" @@ -492,6 +498,8 @@ class Zeus_8_3_2_B_4_2(IStrategy): total_counts = str(buys) + '/' + str(sum(pair_data['count_of_buys'] for pair_data in self.pairs.values())) + dist_max = round(100 * (last_candle['max12_1d'] - last_candle['min12_1d']) / last_candle['min12_1d'], 0) + # if trade_type is not None: # if np.isnan(last_candle['rsi_1d']): # string = ' ' @@ -514,7 +522,7 @@ class Zeus_8_3_2_B_4_2(IStrategy): # f"|{round(last_candle['mid_smooth_24_deriv1'],3) or '-':>6}|{round(last_candle['mid_smooth_1h_deriv1'],3) or '-':>6}|{round(last_candle['mid_smooth_deriv1_1d'],3) or '-' :>6}|" # f"{round(last_candle['mid_smooth_24_deriv2'],3) or '-' :>6}|{round(last_candle['mid_smooth_1h_deriv2'],3) or '-':>6}|{round(last_candle['mid_smooth_deriv2_1d'],3) or '-':>6}|" f"{round(val, 1) or '-' :>6}|" - f"{round(last_candle['sma5_deriv1_1h'], 4) or '-' :>7}|{round(last_candle['mid_smooth_1h_deriv1'], 4) or '-' :>7}|" + f"{round(last_candle['sma5_deriv1_1h'], 4) or '-' :>7}|{round(last_candle['mid_smooth_1h_deriv1'], 4) or '-' :>7}|{dist_max:>7}" ) def printLineLog(self): @@ -523,7 +531,7 @@ class Zeus_8_3_2_B_4_2(IStrategy): f"+{'-' * 18}+{'-' * 12}+{'-' * 5}+{'-' * 20}+{'-' * 9}+{'-' * 8}+{'-' * 10}+{'-' * 8}+{'-' * 13}+{'-' * 14}+{'-' * 9}+{'-' * 4}+{'-' * 7}+" f"{'-' * 3}" # "+{'-' * 3}+{'-' * 3} - f"+{'-' * 6}+{'-' * 7}+{'-' * 7}+" + f"+{'-' * 6}+{'-' * 7}+{'-' * 7}+{'-' * 7}+" ) def printLog(self, str): @@ -595,9 +603,7 @@ class Zeus_8_3_2_B_4_2(IStrategy): (dataframe["close"] - dataframe["bb_lowerband"]) / (dataframe["bb_upperband"] - dataframe["bb_lowerband"]) ) - dataframe["bb_width"] = ( - (dataframe["bb_upperband"] - dataframe["bb_lowerband"]) / dataframe["bb_upperband"] - ) + dataframe["bb_width"] = ((dataframe["bb_upperband"] - dataframe["bb_lowerband"]) / dataframe["bb_upperband"]) # Normalization # dataframe = self.calculateRegression(dataframe, column='mid_smooth', window=24, degree=4, future_offset=12) @@ -859,10 +865,10 @@ class Zeus_8_3_2_B_4_2(IStrategy): # self.paliers = self.get_dca_stakes() - if self.dp.runmode.value in ('backtest'): - today = datetime.now().strftime("%Y-%m-%d-%H:%M:%S") - dataframe.to_feather(f"user_data/data/binance/{today}-{metadata['pair'].replace('/', '_')}_df.feather") - dataframe.to_csv(f"user_data/data/binance/{today}-{metadata['pair'].replace('/', '_')}_df.csv") + # if self.dp.runmode.value in ('backtest'): + # today = datetime.now().strftime("%Y-%m-%d-%H:%M:%S") + # dataframe.to_feather(f"user_data/data/binance/{today}-{metadata['pair'].replace('/', '_')}_df.feather") + # dataframe.to_csv(f"user_data/data/binance/{today}-{metadata['pair'].replace('/', '_')}_df.csv") # # df = dataframe #