Removed deprecated variables
This commit is contained in:
parent
0d191edb9e
commit
7413c57f2c
|
|
@ -1,3 +1,6 @@
|
||||||
|
2024.11.09:
|
||||||
|
. Removed multiplier modifier added in 0.12d, since it was not needed anymore.
|
||||||
|
|
||||||
2024.11.08:
|
2024.11.08:
|
||||||
. Added boosted take profit level: If the trader is actively closing deals, the expected profit level is raised by x%.
|
. Added boosted take profit level: If the trader is actively closing deals, the expected profit level is raised by x%.
|
||||||
Defaults are: Four deals in one hour, 1% raise.
|
Defaults are: Four deals in one hour, 1% raise.
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
"write_logs": false, #Write logs to file.
|
"write_logs": false, #Write logs to file.
|
||||||
"calculate_fees": true, #Take into account the fees when calculating profits.
|
"calculate_fees": true, #Take into account the fees when calculating profits.
|
||||||
"check_slippage": true, #Slippage checks before sending orders.
|
"check_slippage": true, #Slippage checks before sending orders.
|
||||||
|
"slippage_default_threshold": .03 #Default threshold.
|
||||||
"cleanup": true, #Execute the cleanup routine every trader (re)start.
|
"cleanup": true, #Execute the cleanup routine every trader (re)start.
|
||||||
"telegram": true, #Send Telegram notifications.
|
"telegram": true, #Send Telegram notifications.
|
||||||
"tp_mode": 3, #Take profit mode. (check strategy documentation for more details)
|
"tp_mode": 3, #Take profit mode. (check strategy documentation for more details)
|
||||||
|
|
@ -21,5 +22,5 @@
|
||||||
"bias": -0.5, #Bias of the dynamic deviance algorithm. (check strategy documentation for more details)
|
"bias": -0.5, #Bias of the dynamic deviance algorithm. (check strategy documentation for more details)
|
||||||
"boosted_deals_range": 4, #Amount of deals within a timespan to trigger the boost algorithm.
|
"boosted_deals_range": 4, #Amount of deals within a timespan to trigger the boost algorithm.
|
||||||
"boosted_time_range": 3600, #Timespan in seconds to count closed trades.
|
"boosted_time_range": 3600, #Timespan in seconds to count closed trades.
|
||||||
"boosted_amount": .1 #Amount of percentage to add to the profit target if boosted.
|
"boosted_amount": .01 #Amount of percentage to add to the profit target if boosted.
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
main.py
2
main.py
|
|
@ -22,7 +22,7 @@ In case the permissions of the certificate changes, reset them this way:
|
||||||
# ll /etc/letsencrypt/
|
# ll /etc/letsencrypt/
|
||||||
'''
|
'''
|
||||||
|
|
||||||
version = "2024.11.08"
|
version = "2024.11.09"
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Color definitions. If you want to change them, check the reference at https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
|
Color definitions. If you want to change them, check the reference at https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
|
||||||
|
|
|
||||||
14
trader.py
14
trader.py
|
|
@ -1270,7 +1270,7 @@ class trader:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def get_tp_level(self, order_index: int = 0, multiplier: float = 1) -> float:
|
def get_tp_level(self, order_index: int = 0) -> float:
|
||||||
'''
|
'''
|
||||||
Returns the correct take profit percentage, according to the strategy (config_dict["tp_mode"]):
|
Returns the correct take profit percentage, according to the strategy (config_dict["tp_mode"]):
|
||||||
0. Fixed percentage
|
0. Fixed percentage
|
||||||
|
|
@ -1280,7 +1280,7 @@ class trader:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
tp_level = 1
|
tp_level = 1
|
||||||
boost = 0
|
boost_percentage = 0
|
||||||
|
|
||||||
#BOOST ROUTINE: If the trader closed certain amount of deals within the last t timespan, raise the take profit level by x%
|
#BOOST ROUTINE: If the trader closed certain amount of deals within the last t timespan, raise the take profit level by x%
|
||||||
#Default values
|
#Default values
|
||||||
|
|
@ -1302,7 +1302,7 @@ class trader:
|
||||||
last_deals_timestamps = self.broker.return_last_n_deals_timestamps(self.pair,boosted_deals_range)
|
last_deals_timestamps = self.broker.return_last_n_deals_timestamps(self.pair,boosted_deals_range)
|
||||||
if len(last_deals_timestamps)==boosted_deals_range and all(item >= time.time()-boosted_time_range for item in last_deals_timestamps):
|
if len(last_deals_timestamps)==boosted_deals_range and all(item >= time.time()-boosted_time_range for item in last_deals_timestamps):
|
||||||
self.is_boosted = True
|
self.is_boosted = True
|
||||||
boost+=boosted_amount
|
boost_percentage = boosted_amount
|
||||||
|
|
||||||
if self.is_short or self.config_dict["tp_mode"]==0: #Fixed take profit percentage
|
if self.is_short or self.config_dict["tp_mode"]==0: #Fixed take profit percentage
|
||||||
tp_level = self.config_dict["tp_level"]
|
tp_level = self.config_dict["tp_level"]
|
||||||
|
|
@ -1327,7 +1327,7 @@ class trader:
|
||||||
tp_level = profit_table[-1]
|
tp_level = profit_table[-1]
|
||||||
if order_index<len(profit_table): #If more safety orders were added, instead of recalculating the whole table
|
if order_index<len(profit_table): #If more safety orders were added, instead of recalculating the whole table
|
||||||
tp_level = profit_table[order_index] #it just returns the last value. Otherwise, the percentage gets very small.
|
tp_level = profit_table[order_index] #it just returns the last value. Otherwise, the percentage gets very small.
|
||||||
return 1+((tp_level+boost-1)*multiplier)
|
return tp_level+boost_percentage
|
||||||
|
|
||||||
|
|
||||||
def seconds_to_time(self, total_seconds: float) -> str:
|
def seconds_to_time(self, total_seconds: float) -> str:
|
||||||
|
|
@ -1346,7 +1346,7 @@ class trader:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def send_new_tp_order(self, multiplier: float = 1) -> int:
|
def send_new_tp_order(self) -> int:
|
||||||
'''
|
'''
|
||||||
Calculates the correct take profit price and sends the order to the exchange
|
Calculates the correct take profit price and sends the order to the exchange
|
||||||
'''
|
'''
|
||||||
|
|
@ -1356,10 +1356,10 @@ class trader:
|
||||||
self.broker.logger.log_this("Amount of base equals 0, can't send take profit order",1,self.pair)
|
self.broker.logger.log_this("Amount of base equals 0, can't send take profit order",1,self.pair)
|
||||||
return 1
|
return 1
|
||||||
if self.is_short:
|
if self.is_short:
|
||||||
self.take_profit_price = self.total_amount_of_quote/self.total_amount_of_base*(1-(self.get_tp_level(self.safety_order_index,multiplier)-1))
|
self.take_profit_price = self.total_amount_of_quote/self.total_amount_of_base*(1-(self.get_tp_level(self.safety_order_index)-1))
|
||||||
self.tp_order = self.broker.new_limit_order(self.pair,self.total_amount_of_base,"buy",self.take_profit_price)
|
self.tp_order = self.broker.new_limit_order(self.pair,self.total_amount_of_base,"buy",self.take_profit_price)
|
||||||
else:
|
else:
|
||||||
self.take_profit_price = self.total_amount_of_quote/self.total_amount_of_base*self.get_tp_level(self.safety_order_index,multiplier)
|
self.take_profit_price = self.total_amount_of_quote/self.total_amount_of_base*self.get_tp_level(self.safety_order_index)
|
||||||
self.tp_order = self.broker.new_limit_order(self.pair,self.total_amount_of_base,"sell",self.take_profit_price)
|
self.tp_order = self.broker.new_limit_order(self.pair,self.total_amount_of_base,"sell",self.take_profit_price)
|
||||||
if self.tp_order==1: #This means that there was a miscalculation of base currency amount, let's correct it.
|
if self.tp_order==1: #This means that there was a miscalculation of base currency amount, let's correct it.
|
||||||
if self.is_short: #If in short mode, we don't recalculate anything.
|
if self.is_short: #If in short mode, we don't recalculate anything.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue