Use prohibitedIn instead of isRestricted

This commit is contained in:
Matthias 2021-07-29 06:56:37 +02:00
parent 06e7f379b3
commit cf4d1875dd
3 changed files with 5 additions and 4 deletions

View File

@ -77,8 +77,9 @@ You can get a list of restricted markets by using the following snippet:
``` python ``` python
import ccxt import ccxt
ct = ccxt.bittrex() ct = ccxt.bittrex()
ct.load_markets() lm = ct.load_markets()
res = [f"{x['quoteCurrencySymbol']}/{x['baseCurrencySymbol']}" for x in ct.publicGetMarkets() if 'US' in x['prohibitedIn']]
res = [p for p, x in lm.items() if 'US' in x['info']['prohibitedIn']]
print(res) print(res)
``` ```

View File

@ -387,7 +387,7 @@ class Exchange:
# its contents depend on the exchange. # its contents depend on the exchange.
# It can also be a string or similar ... so we need to verify that first. # It can also be a string or similar ... so we need to verify that first.
elif (isinstance(self.markets[pair].get('info', None), dict) elif (isinstance(self.markets[pair].get('info', None), dict)
and self.markets[pair].get('info', {}).get('IsRestricted', False)): and self.markets[pair].get('info', {}).get('prohibitedIn', False)):
# Warn users about restricted pairs in whitelist. # Warn users about restricted pairs in whitelist.
# We cannot determine reliably if Users are affected. # We cannot determine reliably if Users are affected.
logger.warning(f"Pair {pair} is restricted for some users on this exchange." logger.warning(f"Pair {pair} is restricted for some users on this exchange."

View File

@ -673,7 +673,7 @@ def test_validate_pairs_restricted(default_conf, mocker, caplog):
api_mock = MagicMock() api_mock = MagicMock()
type(api_mock).load_markets = MagicMock(return_value={ type(api_mock).load_markets = MagicMock(return_value={
'ETH/BTC': {'quote': 'BTC'}, 'LTC/BTC': {'quote': 'BTC'}, 'ETH/BTC': {'quote': 'BTC'}, 'LTC/BTC': {'quote': 'BTC'},
'XRP/BTC': {'quote': 'BTC', 'info': {'IsRestricted': True}}, 'XRP/BTC': {'quote': 'BTC', 'info': {'prohibitedIn': ['US']}},
'NEO/BTC': {'quote': 'BTC', 'info': 'TestString'}, # info can also be a string ... 'NEO/BTC': {'quote': 'BTC', 'info': 'TestString'}, # info can also be a string ...
}) })
mocker.patch('freqtrade.exchange.Exchange._init_ccxt', MagicMock(return_value=api_mock)) mocker.patch('freqtrade.exchange.Exchange._init_ccxt', MagicMock(return_value=api_mock))