2021-10-03 12:14:16 +00:00
|
|
|
import pytest
|
|
|
|
|
2022-02-12 21:55:26 +00:00
|
|
|
from freqtrade.exceptions import OperationalException
|
2021-10-03 12:14:16 +00:00
|
|
|
from freqtrade.exchange import Gateio
|
|
|
|
from freqtrade.resolvers.exchange_resolver import ExchangeResolver
|
|
|
|
|
|
|
|
|
|
|
|
def test_validate_order_types_gateio(default_conf, mocker):
|
|
|
|
default_conf['exchange']['name'] = 'gateio'
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange._init_ccxt')
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange._load_markets', return_value={})
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.validate_pairs')
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.validate_timeframes')
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.validate_stakecurrency')
|
|
|
|
mocker.patch('freqtrade.exchange.Exchange.name', 'Bittrex')
|
|
|
|
exch = ExchangeResolver.load_exchange('gateio', default_conf, True)
|
|
|
|
assert isinstance(exch, Gateio)
|
|
|
|
|
|
|
|
default_conf['order_types'] = {
|
2022-03-09 06:39:32 +00:00
|
|
|
'entry': 'market',
|
|
|
|
'exit': 'limit',
|
2021-10-03 12:14:16 +00:00
|
|
|
'stoploss': 'market',
|
|
|
|
'stoploss_on_exchange': False
|
|
|
|
}
|
|
|
|
|
|
|
|
with pytest.raises(OperationalException,
|
|
|
|
match=r'Exchange .* does not support market orders.'):
|
|
|
|
ExchangeResolver.load_exchange('gateio', default_conf, True)
|