test pct_max
This commit is contained in:
@@ -267,7 +267,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
# if count < 3:
|
# if count < 3:
|
||||||
# allow_to_buy = False
|
# allow_to_buy = False
|
||||||
|
|
||||||
if not self.should_enter_trade(pair):
|
if not self.should_enter_trade(pair, last_candle):
|
||||||
allow_to_buy = False
|
allow_to_buy = False
|
||||||
|
|
||||||
if allow_to_buy:
|
if allow_to_buy:
|
||||||
@@ -488,11 +488,9 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
buys = ''
|
buys = ''
|
||||||
|
|
||||||
max_touch = '' # round(last_candle['max12_1d'], 1) #round(self.pairs[pair]['max_touch'], 1)
|
max_touch = '' # round(last_candle['max12_1d'], 1) #round(self.pairs[pair]['max_touch'], 1)
|
||||||
pct_max = round((last_candle['close'] - self.pairs[pair]['first_buy']) / self.pairs[pair]['first_buy'],
|
pct_max = round((last_candle['close'] - self.pairs[pair]['first_buy']) / self.pairs[pair]['first_buy'], 3)
|
||||||
3) # round(100 * self.pairs[pair]['current_profit'], 1)
|
|
||||||
|
|
||||||
total_counts = str(buys) + '/' + str(sum(pair_data['count_of_buys'] for pair_data in
|
total_counts = str(buys) + '/' + str(sum(pair_data['count_of_buys'] for pair_data in self.pairs.values()))
|
||||||
self.pairs.values())) # if not pair in ('BTC/USDT', 'BTC/USDC'))
|
|
||||||
|
|
||||||
# if trade_type is not None:
|
# if trade_type is not None:
|
||||||
# if np.isnan(last_candle['rsi_1d']):
|
# if np.isnan(last_candle['rsi_1d']):
|
||||||
@@ -654,6 +652,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
# self.calculeDerivees(informative, 'rsi')
|
# self.calculeDerivees(informative, 'rsi')
|
||||||
#
|
#
|
||||||
informative['sma5'] = talib.SMA(informative, timeperiod=5)
|
informative['sma5'] = talib.SMA(informative, timeperiod=5)
|
||||||
|
informative['sma14'] = talib.SMA(informative, timeperiod=14)
|
||||||
|
|
||||||
self.calculeDerivees(informative, 'sma5', factor_1=10, factor_2=1)
|
self.calculeDerivees(informative, 'sma5', factor_1=10, factor_2=1)
|
||||||
|
|
||||||
@@ -982,8 +981,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
|
|
||||||
pct_first = 0
|
pct_first = 0
|
||||||
|
|
||||||
total_counts = sum(
|
total_counts = sum(pair_data['count_of_buys'] for pair_data in self.pairs.values() if not pair in ('BTC/USDT', 'BTC/USDC'))
|
||||||
pair_data['count_of_buys'] for pair_data in self.pairs.values() if not pair in ('BTC/USDT', 'BTC/USDC'))
|
|
||||||
|
|
||||||
if self.pairs[pair]['first_buy']:
|
if self.pairs[pair]['first_buy']:
|
||||||
pct_first = round((last_candle['close'] - self.pairs[pair]['first_buy']) / self.pairs[pair]['first_buy'], 3)
|
pct_first = round((last_candle['close'] - self.pairs[pair]['first_buy']) / self.pairs[pair]['first_buy'], 3)
|
||||||
@@ -1011,7 +1009,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
print("skip dataframe")
|
print("skip dataframe")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if not self.should_enter_trade(pair):
|
if not self.should_enter_trade(pair, last_candle):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# if self.dp.runmode.value in ('dry_run'):
|
# if self.dp.runmode.value in ('dry_run'):
|
||||||
@@ -1128,21 +1126,23 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
# or ((before_last_candle['mid_re_smooth_3_deriv1'] <= 0) & (last_candle['mid_re_smooth_3_deriv1'] >= 0) & (3 <= count_of_buys < 6)) \
|
# or ((before_last_candle['mid_re_smooth_3_deriv1'] <= 0) & (last_candle['mid_re_smooth_3_deriv1'] >= 0) & (3 <= count_of_buys < 6)) \
|
||||||
# or ((before_last_candle['mid_smooth_1h_deriv1'] <= 0) & (last_candle['mid_smooth_1h_deriv1'] >= 0) & (6 <= count_of_buys))
|
# or ((before_last_candle['mid_smooth_1h_deriv1'] <= 0) & (last_candle['mid_smooth_1h_deriv1'] >= 0) & (6 <= count_of_buys))
|
||||||
|
|
||||||
limit_buy = 20
|
limit_buy = 40
|
||||||
if (count_of_buys < limit_buy) and condition and (
|
if (count_of_buys < limit_buy) and condition and (
|
||||||
pct_max < lim): # and val > self.buy_val_adjust.value and last_candle['mid_smooth_deriv1_1d'] > - 1):
|
pct_max < lim): # and val > self.buy_val_adjust.value and last_candle['mid_smooth_deriv1_1d'] > - 1):
|
||||||
try:
|
try:
|
||||||
|
if 6 <= count_of_buys and last_candle['sma24_deriv1_1h'] < 0:
|
||||||
|
return None
|
||||||
# print(f"{trade.pair} current_profit={current_profit} count_of_buys={count_of_buys} pct_first={pct_first:.3f} pct_max={pct_max:.3f} lim={lim:.3f} index={index}")
|
# print(f"{trade.pair} current_profit={current_profit} count_of_buys={count_of_buys} pct_first={pct_first:.3f} pct_max={pct_max:.3f} lim={lim:.3f} index={index}")
|
||||||
# self.pairs[trade.pair]['last_palier_index'] = index
|
# self.pairs[trade.pair]['last_palier_index'] = index
|
||||||
|
|
||||||
# Appel de la fonction
|
# Appel de la fonction
|
||||||
poly_func, x_future, y_future, count = self.polynomial_forecast(
|
# poly_func, x_future, y_future, count = self.polynomial_forecast(
|
||||||
dataframe['mid_smooth_12'],
|
# dataframe['mid_smooth_12'],
|
||||||
window=self.buy_horizon_predict_1h.value * 12,
|
# window=self.buy_horizon_predict_1h.value * 12,
|
||||||
degree=4)
|
# degree=4)
|
||||||
|
#
|
||||||
if count < 3:
|
# if count < 3:
|
||||||
return None
|
# return None
|
||||||
|
|
||||||
max_amount = self.config.get('stake_amount') * 2.5
|
max_amount = self.config.get('stake_amount') * 2.5
|
||||||
# stake_amount = min(stake_amount, self.wallets.get_available_stake_amount())
|
# stake_amount = min(stake_amount, self.wallets.get_available_stake_amount())
|
||||||
@@ -1170,18 +1170,13 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
self.pairs[trade.pair]['max_touch'] = last_candle['close']
|
self.pairs[trade.pair]['max_touch'] = last_candle['close']
|
||||||
self.pairs[trade.pair]['last_candle'] = last_candle
|
self.pairs[trade.pair]['last_candle'] = last_candle
|
||||||
|
|
||||||
# for pair, values in self.pairs.items():
|
# df = pd.DataFrame.from_dict(self.pairs, orient='index')
|
||||||
# print(f"\n{pair}")
|
# colonnes_a_exclure = ['last_candle', 'last_trade', 'last_palier_index', 'stop',
|
||||||
# for key, value in values.items():
|
# 'trade_info', 'last_date', 'expected_profit', 'last_count_of_buys', 'base_stake_amount', 'stop_buy']
|
||||||
# print(f" {key:20}: {value}")
|
# 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']
|
||||||
df = pd.DataFrame.from_dict(self.pairs, orient='index')
|
#
|
||||||
colonnes_a_exclure = ['last_candle', 'last_trade', 'last_palier_index', 'stop',
|
# print(df_filtered)
|
||||||
'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)
|
|
||||||
|
|
||||||
return stake_amount
|
return stake_amount
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
@@ -1790,7 +1785,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
print("Moyenne des valeurs par double-tranche :")
|
print("Moyenne des valeurs par double-tranche :")
|
||||||
print(pivot_mean.round(2))
|
print(pivot_mean.round(2))
|
||||||
|
|
||||||
def should_enter_trade(self, pair: str) -> bool:
|
def should_enter_trade(self, pair: str, last_candle) -> bool:
|
||||||
|
|
||||||
limit = 3
|
limit = 3
|
||||||
|
|
||||||
@@ -1810,17 +1805,9 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
|||||||
max_pair = p
|
max_pair = p
|
||||||
total_non_btc += self.pairs[p]['count_of_buys']
|
total_non_btc += self.pairs[p]['count_of_buys']
|
||||||
|
|
||||||
this_pair_count = self.pairs[p]['count_of_buys']
|
pct_max = round((last_candle['close'] - self.pairs[pair]['first_buy']) / self.pairs[pair]['first_buy'], 3)
|
||||||
|
|
||||||
# if total_non_btc >= 12:
|
|
||||||
# # print("total_non_btc > 10")
|
|
||||||
# return False
|
|
||||||
|
|
||||||
if max_pair != '':
|
if max_pair != '':
|
||||||
# if this_pair_count >= limit:
|
return max_pair == pair or pct_max < - 0.25
|
||||||
# Si une autre paire non-BTC a aussi >3 trades, blocage
|
|
||||||
# if max_pair == pair:
|
|
||||||
# print(f"{pair} Cette paire {max_pair} est la seule avec >=3 / {max_nb_trades}")
|
|
||||||
return max_pair == pair
|
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user