Calcul 20250101-20250714 354.190 72.772 28209.62 USDT max 9 XRP
This commit is contained in:
@@ -303,8 +303,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(
|
||||
@@ -453,9 +452,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
# return 'Can_' + pair_name + '_' + str(count_of_buys)
|
||||
|
||||
# if 1 <= count_of_buys <= 3:
|
||||
if ((before_last_candle_2['mid_smooth_3_deriv1'] <= before_last_candle['mid_smooth_3_deriv1'])
|
||||
& (before_last_candle['mid_smooth_3_deriv1'] >= last_candle['mid_smooth_3_deriv1'])) \
|
||||
and (current_profit > expected_profit):
|
||||
if last_candle['mid_smooth_1h_deriv1'] < 0 and current_profit > expected_profit:
|
||||
return 'Drv3_' + pair_name + '_' + str(count_of_buys)
|
||||
|
||||
# if 4 <= count_of_buys <= 6:
|
||||
@@ -524,13 +521,12 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
if self.columns_logged % 10 == 0:
|
||||
self.printLog(
|
||||
f"| {'Date':<16} | {'Action':<10} |{'Pair':<5}| {'Trade Type':<18} |{'Rate':>8} | {'Dispo':>6} | {'Profit':>10} | {'Pct':>6} | {'max_touch':>11} | {'last_lost':>12} | {'last_max':>7}| {'last_max':>7}|{'Buys':>5}| {'Stake':>5} |"
|
||||
f"Tdc|{'val':>6}|Distmax|s201d|s5_1d|s5_2d|s241h|s242h|smt1h|smt2h|"
|
||||
f"Tdc|{'val':>6}|Distmax|s201d|s5_1d|s5_2d|s51h|s52h|smt1h|smt2h|"
|
||||
)
|
||||
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']
|
||||
'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']
|
||||
|
||||
@@ -591,15 +587,13 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
color_sma20 = GREEN if last_candle['sma20_deriv1_1d'] > 0 else RED
|
||||
color_sma5 = GREEN if last_candle['sma5_deriv1_1d'] > 0 else RED
|
||||
color_sma5_2 = GREEN if last_candle['sma5_deriv2_1d'] > 0 else RED
|
||||
color_sma5_1h = GREEN if last_candle['sma24_deriv1_1h'] > 0 else RED
|
||||
color_sma5_2h = GREEN if last_candle['sma24_deriv2_1h'] > 0 else RED
|
||||
color_sma5_1h = GREEN if last_candle['sma5_deriv1_1h'] > 0 else RED
|
||||
color_sma5_2h = GREEN if last_candle['sma5_deriv2_1h'] > 0 else RED
|
||||
color_smooth_1h = GREEN if last_candle['mid_smooth_1h_deriv1'] > 0 else RED
|
||||
color_smooth2_1h = GREEN if last_candle['mid_smooth_1h_deriv2'] > 0 else RED
|
||||
|
||||
last_max = int(self.pairs[pair]['last_max']) if self.pairs[pair]['last_max'] > 1 else round(
|
||||
self.pairs[pair]['last_max'], 3)
|
||||
last_min = int(self.pairs[pair]['last_min']) if self.pairs[pair]['last_min'] > 1 else round(
|
||||
self.pairs[pair]['last_min'], 3)
|
||||
last_max = int(self.pairs[pair]['last_max']) if self.pairs[pair]['last_max'] > 1 else round(self.pairs[pair]['last_max'],3)
|
||||
last_min = int(self.pairs[pair]['last_min']) if self.pairs[pair]['last_min'] > 1 else round(self.pairs[pair]['last_min'], 3)
|
||||
|
||||
profit = str(round(self.pairs[pair]['current_profit'], 2)) + '/' + str(profit)
|
||||
|
||||
@@ -613,7 +607,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
f"{round(val, 1) or '-' :>6}|"
|
||||
f"{dist_max:>7}|{color_sma20}{round(last_candle['sma20_deriv1_1d'], 2):>5}{RESET}"
|
||||
f"|{color_sma5}{round(last_candle['sma5_deriv1_1d'], 2):>5}{RESET}|{color_sma5_2}{round(last_candle['sma5_deriv2_1d'], 2):>5}{RESET}"
|
||||
f"|{color_sma5_1h}{round(last_candle['sma24_deriv1_1h'], 2):>5}{RESET}|{color_sma5_2h}{round(last_candle['sma24_deriv2_1h'], 2):>5}{RESET}"
|
||||
f"|{color_sma5_1h}{round(last_candle['sma5_deriv1_1h'], 2):>5}{RESET}|{color_sma5_2h}{round(last_candle['sma5_deriv2_1h'], 2):>5}{RESET}"
|
||||
f"|{color_smooth_1h}{round(last_candle['mid_smooth_1h_deriv1'], 2):>5}{RESET}|{color_smooth2_1h}{round(last_candle['mid_smooth_1h_deriv2'], 2):>5}{RESET}"
|
||||
# f"|{last_candle['min60_1d']}|{last_candle['max60_1d']}"
|
||||
)
|
||||
@@ -746,7 +740,17 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
# print("##################")
|
||||
# self.calculateStats(informative, 'sma5_deriv1', 'futur_percent_3')
|
||||
|
||||
# self.calculePlateaux(informative, 6, 0.005)
|
||||
# self.calculePlateaux(informative, 24, 0.01)
|
||||
macd, macdsignal, macdhist = talib.MACD(
|
||||
informative['close'],
|
||||
fastperiod=12,
|
||||
slowperiod=26,
|
||||
signalperiod=9
|
||||
)
|
||||
|
||||
informative['macd'] = macd
|
||||
informative['macdsignal'] = macdsignal
|
||||
informative['macdhist'] = macdhist
|
||||
|
||||
dataframe = merge_informative_pair(dataframe, informative, self.timeframe, "1h", ffill=True)
|
||||
|
||||
@@ -775,6 +779,17 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
self.calculeDerivees(informative, 'sma5', factor_1=10, factor_2=1)
|
||||
self.calculeDerivees(informative, 'sma20', factor_1=10, factor_2=1)
|
||||
|
||||
macd, macdsignal, macdhist = talib.MACD(
|
||||
informative['close'],
|
||||
fastperiod=12,
|
||||
slowperiod=26,
|
||||
signalperiod=9
|
||||
)
|
||||
|
||||
informative['macd'] = macd
|
||||
informative['macdsignal'] = macdsignal
|
||||
informative['macdhist'] = macdhist
|
||||
|
||||
# informative['futur_percent_3'] = 100 * ((informative['sma5'].shift(-3) - informative['sma5']) / informative['sma5'])
|
||||
|
||||
# if self.dp.runmode.value in ('backtest'):
|
||||
@@ -1120,14 +1135,13 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
df[f"{indic_2}_bin"], bins_1d = pd.qcut(df[f"{indic_2}"], q=n, labels=self.labels, retbins=True,
|
||||
duplicates='drop')
|
||||
# Affichage formaté pour code Python
|
||||
# print(f"Bornes des quantiles pour {indic_1} : [{', '.join([f'{b:.4f}' for b in bins_1h])}]")
|
||||
# print(f"Bornes des quantiles pour {indic_2} : [{', '.join([f'{b:.4f}' for b in bins_1d])}]")
|
||||
print(f"Bornes des quantiles pour {indic_1} : [{', '.join([f'{b:.4f}' for b in bins_1h])}]")
|
||||
print(f"Bornes des quantiles pour {indic_2} : [{', '.join([f'{b:.4f}' for b in bins_1d])}]")
|
||||
# Agrégation
|
||||
grouped = df.groupby([f"{indic_2}_bin", f"{indic_1}_bin"], observed=True)[futur_cols].agg(['mean', 'count'])
|
||||
# Affichage
|
||||
with pd.option_context('display.max_rows', None, 'display.max_columns', None):
|
||||
print(grouped.round(4))
|
||||
|
||||
# Ajout des probabilités de hausse
|
||||
for col in futur_cols:
|
||||
df[f"{col}_is_up"] = df[col] > 0
|
||||
@@ -1358,8 +1372,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
max_amount = self.config.get('stake_amount') * 2.5
|
||||
# stake_amount = min(stake_amount, self.wallets.get_available_stake_amount())
|
||||
stake_amount = min(min(max_amount, self.wallets.get_available_stake_amount()),
|
||||
self.adjust_stake_amount(pair,
|
||||
last_candle) - 10 * pct_first / pct) # min(200, self.adjust_stake_amount(pair, last_candle) * self.fibo[count_of_buys])
|
||||
self.adjust_stake_amount(pair, last_candle) - 10 * pct_first / 0.05) # min(200, self.adjust_stake_amount(pair, last_candle) * self.fibo[count_of_buys])
|
||||
|
||||
trade_type = last_candle['enter_tag'] if last_candle['enter_long'] == 1 else 'pct48'
|
||||
self.pairs[trade.pair]['count_of_buys'] += 1
|
||||
@@ -1449,12 +1462,12 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
return round((last_candle['max60_1d'] - last_candle['min60_1d']) / last_candle['max60_1d'], 4)
|
||||
|
||||
def getPctClose60D(self, pair, last_candle):
|
||||
if last_candle['close'] > last_candle['max60_1d']:
|
||||
if last_candle['close'] > last_candle['max12_1d']:
|
||||
return 1
|
||||
if last_candle['close'] < last_candle['min60_1d']:
|
||||
if last_candle['close'] < last_candle['min12_1d']:
|
||||
return 0
|
||||
return round(
|
||||
(last_candle['close'] - last_candle['min60_1d']) / (last_candle['max60_1d'] - last_candle['min60_1d']), 4)
|
||||
(last_candle['close'] - last_candle['min12_1d']) / (last_candle['max12_1d'] - last_candle['min12_1d']), 4)
|
||||
|
||||
def getLimitBuy(self, pair, last_candle, first_pct):
|
||||
count_of_buys = self.pairs[pair]['count_of_buys']
|
||||
@@ -2106,6 +2119,18 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
|
||||
limit = 3
|
||||
|
||||
if last_candle['sma5_deriv1_1h'] < -0.1:
|
||||
return False
|
||||
|
||||
if last_candle['sma5_deriv1_1h'] < 0.0 and last_candle['sma5_deriv2_1h'] < -0.0:
|
||||
return False
|
||||
|
||||
if last_candle['mid_smooth_1h_deriv1'] < 0.0 and last_candle['mid_smooth_1h_deriv2'] < -0.0 and last_candle['sma5_deriv2_1h'] < 0:
|
||||
return False
|
||||
|
||||
if pair.startswith('BTC'):
|
||||
return True # BTC toujours autorisé
|
||||
|
||||
# Filtrer les paires non-BTC
|
||||
non_btc_pairs = [p for p in self.pairs if not p.startswith('BTC')]
|
||||
|
||||
@@ -2139,13 +2164,23 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
# if (last_candle['mid_smooth_1h_deriv1'] < -0.0 and last_candle['sma24_deriv1_1h'] < -0.0):
|
||||
# return False
|
||||
|
||||
if self.pairs[pair]['count_of_buys'] >= 3:
|
||||
if (last_candle['sma20_deriv1_1d'] < self.sma20_deriv1_1d_protection.value
|
||||
and last_candle['sma5_deriv1_1d'] < self.sma5_deriv1_1d_protection.value \
|
||||
and last_candle['sma24_deriv1_1h'] < self.sma24_deriv1_1h_protection.value):
|
||||
# or (last_candle['sma5_deriv1_1d'] < -0.1 and last_candle['sma24_deriv1_1h'] < -0.1):
|
||||
if last_candle['sma5_deriv2_1h'] < -0.2:
|
||||
return False
|
||||
|
||||
if last_candle['mid_smooth_1h_deriv1'] < -0.02: # and last_candle['mid_smooth_1h_deriv2'] > 0):
|
||||
return False
|
||||
|
||||
if self.pairs[pair]['count_of_buys'] >= 3:
|
||||
if last_candle['sma5_deriv1_1d'] < -0.065 or (last_candle['sma5_deriv1_1d'] < -0.0 and last_candle['sma5_deriv2_1d'] < -0.0):
|
||||
return False
|
||||
|
||||
# if self.pairs[pair]['count_of_buys'] >= 3:
|
||||
# if (last_candle['sma20_deriv1_1d'] < self.sma20_deriv1_1d_protection.value
|
||||
# and last_candle['sma5_deriv1_1d'] < self.sma5_deriv1_1d_protection.value \
|
||||
# and last_candle['sma24_deriv1_1h'] < self.sma24_deriv1_1h_protection.value):
|
||||
# # or (last_candle['sma5_deriv1_1d'] < -0.1 and last_candle['sma24_deriv1_1h'] < -0.1):
|
||||
# return False
|
||||
|
||||
if pair.startswith('BTC'):
|
||||
return True # BTC toujours autorisé
|
||||
|
||||
|
||||
Reference in New Issue
Block a user