optimize to only do network calls if necessary

This commit is contained in:
Matthias Voppichler 2018-04-22 19:37:24 +02:00
parent a70958da41
commit 93a7c46977
1 changed files with 8 additions and 7 deletions

View File

@ -368,13 +368,14 @@ class FreqtradeBot(object):
# TODO: correct place here ??
# Try update amount (binance-fix)
try:
new_amount = self.get_real_amount(trade)
# This may break if a exchange applies no fee (which appears highly unlikely)
if order['amount'] != new_amount and trade.fee_open != 0:
logger.info("Updating amount for Trade {} from {} to {}".format(
trade, order['amount'], new_amount))
order['amount'] = new_amount
trade.fee_open = 0
if trade.fee_open != 0:
new_amount = self.get_real_amount(trade)
# This may break if a exchange applies no fee (which appears highly unlikely)
if order['amount'] != new_amount:
logger.info("Updating amount for Trade {} from {} to {}".format(
trade, order['amount'], new_amount))
order['amount'] = new_amount
trade.fee_open = 0
except OperationalException as exception:
logger.warning("could not update trade amount: %s", exception)