Add typehint

This commit is contained in:
Matthias 2020-05-01 20:34:58 +02:00
parent 021e2b58ca
commit 78b3d8487f
2 changed files with 5 additions and 5 deletions

View File

@ -1172,7 +1172,7 @@ class FreqtradeBot:
if order_amount is None: if order_amount is None:
order_amount = order['amount'] order_amount = order['amount']
# Only run for closed orders # Only run for closed orders
if trade.fee_updated(order.get('side')) or order['status'] == 'open': if trade.fee_updated(order.get('side', '')) or order['status'] == 'open':
return order_amount return order_amount
trade_base_currency = self.exchange.get_pair_base_currency(trade.pair) trade_base_currency = self.exchange.get_pair_base_currency(trade.pair)
@ -1185,7 +1185,7 @@ class FreqtradeBot:
order_amount = order_amount - fee_cost order_amount = order_amount - fee_cost
logger.info(f"Applying fee on amount for {trade} (from {order['amount']} " logger.info(f"Applying fee on amount for {trade} (from {order['amount']} "
f"to {order_amount}) from Order") f"to {order_amount}) from Order")
trade.update_fee(fee_cost, fee_currency, fee_rate, order.get('side')) trade.update_fee(fee_cost, fee_currency, fee_rate, order.get('side', ''))
return order_amount return order_amount
return self.fee_detection_from_trades(trade, order, order_amount) return self.fee_detection_from_trades(trade, order, order_amount)
@ -1220,7 +1220,7 @@ class FreqtradeBot:
# fee_rate should use mean # fee_rate should use mean
fee_rate = sum(fee_rate_array) / float(len(fee_rate_array)) if fee_rate_array else None fee_rate = sum(fee_rate_array) / float(len(fee_rate_array)) if fee_rate_array else None
trade.update_fee(fee_cost, fee_currency, fee_rate, order.get('side')) trade.update_fee(fee_cost, fee_currency, fee_rate, order.get('side', ''))
if not isclose(amount, order_amount, abs_tol=constants.MATH_CLOSE_PREC): if not isclose(amount, order_amount, abs_tol=constants.MATH_CLOSE_PREC):
logger.warning(f"Amount {amount} does not match amount {trade.amount}") logger.warning(f"Amount {amount} does not match amount {trade.amount}")

View File

@ -377,7 +377,7 @@ class Trade(_DECL_BASE):
) )
def update_fee(self, fee_cost: float, fee_currency: Optional[str], fee_rate: Optional[float], def update_fee(self, fee_cost: float, fee_currency: Optional[str], fee_rate: Optional[float],
side) -> None: side: str) -> None:
""" """
Update Fee parameters. Only acts once per side Update Fee parameters. Only acts once per side
""" """
@ -394,7 +394,7 @@ class Trade(_DECL_BASE):
if fee_rate is not None: if fee_rate is not None:
self.fee_close = fee_rate self.fee_close = fee_rate
def fee_updated(self, side) -> bool: def fee_updated(self, side: str) -> bool:
""" """
Verify if this side (buy / sell) has already been updated Verify if this side (buy / sell) has already been updated
""" """