FIX ISSUES

This commit is contained in:
Jérôme Delacotte
2025-12-04 19:12:59 +01:00
parent 496c4d7827
commit 3efc95e415
13 changed files with 33 additions and 32 deletions

View File

@@ -1061,7 +1061,8 @@ class FrictradeLearning(IStrategy):
# FIN ########################## ALGO ATH # FIN ########################## ALGO ATH
condition = last_candle['hapercent'] > 0 and last_candle['sma24_deriv1'] > 0 \ condition = last_candle['hapercent'] > 0 and last_candle['sma24_deriv1'] > 0 \
and last_candle['close'] < self.pairs[pair]['first_buy'] and last_candle['ml_prob'] > 0.65 and last_candle['close'] < self.pairs[pair]['first_buy'] \
and last_candle['ml_prob'] > 0.65
limit_buy = 40 limit_buy = 40
# or (last_candle['close'] <= last_candle['min180'] and hours > 3) # or (last_candle['close'] <= last_candle['min180'] and hours > 3)
if (decline >= dca_threshold) and condition: if (decline >= dca_threshold) and condition:

View File

@@ -10,7 +10,7 @@ from freqtrade.persistence import Trade
from freqtrade.strategy.parameters import CategoricalParameter, DecimalParameter from freqtrade.strategy.parameters import CategoricalParameter, DecimalParameter
from numpy.lib import math from numpy.lib import math
from freqtrade.strategy.interface import IStrategy, SellCheckTuple from freqtrade.strategy.interface import IStrategy
from pandas import DataFrame from pandas import DataFrame
# -------------------------------- # --------------------------------

View File

@@ -10,7 +10,7 @@ from freqtrade.persistence import Trade
from freqtrade.strategy.parameters import CategoricalParameter, DecimalParameter, IntParameter from freqtrade.strategy.parameters import CategoricalParameter, DecimalParameter, IntParameter
from numpy.lib import math from numpy.lib import math
from freqtrade.strategy.interface import IStrategy, SellCheckTuple from freqtrade.strategy.interface import IStrategy
from pandas import DataFrame from pandas import DataFrame
# -------------------------------- # --------------------------------

View File

@@ -10,7 +10,7 @@ from freqtrade.persistence import Trade
from freqtrade.strategy.parameters import CategoricalParameter, DecimalParameter, IntParameter from freqtrade.strategy.parameters import CategoricalParameter, DecimalParameter, IntParameter
from numpy.lib import math from numpy.lib import math
from freqtrade.strategy.interface import IStrategy, SellCheckTuple from freqtrade.strategy.interface import IStrategy
from pandas import DataFrame from pandas import DataFrame
# -------------------------------- # --------------------------------

View File

@@ -27,7 +27,7 @@ import numpy as np
from random import shuffle from random import shuffle
# TODO: this gene is removed 'MAVP' cuz or error on periods # TODO: this gene is removed 'MAVP' cuz or error on periods
import user_data.strategies.custom_indicators as csa # import user_data.strategies.custom_indicators as csa
all_god_genes = { all_god_genes = {
'Overlap Studies': { 'Overlap Studies': {

View File

@@ -220,10 +220,10 @@ class Ishimoku_6(IStrategy):
def bot_loop_start(self, **kwargs) -> None: def bot_loop_start(self, **kwargs) -> None:
inf_tf = '5m' inf_tf = '5m'
pairs = self.dp.current_whitelist() pairs = self.dp.current_whitelist()
print("Calcul des pairs informatives") # print("Calcul des pairs informatives")
for pairname in pairs: for pairname in pairs:
self.stop_buying[pairname] = True self.stop_buying[pairname] = True
print("Fin Calcul des pairs informatives") # print("Fin Calcul des pairs informatives")
# def custom_stake_amount(self, pair: str, current_time: datetime, current_rate: float, # def custom_stake_amount(self, pair: str, current_time: datetime, current_rate: float,
# proposed_stake: float, min_stake: float, max_stake: float, # proposed_stake: float, min_stake: float, max_stake: float,

View File

@@ -1,7 +1,7 @@
import numpy as np import numpy as np
import talib.abstract as ta import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib import freqtrade.vendor.qtpylib.indicators as qtpylib
import arrow # import arrow
from freqtrade.strategy import (IStrategy, merge_informative_pair, stoploss_from_open, from freqtrade.strategy import (IStrategy, merge_informative_pair, stoploss_from_open,
IntParameter, DecimalParameter, CategoricalParameter) IntParameter, DecimalParameter, CategoricalParameter)
@@ -162,7 +162,7 @@ def SSLChannels(dataframe, length=10, mode='sma'):
df['smaLow'] = df['low'].rolling(length).mean() df['smaLow'] = df['low'].rolling(length).mean()
df['hlv'] = np.where(df['close'] > df['smaHigh'], 1, df['hlv'] = np.where(df['close'] > df['smaHigh'], 1,
np.where(df['close'] < df['smaLow'], -1, np.NAN)) np.where(df['close'] < df['smaLow'], -1, np.nan))
df['hlv'] = df['hlv'].ffill() df['hlv'] = df['hlv'].ffill()
df['sslDown'] = np.where(df['hlv'] < 0, df['smaHigh'], df['smaLow']) df['sslDown'] = np.where(df['hlv'] < 0, df['smaHigh'], df['smaLow'])
@@ -180,7 +180,7 @@ def SSLChannels_ATR(dataframe, length=7):
df['ATR'] = ta.ATR(df, timeperiod=14) df['ATR'] = ta.ATR(df, timeperiod=14)
df['smaHigh'] = df['high'].rolling(length).mean() + df['ATR'] df['smaHigh'] = df['high'].rolling(length).mean() + df['ATR']
df['smaLow'] = df['low'].rolling(length).mean() - df['ATR'] df['smaLow'] = df['low'].rolling(length).mean() - df['ATR']
df['hlv'] = np.where(df['close'] > df['smaHigh'], 1, np.where(df['close'] < df['smaLow'], -1, np.NAN)) df['hlv'] = np.where(df['close'] > df['smaHigh'], 1, np.where(df['close'] < df['smaLow'], -1, np.nan))
df['hlv'] = df['hlv'].ffill() df['hlv'] = df['hlv'].ffill()
df['sslDown'] = np.where(df['hlv'] < 0, df['smaHigh'], df['smaLow']) df['sslDown'] = np.where(df['hlv'] < 0, df['smaHigh'], df['smaLow'])
df['sslUp'] = np.where(df['hlv'] < 0, df['smaLow'], df['smaHigh']) df['sslUp'] = np.where(df['hlv'] < 0, df['smaLow'], df['smaHigh'])

View File

@@ -164,7 +164,7 @@ class Supertrend(IStrategy):
df['final_lb'].iat[i] if df[st].iat[i - 1] == df['final_lb'].iat[i - 1] and df['close'].iat[i] >= df['final_lb'].iat[i] else \ df['final_lb'].iat[i] if df[st].iat[i - 1] == df['final_lb'].iat[i - 1] and df['close'].iat[i] >= df['final_lb'].iat[i] else \
df['final_ub'].iat[i] if df[st].iat[i - 1] == df['final_lb'].iat[i - 1] and df['close'].iat[i] < df['final_lb'].iat[i] else 0.00 df['final_ub'].iat[i] if df[st].iat[i - 1] == df['final_lb'].iat[i - 1] and df['close'].iat[i] < df['final_lb'].iat[i] else 0.00
# Mark the trend direction up/down # Mark the trend direction up/down
df[stx] = np.where((df[st] > 0.00), np.where((df['close'] < df[st]), 'down', 'up'), np.NaN) df[stx] = np.where((df[st] > 0.00), np.where((df['close'] < df[st]), 'down', 'up'), np.nan)
# Remove basic and final bands from the columns # Remove basic and final bands from the columns
df.drop(['basic_ub', 'basic_lb', 'final_ub', 'final_lb'], inplace=True, axis=1) df.drop(['basic_ub', 'basic_lb', 'final_ub', 'final_lb'], inplace=True, axis=1)

View File

@@ -487,10 +487,10 @@ class Zeus_5_1(IStrategy):
def bot_loop_start(self, **kwargs) -> None: def bot_loop_start(self, **kwargs) -> None:
inf_tf = '5m' inf_tf = '5m'
pairs = self.dp.current_whitelist() pairs = self.dp.current_whitelist()
print("Calcul des pairs informatives") # print("Calcul des pairs informatives")
for pairname in pairs: for pairname in pairs:
self.stop_buying[pairname] = True self.stop_buying[pairname] = True
print("Fin Calcul des pairs informatives") # print("Fin Calcul des pairs informatives")
def confirm_trade_entry(self, pair: str, order_type: str, amount: float, rate: float, time_in_force: str, 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: current_time: datetime, entry_tag: Optional[str], **kwargs) -> bool:

View File

@@ -491,10 +491,10 @@ class Zeus_5_2(IStrategy):
def bot_loop_start(self, **kwargs) -> None: def bot_loop_start(self, **kwargs) -> None:
inf_tf = '5m' inf_tf = '5m'
pairs = self.dp.current_whitelist() pairs = self.dp.current_whitelist()
print("Calcul des pairs informatives") # print("Calcul des pairs informatives")
for pairname in pairs: for pairname in pairs:
self.stop_buying[pairname] = True self.stop_buying[pairname] = True
print("Fin Calcul des pairs informatives") # print("Fin Calcul des pairs informatives")
def confirm_trade_entry(self, pair: str, order_type: str, amount: float, rate: float, time_in_force: str, 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: current_time: datetime, entry_tag: Optional[str], **kwargs) -> bool:

View File

@@ -487,10 +487,10 @@ class Zeus_6(IStrategy):
def bot_loop_start(self, **kwargs) -> None: def bot_loop_start(self, **kwargs) -> None:
inf_tf = '5m' inf_tf = '5m'
pairs = self.dp.current_whitelist() pairs = self.dp.current_whitelist()
print("Calcul des pairs informatives") # print("Calcul des pairs informatives")
for pairname in pairs: for pairname in pairs:
self.stop_buying[pairname] = True self.stop_buying[pairname] = True
print("Fin Calcul des pairs informatives") # print("Fin Calcul des pairs informatives")
def confirm_trade_entry(self, pair: str, order_type: str, amount: float, rate: float, time_in_force: str, 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: current_time: datetime, entry_tag: Optional[str], **kwargs) -> bool:

View File

@@ -1084,23 +1084,23 @@ class Zeus_8_3_2_B_4_2(IStrategy):
dataframe['stop_buying'] = latched dataframe['stop_buying'] = latched
if self.dp.runmode.value in ('backtest'): if False and self.dp.runmode.value in ('backtest'):
self.trainModel(dataframe, metadata) self.trainModel(dataframe, metadata)
short_pair = self.getShortName(pair) short_pair = self.getShortName(pair)
if short_pair == 'BTC': # if short_pair == 'BTC':
self.model = joblib.load(f"{short_pair}_rf_model.pkl") # self.model = joblib.load(f"{short_pair}_rf_model.pkl")
#
# Préparer les features pour la prédiction # # Préparer les features pour la prédiction
features = dataframe[self.model_indicators].fillna(0) # features = dataframe[self.model_indicators].fillna(0)
#
# Prédiction : probabilité que le prix monte # # Prédiction : probabilité que le prix monte
probs = self.model.predict_proba(features)[:, 1] # probs = self.model.predict_proba(features)[:, 1]
#
# Sauvegarder la probabilité pour lanalyse # # Sauvegarder la probabilité pour lanalyse
dataframe['ml_prob'] = probs # dataframe['ml_prob'] = probs
#
self.inspect_model(self.model) # self.inspect_model(self.model)
return dataframe return dataframe

View File

@@ -48,7 +48,7 @@ class FixedRiskRewardLoss(IStrategy):
# using current_time/open_date directly via custom_info_pair[trade.open_daten] # using current_time/open_date directly via custom_info_pair[trade.open_daten]
# would only work in backtesting/hyperopt. # would only work in backtesting/hyperopt.
# in live/dry-run, we have to search for nearest row before it # in live/dry-run, we have to search for nearest row before it
open_date_mask = custom_info_pair.index.unique().get_loc(trade.open_date_utc, method='ffill') open_date_mask = custom_info_pair.index.unique().get_loc(trade.open_date_utc)
open_df = custom_info_pair.iloc[open_date_mask] open_df = custom_info_pair.iloc[open_date_mask]
# trade might be open too long for us to find opening candle # trade might be open too long for us to find opening candle