Skip to content

Commit

Permalink
Add traceback logging in retry
Browse files Browse the repository at this point in the history
There is obscure occasional error with buy/sell orders,
that has too little logging information.
  • Loading branch information
idkravitz authored and edeng23 committed Jun 8, 2021
1 parent c0d6f53 commit 05279db
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions binance_trade_bot/binance_api_manager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import math
import time
import traceback
from typing import Dict, Optional

from binance.client import Client
Expand Down Expand Up @@ -116,10 +117,10 @@ def retry(self, func, *args, **kwargs):
while attempts < 20:
try:
return func(*args, **kwargs)
except Exception as e: # pylint: disable=broad-except
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(e)
self.logger.warning(traceback.format_exc())
attempts += 1
return None

Expand Down

0 comments on commit 05279db

Please sign in to comment.