Bug hunting

This commit is contained in:
Nicolás Sánchez 2024-10-30 18:57:24 -03:00
parent cd0511bc5f
commit 878188354c
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,7 @@
2024.10.30:
. Changes trying to catch the wrong base amount bug.
. Simplified new_market_order code.
. Changed the amount to cleanup after the trader starts to get around the wrong base bug. It seems that Gate.io is not "freeing the funds" quick enough after some order fills.
2024.10.29:
. New functions to get top ask and top bid prices.

View File

@ -490,12 +490,13 @@ class trader:
if balance_to_clean is None:
self.broker.logger.log_this("Can't fetch free base",1,self.pair)
return 1
balance_to_clean /= 2 #Maybe it's a good idea, sort of DCAing the dust.
#balance_to_clean /= 2 #Maybe it's a good idea, sort of DCAing the dust.
min_base_size = self.broker.get_min_base_size(self.pair)
if min_base_size is not None and balance_to_clean >= min_base_size:
self.broker.logger.log_this(f"Balance to clean: {balance_to_clean} {self.base}",2,self.pair)
minimum_cleanup_size = self.so["amount"]*2 # type: ignore
if balance_to_clean-minimum_cleanup_size >= min_base_size:
self.broker.logger.log_this(f"Balance to clean: {balance_to_clean-minimum_cleanup_size} {self.base}",2,self.pair)
self.broker.logger.log_this("Sending cleanup order...",2,self.pair)
cleanup_order = self.broker.new_limit_order(self.pair,balance_to_clean,"sell",self.take_profit_price)
cleanup_order = self.broker.new_limit_order(self.pair,balance_to_clean-minimum_cleanup_size,"sell",self.take_profit_price)
if cleanup_order not in [None,self.broker.get_empty_order()]:
self.broker.logger.log_this("Cleanup successful",2,self.pair)
return 0