From 8c0c2496c279cc13a792cd03ff4691f6f78fc988 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 7 Feb 2023 07:13:01 +0100 Subject: [PATCH] Temporarily disable gate advanced stop orders --- freqtrade/exchange/gateio.py | 15 +++++++++------ tests/exchange/test_exchange.py | 6 +++--- tests/exchange/test_gateio.py | 4 ++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/freqtrade/exchange/gateio.py b/freqtrade/exchange/gateio.py index cc7e47cca..8960e163d 100644 --- a/freqtrade/exchange/gateio.py +++ b/freqtrade/exchange/gateio.py @@ -34,12 +34,13 @@ class Gateio(Exchange): "needs_trading_fees": True, "fee_cost_in_contracts": False, # Set explicitly to false for clarity "order_props_in_contracts": ['amount', 'filled', 'remaining'], - "stop_price_type_field": "price_type", - "stop_price_type_value_mapping": { - PriceType.LAST: 0, - PriceType.MARK: 1, - PriceType.INDEX: 2, - }, + # TODO: Reenable once https://github.com/ccxt/ccxt/issues/16749 is available + # "stop_price_type_field": "price_type", + # "stop_price_type_value_mapping": { + # PriceType.LAST: 0, + # PriceType.MARK: 1, + # PriceType.INDEX: 2, + # }, } _supported_trading_mode_margin_pairs: List[Tuple[TradingMode, MarginMode]] = [ @@ -55,6 +56,8 @@ class Gateio(Exchange): if any(v == 'market' for k, v in order_types.items()): raise OperationalException( f'Exchange {self.name} does not support market orders.') + else: + super().validate_ordertypes(order_types) def _get_params( self, diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index dfa807b95..90341142a 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -1070,9 +1070,9 @@ def test_validate_ordertypes(default_conf, mocker): # ('okx', 'last', True), # ('okx', 'mark', True), # ('okx', 'index', True), - ('gate', 'last', True), - ('gate', 'mark', True), - ('gate', 'index', True), + ('gate', 'last', False), + ('gate', 'mark', False), + ('gate', 'index', False), ]) def test_validate_ordertypes_stop_advanced(default_conf, mocker, exchange_name, stopadv, expected): diff --git a/tests/exchange/test_gateio.py b/tests/exchange/test_gateio.py index dabdbba65..9802063e8 100644 --- a/tests/exchange/test_gateio.py +++ b/tests/exchange/test_gateio.py @@ -18,8 +18,8 @@ def test_validate_order_types_gateio(default_conf, mocker): mocker.patch('freqtrade.exchange.Exchange.validate_timeframes') mocker.patch('freqtrade.exchange.Exchange.validate_stakecurrency') mocker.patch('freqtrade.exchange.Exchange.validate_pricing') - mocker.patch('freqtrade.exchange.Exchange.name', 'Bittrex') - exch = ExchangeResolver.load_exchange('gateio', default_conf, True) + mocker.patch('freqtrade.exchange.Exchange.name', 'Gate') + exch = ExchangeResolver.load_exchange('gate', default_conf, True) assert isinstance(exch, Gateio) default_conf['order_types'] = {