removed sum_filled_amounts
This commit is contained in:
parent
c5415a7e8b
commit
887dd65807
|
|
@ -1,5 +1,6 @@
|
||||||
2024.11.17:
|
2024.11.17:
|
||||||
. The trader is supplied with a complete open order list, instead of only the ids.
|
. The trader is supplied with a complete open order list, instead of only the ids.
|
||||||
|
. Removed sum_filled_amounts, it was only called once.
|
||||||
|
|
||||||
2024.11.13:
|
2024.11.13:
|
||||||
. Fixed bug handling timestamps.
|
. Fixed bug handling timestamps.
|
||||||
|
|
|
||||||
28
trader.py
28
trader.py
|
|
@ -920,25 +920,6 @@ class trader:
|
||||||
return restart_trader
|
return restart_trader
|
||||||
|
|
||||||
|
|
||||||
def sum_filled_amounts(self, order: dict) -> int:
|
|
||||||
'''
|
|
||||||
Adds the amount filled and the cost of an order to the totals.
|
|
||||||
'''
|
|
||||||
# Add up the last order fees
|
|
||||||
new_fees_base = 0 #For type checking compliance
|
|
||||||
new_fees_quote = 0
|
|
||||||
|
|
||||||
# Update the total_amount_of_quote and total_amount_of_base variables
|
|
||||||
if order["id"]!="": #Necessary check when adding SOs
|
|
||||||
new_fees_base,new_fees_quote = self.parse_fees(order)
|
|
||||||
self.fees_paid_in_quote += new_fees_quote
|
|
||||||
self.total_amount_of_base = self.total_amount_of_base + order["filled"] - new_fees_base
|
|
||||||
self.total_amount_of_quote = self.total_amount_of_quote + order["cost"]
|
|
||||||
|
|
||||||
# Done
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
def new_so_routine(self, filled_order: dict, send_new_so: bool) -> int:
|
def new_so_routine(self, filled_order: dict, send_new_so: bool) -> int:
|
||||||
'''
|
'''
|
||||||
Handles all the bureaucracy prior and after sending a new safety order
|
Handles all the bureaucracy prior and after sending a new safety order
|
||||||
|
|
@ -969,7 +950,10 @@ class trader:
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
# Add the amount filled in the last safety order to the totals
|
# Add the amount filled in the last safety order to the totals
|
||||||
self.sum_filled_amounts(filled_order)
|
new_fees_base,new_fees_quote = self.parse_fees(filled_order)
|
||||||
|
self.fees_paid_in_quote += new_fees_quote
|
||||||
|
self.total_amount_of_base = self.total_amount_of_base + filled_order["filled"] - new_fees_base
|
||||||
|
self.total_amount_of_quote = self.total_amount_of_quote + filled_order["cost"]
|
||||||
|
|
||||||
#Cooldown
|
#Cooldown
|
||||||
time.sleep(self.broker.get_wait_before_new_safety_order())
|
time.sleep(self.broker.get_wait_before_new_safety_order())
|
||||||
|
|
@ -981,8 +965,6 @@ class trader:
|
||||||
error_string = "Problems sending the new safety order. Maybe not enough funds?"
|
error_string = "Problems sending the new safety order. Maybe not enough funds?"
|
||||||
self.broker.logger.log_this(error_string,1,self.pair)
|
self.broker.logger.log_this(error_string,1,self.pair)
|
||||||
self.status_dict["pause_reason"] = error_string
|
self.status_dict["pause_reason"] = error_string
|
||||||
#self.sum_filled_amounts(filled_order)
|
|
||||||
#self.so = self.broker.get_empty_order()
|
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
self.so = self.broker.get_empty_order()
|
self.so = self.broker.get_empty_order()
|
||||||
|
|
@ -1049,7 +1031,7 @@ class trader:
|
||||||
|
|
||||||
def check_orderbook_depth(self, threshold: float, order_size: float, old_price: float = 0, size_in_quote = True) -> bool:
|
def check_orderbook_depth(self, threshold: float, order_size: float, old_price: float = 0, size_in_quote = True) -> bool:
|
||||||
'''
|
'''
|
||||||
Checks if the orderbook depth exceed the slippage threshold. Returns True if threshold is exceeded, False otherwise.
|
Checks if the orderbook depth exceeds the slippage threshold. Returns True if it is exceeded, False otherwise.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
threshold (float): The threshold for the orderbook depth.
|
threshold (float): The threshold for the orderbook depth.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue