Calcul 20250101-20250714 954.664 233.944
This commit is contained in:
@@ -190,8 +190,11 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
# Somme Mises 50 100 150 250 350 500 700 950 1300 1750 2350 3150 4200
|
||||
# baisse 1 2 3 5 7 10 14 19 26 35 47 63 84
|
||||
|
||||
factors = [1, 1.1, 1.25, 1.5, 2.0, 3]
|
||||
thresholds = [2, 5, 10, 20, 30, 50]
|
||||
# factors = [1, 1.1, 1.25, 1.5, 2.0, 3]
|
||||
# thresholds = [2, 5, 10, 20, 30, 50]
|
||||
|
||||
factors = [1, 1.25, 1.5, 2.0]
|
||||
thresholds = [2, 5, 10, 20]
|
||||
|
||||
trades = list()
|
||||
max_profit_pairs = {}
|
||||
@@ -523,6 +526,8 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
# val1h = self.getProbaHausse1h(last_candle)
|
||||
val = self.getProbaHausse(last_candle)
|
||||
|
||||
pct60 = round(100 * self.getPct60D(pair, last_candle), 2)
|
||||
|
||||
self.printLog(
|
||||
f"| {date:<16} | {action:<10} | {pair[0:3]:<3} | {trade_type or '-':<18} |{rate or '-':>9}| {dispo or '-':>6} "
|
||||
f"| {profit or '-':>8} | {pct_max or '-':>6} | {round(self.pairs[pair]['max_touch'], 2) or '-':>11} | {last_lost or '-':>12} "
|
||||
@@ -531,7 +536,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
# f"|{round(last_candle['mid_smooth_24_deriv1'],3) or '-':>6}|{round(last_candle['mid_smooth_1h_deriv1'],3) or '-':>6}|{round(last_candle['mid_smooth_deriv1_1d'],3) or '-' :>6}|"
|
||||
# f"{round(last_candle['mid_smooth_24_deriv2'],3) or '-' :>6}|{round(last_candle['mid_smooth_1h_deriv2'],3) or '-':>6}|{round(last_candle['mid_smooth_deriv2_1d'],3) or '-':>6}|"
|
||||
f"{round(val, 1) or '-' :>6}|"
|
||||
f"{round(last_candle['mid_smooth_12'], 4) or '-' :>7}|{round(last_candle['mid_smooth_12_deriv1'], 4) or '-' :>7}|{dist_max:>7}"
|
||||
f"{round(last_candle['mid_smooth_12'], 4) or '-' :>7}|{round(last_candle['mid_smooth_12_deriv1'], 4) or '-' :>7}|{dist_max:>7}|{pct60:>7}"
|
||||
)
|
||||
|
||||
def printLineLog(self):
|
||||
@@ -726,8 +731,8 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
# ===============================
|
||||
# lissage des valeurs horaires
|
||||
dataframe['mid_smooth_1h'] = dataframe['mid'].rolling(window=6).mean()
|
||||
dataframe["mid_smooth_1h_deriv1"] = 100 * dataframe["mid_smooth_1h"].diff() / dataframe['mid_smooth_1h']
|
||||
dataframe["mid_smooth_1h_deriv2"] = 10 * dataframe["mid_smooth_1h_deriv1"].diff()
|
||||
dataframe["mid_smooth_1h_deriv1"] = 100 * dataframe["mid_smooth_1h"].diff().rolling(window=6).mean() / dataframe['mid_smooth_1h']
|
||||
dataframe["mid_smooth_1h_deriv2"] = 10 * dataframe["mid_smooth_1h_deriv1"].diff().rolling(window=6).mean()
|
||||
|
||||
# Compter les baisses / hausses consécutives
|
||||
self.calculateDownAndUp(dataframe, limit=0.0001)
|
||||
@@ -855,12 +860,18 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
|
||||
dataframe.loc[
|
||||
(
|
||||
# (dataframe['mid_smooth_1h_deriv1'].shift(2) >= dataframe['mid_smooth_1h_deriv1'].shift(1))
|
||||
# & (dataframe['mid_smooth_1h_deriv1'].shift(1) <= dataframe['mid_smooth_1h_deriv1'])
|
||||
|
||||
(dataframe['mid_smooth_1h_deriv1'].shift(2) >= dataframe['mid_smooth_1h_deriv1'].shift(1))
|
||||
& (dataframe['mid_smooth_1h_deriv1'].shift(1) <= dataframe['mid_smooth_1h_deriv1'])
|
||||
& (dataframe['close'] < dataframe['bb_middleband'])
|
||||
# (dataframe['deriv2_1h'].shift(2) >= dataframe['deriv2_1h'].shift(1))
|
||||
# & (dataframe['deriv2_1h'].shift(1) <= dataframe['deriv2_1h'])
|
||||
# (dataframe['deriv1_1h'] >= -0.01)
|
||||
# & (dataframe['deriv2_1h'] >= -0.00)
|
||||
(dataframe['mid_smooth_3_deriv1'].shift(2) >= dataframe['mid_smooth_3_deriv1'].shift(1))
|
||||
& (dataframe['mid_smooth_3_deriv1'].shift(1) <= dataframe['mid_smooth_3_deriv1'])
|
||||
#
|
||||
#
|
||||
# (dataframe['mid_smooth_1h_deriv1'] >= 0)
|
||||
# & (dataframe['mid_smooth_1h_deriv1'] >= 0)
|
||||
# & (dataframe['mid_smooth_1h_deriv1'].shift(1) <= 0)
|
||||
# & (dataframe['mid_smooth_1h_deriv1'] >= dataframe['mid_smooth_1h_deriv1'].shift(1))
|
||||
), ['enter_long', 'enter_tag']] = (1, 'smth')
|
||||
|
||||
dataframe['can_sell'] = np.where(((dataframe['mid_smooth_1h_deriv1'].shift(2) <= dataframe['mid_smooth_1h_deriv1'].shift(1))\
|
||||
@@ -872,6 +883,9 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
dataframe['test'] = np.where(dataframe['enter_long'] == 1, dataframe['close'] * 1.01, np.nan)
|
||||
dataframe['perte_02'] = np.where((dataframe['hapercent3'] * 100 < -0.2), dataframe['close'], np.nan)
|
||||
|
||||
dataframe['mid_smooth_1h_deriv2_inv'] = np.where((dataframe['mid_smooth_1h_deriv2'].shift(2) >= dataframe['mid_smooth_1h_deriv2'].shift(1))
|
||||
& (dataframe['mid_smooth_1h_deriv2'].shift(1) <= dataframe['mid_smooth_1h_deriv2']), dataframe['close'], np.nan)
|
||||
|
||||
# self.paliers = self.get_dca_stakes()
|
||||
|
||||
# if self.dp.runmode.value in ('backtest'):
|
||||
@@ -1017,12 +1031,14 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
|
||||
if pair in ('BTC/USDT', 'BTC/USDC') 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))
|
||||
# lim = - (0.012 + 0.001 * (count_of_buys - 1) + (0.002 * count_of_buys if count_of_buys > 10 else 0.001 * count_of_buys if count_of_buys > 5 else 0))
|
||||
|
||||
else:
|
||||
pct = 0.05
|
||||
lim = - pct - (count_of_buys * 0.001)
|
||||
#lim = self.getLimitBuy(pair, last_candle, pct)
|
||||
|
||||
if (len(dataframe) < 1):
|
||||
print("skip dataframe")
|
||||
@@ -1255,6 +1271,23 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
def getPctLastBuy(self, pair, last_candle):
|
||||
return round((last_candle['close'] - self.pairs[pair]['last_buy']) / self.pairs[pair]['last_buy'], 4)
|
||||
|
||||
def getPct60D(self, pair, last_candle):
|
||||
return round((last_candle['max60_1d'] - last_candle['min60_1d']) / last_candle['max60_1d'], 4)
|
||||
|
||||
def getLimitBuy(self, pair, last_candle, first_pct):
|
||||
count_of_buys = self.pairs[pair]['count_of_buys']
|
||||
pct60 = self.getPct60D(pair, last_candle) # exemple 0.3 pour 30%
|
||||
if (pct60 < 0.05):
|
||||
lim = - first_pct - (count_of_buys * 0.001 * 0.05 / 0.05)
|
||||
else:
|
||||
# 0.1
|
||||
# 0.4
|
||||
|
||||
lim = - first_pct - (count_of_buys * 0.001 * pct60 / 0.05)
|
||||
|
||||
return lim
|
||||
|
||||
|
||||
def getProbaHausse(self, last_candle):
|
||||
value_1 = self.getValuesFromTable(self.ema_volume, last_candle['ema_volume'])
|
||||
value_2 = self.getValuesFromTable(self.mid_smooth_1h_deriv1, last_candle['mid_smooth_1h_deriv1'])
|
||||
@@ -1298,8 +1331,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
count_of_buys = self.pairs[pair]['count_of_buys']
|
||||
pct_first = self.getPctFirstBuy(pair, last_candle)
|
||||
|
||||
expected_profit = max(0.004, abs(
|
||||
pct_first / 3)) # 0.004 + 0.002 * self.pairs[pair]['count_of_buys'] #min(0.01, first_max)
|
||||
expected_profit = max(0.004, abs(pct_first / 3)) # 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}")
|
||||
@@ -1833,7 +1865,7 @@ class Zeus_8_3_2_B_4_2(IStrategy):
|
||||
max_pair = p
|
||||
total_non_btc += self.pairs[p]['count_of_buys']
|
||||
|
||||
pct_max = self.getPctLastBuy(pair, last_candle)
|
||||
pct_max = self.getPctFirstBuy(pair, last_candle) #self.getPctLastBuy(pair, last_candle)
|
||||
|
||||
# val = self.getProbaHausse(last_candle)
|
||||
# if (val < 40):
|
||||
|
||||
Reference in New Issue
Block a user