Skip to content

Commit

Permalink
Apparently originaly intended to sleep for 1s after each attempt, but…
Browse files Browse the repository at this point in the history
… instead we slept unconditionally for 1s before making an order and did each attempt without further waiting. This should resolve some issues with 'sell price become lower' frequent messages
  • Loading branch information
MasaiasuOse authored and edeng23 committed Feb 14, 2022
1 parent 56a50e3 commit e3b8931
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions binance_trade_bot/binance_api_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,14 @@ def get_currency_balance(self, currency_symbol: str, force=False) -> float:
return balance

def retry(self, func, *args, **kwargs):
time.sleep(1)
attempts = 0
while attempts < 20:
for attempt in range(20):
try:
return func(*args, **kwargs)
except Exception: # pylint: disable=broad-except
self.logger.warning(f"Failed to Buy/Sell. Trying Again (attempt {attempts}/20)")
if attempts == 0:
self.logger.warning(f"Failed to Buy/Sell. Trying Again (attempt {attempt}/20)")
if attempt == 0:
self.logger.warning(traceback.format_exc())
attempts += 1
time.sleep(1)
return None

def get_symbol_filter(self, origin_symbol: str, target_symbol: str, filter_type: str):
Expand Down

0 comments on commit e3b8931

Please sign in to comment.