Merge pull request #7068 from freqtrade/ccxt_ordertype_validations

Ccxt ordertype validations
This commit is contained in:
Matthias
2022-07-11 19:41:05 +02:00
committed by GitHub
5 changed files with 28 additions and 13 deletions

View File

@@ -73,7 +73,7 @@ EXCHANGE_HAS_REQUIRED = [
EXCHANGE_HAS_OPTIONAL = [
# Private
'fetchMyTrades', # Trades for order - fee detection
# 'createLimitOrder', 'createMarketOrder', # Either OR for orders
'createLimitOrder', 'createMarketOrder', # Either OR for orders
# 'setLeverage', # Margin/Futures trading
# 'setMarginMode', # Margin/Futures trading
# 'fetchFundingHistory', # Futures trading

View File

@@ -586,13 +586,10 @@ class Exchange:
"""
Checks if order-types configured in strategy/config are supported
"""
# TODO: Reenable once ccxt fixes createMarketOrder assignment - as well as
# Revert the change in test_validate_ordertypes.
# if any(v == 'market' for k, v in order_types.items()):
# if not self.exchange_has('createMarketOrder'):
# raise OperationalException(
# f'Exchange {self.name} does not support market orders.')
if any(v == 'market' for k, v in order_types.items()):
if not self.exchange_has('createMarketOrder'):
raise OperationalException(
f'Exchange {self.name} does not support market orders.')
if (order_types.get("stoploss_on_exchange")
and not self._ft_has.get("stoploss_on_exchange", False)):