Calcul 20240101-20250514 1204$ 276.5$

This commit is contained in:
Jérôme Delacotte
2025-05-22 20:51:48 +02:00
parent 14dd2080be
commit 5e532bd44d
2 changed files with 18 additions and 14 deletions

View File

@@ -349,8 +349,8 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# =========================================================================
# Parameters hyperopt
buy_val = IntParameter(1, 10, default=50, space='buy')
buy_val_adjust = IntParameter(1, 10, default=50, space='buy')
buy_mid_smooth_3_deriv1 = DecimalParameter(-0.1, 0.1, decimals=2, default=-0.06, space='buy')
buy_mid_smooth_24_deriv1 = DecimalParameter(-0.6, 0, decimals=2, default=-0.03, space='buy')
def confirm_trade_entry(self, pair: str, order_type: str, amount: float, rate: float, time_in_force: str,
current_time: datetime, entry_tag: Optional[str], **kwargs) -> bool:
@@ -596,7 +596,8 @@ class Zeus_8_3_2_B_4_2(IStrategy):
if not self.dp.runmode.value in ('backtest', 'hyperopt'):
logger.info(str)
else:
print(str)
if not self.dp.runmode.value in ('hyperopt'):
print(str)
def add_tendency_column(self, dataframe: pd.DataFrame, suffixe='') -> pd.DataFrame:
def tag_by_derivatives(row):
@@ -740,7 +741,6 @@ class Zeus_8_3_2_B_4_2(IStrategy):
for trade in self.trades:
if trade.pair != pair:
continue
print(trade)
filled_buys = trade.select_filled_orders('buy')
count = 0
amount = 0
@@ -752,14 +752,12 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# Order(id=2396, trade=1019, order_id=29870026652, side=buy, filled=0.00078, price=63921.01,
# status=closed, date=2024-08-26 02:20:11)
dataframe['last_price'] = buy.price
print(buy)
count = count + 1
amount += buy.price * buy.filled
# dataframe['mid_price'] = (dataframe['last_price'] + dataframe['first_price']) / 2
count_buys = count
# dataframe['limit'] = dataframe['last_price'] * (1 - self.baisse[count] / 100)
# dataframe['amount'] = amount
print(f"amount= {amount}")
# dataframe['mid_smooth_tag'] = qtpylib.crossed_below(dataframe['mid_smooth_24_deriv1'], dataframe['mid_smooth_deriv2_24'])
@@ -851,7 +849,6 @@ class Zeus_8_3_2_B_4_2(IStrategy):
def getOpenTrades(self):
# if len(self.trades) == 0:
print('search open trades')
self.trades = Trade.get_open_trades()
return self.trades
@@ -863,11 +860,6 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# self.getBinanceOrderBook(pair, dataframe)
last_candle = dataframe.iloc[-1].squeeze()
print("---------------" + pair + "----------------")
print('adjust stake amount ' + str(self.adjust_stake_amount(pair, dataframe.iloc[-1])))
# print('adjust exit price ' + str(self.adjust_exit_price(dataframe.iloc[-1])))
print('calcul expected_profit ' + str(expected_profit))
# dataframe.loc[
# (
# (dataframe['percent'] > 0)
@@ -893,7 +885,6 @@ class Zeus_8_3_2_B_4_2(IStrategy):
dataframe['test'] = np.where(dataframe['enter_long'] == 1, dataframe['close'] * 1.01, np.nan)
self.paliers = self.get_dca_stakes()
print(self.paliers)
if self.dp.runmode.value in ('backtest'):
today = datetime.now().strftime("%Y-%m-%d-%H:%M:%S")
@@ -1130,7 +1121,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
# if (days_since_open > count_of_buys) & (0 < count_of_buys <= max_buys) & (current_rate <= limit) & (last_candle['enter_long'] == 1):
condition = True
condition = True #(last_candle['mid_smooth_3_deriv1'] > self.buy_mid_smooth_3_deriv1.value) and (last_candle['mid_smooth_24_deriv1'] > self.buy_mid_smooth_24_deriv1.value)
# (last_candle['enter_long'] == 1 & (count_of_buys < 3)) \
# 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))

View File

@@ -0,0 +1,13 @@
import json
with open('/home/jerome/Perso/freqtradeDocker/user_data/hyperopts/hyperopt_results_2025-05-21_XX.json') as f:
results = json.load(f)
def custom_score(res):
stake = res.get('avg_stake_amount', 1e6)
duration = res.get('avg_duration', 1e6)
profit = res.get('profit_total_usdt', -1e6)
return -stake * 0.4 - duration * 0.3 + profit * 0.3
best = sorted(results, key=custom_score, reverse=True)[0]
print("Best configuration based on custom score:", best)