Fix crash when no min-stake-amount could be determined

This commit is contained in:
Matthias
2022-02-02 12:20:05 +01:00
parent 5aa683006c
commit 0058abcc2d
2 changed files with 5 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
import logging
from copy import deepcopy
from typing import Any, Dict, NamedTuple
from typing import Any, Dict, NamedTuple, Optional
import arrow
@@ -238,14 +238,15 @@ class Wallets:
return self._check_available_stake_amount(stake_amount, available_amount)
def validate_stake_amount(self, pair, stake_amount, min_stake_amount):
def validate_stake_amount(
self, pair: str, stake_amount: Optional[float], min_stake_amount: Optional[float]):
if not stake_amount:
logger.debug(f"Stake amount is {stake_amount}, ignoring possible trade for {pair}.")
return 0
max_stake_amount = self.get_available_stake_amount()
if min_stake_amount > max_stake_amount:
if min_stake_amount is not None and min_stake_amount > max_stake_amount:
if self._log:
logger.warning("Minimum stake amount > available balance.")
return 0