Return empty string if no quote / base currency can be found
This commit is contained in:
parent
4e218be51d
commit
f38accb77b
@ -232,13 +232,13 @@ class Exchange:
|
|||||||
"""
|
"""
|
||||||
Return a pair's quote currency
|
Return a pair's quote currency
|
||||||
"""
|
"""
|
||||||
return self.markets.get(pair, {}).get('quote')
|
return self.markets.get(pair, {}).get('quote', '')
|
||||||
|
|
||||||
def get_pair_base_currency(self, pair: str) -> str:
|
def get_pair_base_currency(self, pair: str) -> str:
|
||||||
"""
|
"""
|
||||||
Return a pair's quote currency
|
Return a pair's quote currency
|
||||||
"""
|
"""
|
||||||
return self.markets.get(pair, {}).get('base')
|
return self.markets.get(pair, {}).get('base', '')
|
||||||
|
|
||||||
def klines(self, pair_interval: Tuple[str, str], copy: bool = True) -> DataFrame:
|
def klines(self, pair_interval: Tuple[str, str], copy: bool = True) -> DataFrame:
|
||||||
if pair_interval in self._klines:
|
if pair_interval in self._klines:
|
||||||
|
@ -408,6 +408,7 @@ def test_get_quote_currencies(default_conf, mocker):
|
|||||||
('LTC/USD', 'USD'),
|
('LTC/USD', 'USD'),
|
||||||
('ETH/USDT', 'USDT'),
|
('ETH/USDT', 'USDT'),
|
||||||
('XLTCUSDT', 'USDT'),
|
('XLTCUSDT', 'USDT'),
|
||||||
|
('XRP/NOCURRENCY', ''),
|
||||||
])
|
])
|
||||||
def test_get_pair_quote_currency(default_conf, mocker, pair, expected):
|
def test_get_pair_quote_currency(default_conf, mocker, pair, expected):
|
||||||
ex = get_patched_exchange(mocker, default_conf)
|
ex = get_patched_exchange(mocker, default_conf)
|
||||||
@ -419,6 +420,7 @@ def test_get_pair_quote_currency(default_conf, mocker, pair, expected):
|
|||||||
('LTC/USD', 'LTC'),
|
('LTC/USD', 'LTC'),
|
||||||
('ETH/USDT', 'ETH'),
|
('ETH/USDT', 'ETH'),
|
||||||
('XLTCUSDT', 'LTC'),
|
('XLTCUSDT', 'LTC'),
|
||||||
|
('XRP/NOCURRENCY', ''),
|
||||||
])
|
])
|
||||||
def test_get_pair_base_currency(default_conf, mocker, pair, expected):
|
def test_get_pair_base_currency(default_conf, mocker, pair, expected):
|
||||||
ex = get_patched_exchange(mocker, default_conf)
|
ex = get_patched_exchange(mocker, default_conf)
|
||||||
|
Loading…
Reference in New Issue
Block a user