Revert allowing empty currency for futures

This commit is contained in:
Matthias 2022-07-09 08:57:15 +02:00
parent b7167ec880
commit c98e7ea055
2 changed files with 5 additions and 7 deletions

View File

@ -1616,7 +1616,8 @@ class Exchange:
except ccxt.BaseError as e: except ccxt.BaseError as e:
raise OperationalException(e) from e raise OperationalException(e) from e
def order_has_fee(self, order: Dict) -> bool: @staticmethod
def order_has_fee(order: Dict) -> bool:
""" """
Verifies if the passed in order dict has the needed keys to extract fees, Verifies if the passed in order dict has the needed keys to extract fees,
and that these keys (currency, cost) are not empty. and that these keys (currency, cost) are not empty.
@ -1627,8 +1628,7 @@ class Exchange:
return False return False
return ('fee' in order and order['fee'] is not None return ('fee' in order and order['fee'] is not None
and (order['fee'].keys() >= {'currency', 'cost'}) and (order['fee'].keys() >= {'currency', 'cost'})
and (order['fee']['currency'] is not None and order['fee']['currency'] is not None
or self.trading_mode == TradingMode.FUTURES)
and order['fee']['cost'] is not None and order['fee']['cost'] is not None
) )

View File

@ -3529,10 +3529,8 @@ def test_market_is_active(market, expected_result) -> None:
({'fee': {'currency': 'ETH/BTC', 'cost': None}}, False), ({'fee': {'currency': 'ETH/BTC', 'cost': None}}, False),
({'fee': {'currency': 'ETH/BTC', 'cost': 0.01}}, True), ({'fee': {'currency': 'ETH/BTC', 'cost': 0.01}}, True),
]) ])
def test_order_has_fee(mocker, default_conf, order, expected) -> None: def test_order_has_fee(order, expected) -> None:
ex = get_patched_exchange(mocker, default_conf) assert Exchange.order_has_fee(order) == expected
assert ex.order_has_fee(order) == expected
@pytest.mark.parametrize("order,expected", [ @pytest.mark.parametrize("order,expected", [