Calcul 20250101-20250714 464.183 202.763 56539

This commit is contained in:
Jérôme Delacotte
2025-10-06 22:26:29 +02:00
parent 48ceb7f460
commit bd0933cb6a
2 changed files with 241 additions and 1989 deletions

View File

@@ -103,31 +103,12 @@ class Zeus_8_3_2_B_4_2(IStrategy):
}
},
"subplots": {
"Pct": {
"sma20_deriv1": {
'color': "green"
},
"down_pct": {
"color": "blue"
},
"down_pct_1h": {
"color": "red"
},
"down_pct_1d": {
"color": "red"
}
},
"Rsi": {
"rsi": {
"color": "pink"
},
"rsi_1h": {
"color": "red"
},
"rsi_1d": {
"color": "blue"
}
},
},
"Rsi_deriv1": {
"rsi_deriv1_1h": {
@@ -136,33 +117,48 @@ class Zeus_8_3_2_B_4_2(IStrategy):
"rsi_deriv1_1d": {
"color": "blue"
},
},
"Down": {
"down_count_1h": {
"sma60_deriv1": {
"color": "green"
},
"up_count_1h": {
"color": "blue"
}
},
"Rsi_deriv2": {
"rsi_deriv2_1h": {
"color": "red"
},
"rsi_deriv2_1d": {
"color": "blue"
},
"sma60_deriv2": {
"color": "green"
}
},
# "Down": {
# "down_count_1h": {
# "color": "green"
# },
# "up_count_1h": {
# "color": "blue"
# }
# },
# "Diff": {
# "sma10_deriv1": {
# "color": "#74effc"
# }
# },
"smooth": {
'mid_smooth_deriv1_1d': {
"color": "blue"
},
'mid_smooth_1h_deriv1': {
"color": "red"
},
'mid_smooth_deriv2_1d': {
"color": "pink"
},
'mid_smooth_1h_deriv2': {
"color": "#da59a6"
}
# "smooth": {
# 'sma60_deriv1': {
# "color": "blue"
# },
# # 'mid_smooth_1h_deriv1': {
# # "color": "red"
# # },
# 'sma5_deriv2_1h': {
# "color": "pink"
# },
# # 'mid_smooth_1h_deriv2': {
# # "color": "#da59a6"
# # }
# }
}
}
}
@@ -461,7 +457,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
max_profit = self.pairs[pair]['max_profit']
baisse = 0
if profit > 0:
baisse = 100 * abs(max_profit - profit) / max_profit
baisse = max_profit - profit
mx = max_profit / 5
self.pairs[pair]['count_of_buys'] = count_of_buys
self.pairs[pair]['current_profit'] = profit
@@ -510,9 +506,12 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# self.pairs[pair]['force_sell'] = False
# return 'stoploss_' + pair_name + '_' + str(count_of_buys) + '_' + str(self.pairs[pair]['has_gain'])
if baisse > 15 and profit > expected_profit:
factor = 1
if (self.getShortName(pair) == 'BTC'):
factor = 0.5
if baisse > 2 and baisse > factor * self.pairs[pair]['total_amount'] / 100:
self.pairs[pair]['force_sell'] = False
self.pairs[pair]['force_buy'] = (self.pairs[pair]['count_of_buys'] - self.pairs[pair]['has_gain'] > 5)
self.pairs[pair]['force_buy'] = (self.pairs[pair]['count_of_buys'] - self.pairs[pair]['has_gain'] > 3)
return 'Baisse_' + pair_name + '_' + str(count_of_buys) + '_' + str(self.pairs[pair]['has_gain'])
#
# # if 1 <= count_of_buys <= 3:
@@ -809,12 +808,9 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# informative = self.calculateDerivation(informative, window=12)
# informative = self.apply_regression_derivatives(informative, column='mid', window=5, degree=4)
informative['volatility'] = talib.STDDEV(informative['close'], timeperiod=14) / informative['close']
self.calculeDerivees(informative, 'volatility')
informative['atr'] = (talib.ATR(informative['high'], informative['low'], informative['close'], timeperiod=14)) / \
informative['close']
self.calculeDerivees(informative, 'atr')
informative['rsi'] = talib.RSI(informative['close']) # , timeperiod=7)
informative['rsi'] = informative['rsi'].rolling(5).mean()
self.calculeDerivees(informative, 'rsi', horizon=5)
informative['sma5'] = talib.SMA(informative, timeperiod=5)
informative['sma24'] = talib.SMA(informative, timeperiod=24)
@@ -1156,7 +1152,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# & (dataframe['mid_smooth_deriv1'] >= dataframe['mid_smooth_deriv1'].shift(1))
# ), ['enter_long', 'enter_tag']] = (1, 'down')
factor = 1.01
if pair == "BTC/USDT" or pair == "BTC/USDC":
if (self.getShortName(pair) == 'BTC'):
factor = factor / 2
dataframe.loc[
(
@@ -1315,7 +1311,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
pct_first = 0
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 self.getShortName(pair) == 'BTC')
if self.pairs[pair]['first_buy']:
pct_first = self.getPctFirstBuy(pair, last_candle)
@@ -1329,7 +1325,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
else:
pct_max = - pct
if pair in ('BTC/USDT', 'BTC/USDC') or count_of_buys <= 2:
if (self.getShortName(pair) == 'BTC') or count_of_buys <= 2:
lim = - pct - (count_of_buys * 0.001)
# lim = self.getLimitBuy(pair, last_candle, pct)
# lim = - (0.012 * (1 + round(count_of_buys / 5)) + 0.001 * (count_of_buys - 1))
@@ -1545,12 +1541,12 @@ class Zeus_8_3_2_B_4_2(IStrategy):
last_lost = self.getLastLost(last_candle, pair)
if (False and hours > 6 and pct_first < -0.05
and last_candle['sma5_deriv1_1h'] > 0
and last_candle['rsi'] < 65 and last_candle['rsi_1h'] < 65
and last_candle['rsi_deriv1'] > 0 and last_candle['rsi_deriv2'] > 0
and last_candle['mid_smooth_12_deriv1'] > 0
and last_candle['mid_smooth_12_deriv2'] > 0
if (hours > 6
# and last_candle['sma60_deriv1'] > 0
and last_candle['rsi_1h'] < 65
and last_candle['rsi_deriv1_1h'] > 0
and last_candle['mid_smooth_5_deriv1_1d'] > 0
and last_candle['sma60_deriv1'] > 0
):
try:
stake_amount = self.pairs[pair]['first_amount'] / 2
@@ -1719,10 +1715,10 @@ class Zeus_8_3_2_B_4_2(IStrategy):
return out_max - position * (out_max - out_min)
def expectedProfit(self, pair: str, last_candle: DataFrame):
lim = 0.008
lim = 0.01
pct = 0.002
if pair == "BTC/USDT" or pair == "BTC/USDC":
lim = 0.004
if (self.getShortName(pair) == 'BTC'):
lim = 0.005
pct = 0.001
pct_to_max = lim + pct * self.pairs[pair]['count_of_buys']
# if self.pairs[pair]['count_of_buys'] > 6:
@@ -1733,7 +1729,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# if last_candle['close'] < max_60:
# pct_to_max = 0.25 * (max_60 - last_candle['close']) / max_60
# pct_to_max = pct_to_max * (2 - pctClose60)
expected_profit = min(3 * lim, max(lim, pct_to_max)) # 0.004 + 0.002 * self.pairs[pair]['count_of_buys'] #min(0.01, first_max)
expected_profit = lim * self.pairs[pair]['total_amount'] #min(3 * lim, max(lim, pct_to_max)) # 0.004 + 0.002 * self.pairs[pair]['count_of_buys'] #min(0.01, first_max)
# print(
# f"Expected profit price={current_price:.4f} min_max={min_max:.4f} min_14={min_14_days:.4f} max_14={max_14_days:.4f} percent={percent:.4f} expected_profit={expected_profit:.4f}")

File diff suppressed because it is too large Load Diff