Merge pull request #2412 from freqtrade/align_utils
[minor] Use exchange.name instead of config['exchange']['name']
This commit is contained in:
commit
470efd6f40
@ -92,9 +92,9 @@ def start_download_data(args: Dict[str, Any]) -> None:
|
|||||||
|
|
||||||
pairs_not_available: List[str] = []
|
pairs_not_available: List[str] = []
|
||||||
|
|
||||||
try:
|
|
||||||
# Init exchange
|
# Init exchange
|
||||||
exchange = ExchangeResolver(config['exchange']['name'], config).exchange
|
exchange = ExchangeResolver(config['exchange']['name'], config).exchange
|
||||||
|
try:
|
||||||
|
|
||||||
if config.get('download_trades'):
|
if config.get('download_trades'):
|
||||||
pairs_not_available = refresh_backtest_trades_data(
|
pairs_not_available = refresh_backtest_trades_data(
|
||||||
@ -116,7 +116,7 @@ def start_download_data(args: Dict[str, Any]) -> None:
|
|||||||
finally:
|
finally:
|
||||||
if pairs_not_available:
|
if pairs_not_available:
|
||||||
logger.info(f"Pairs [{','.join(pairs_not_available)}] not available "
|
logger.info(f"Pairs [{','.join(pairs_not_available)}] not available "
|
||||||
f"on exchange {config['exchange']['name']}.")
|
f"on exchange {exchange.name}.")
|
||||||
|
|
||||||
|
|
||||||
def start_list_timeframes(args: Dict[str, Any]) -> None:
|
def start_list_timeframes(args: Dict[str, Any]) -> None:
|
||||||
@ -133,8 +133,8 @@ def start_list_timeframes(args: Dict[str, Any]) -> None:
|
|||||||
if args['print_one_column']:
|
if args['print_one_column']:
|
||||||
print('\n'.join(exchange.timeframes))
|
print('\n'.join(exchange.timeframes))
|
||||||
else:
|
else:
|
||||||
print(f"Timeframes available for the exchange `{config['exchange']['name']}`: "
|
print(f"Timeframes available for the exchange `{exchange.name}`: "
|
||||||
f"{', '.join(exchange.timeframes)}.")
|
f"{', '.join(exchange.timeframes)}")
|
||||||
|
|
||||||
|
|
||||||
def start_list_markets(args: Dict[str, Any], pairs_only: bool = False) -> None:
|
def start_list_markets(args: Dict[str, Any], pairs_only: bool = False) -> None:
|
||||||
|
@ -100,7 +100,7 @@ def test_list_timeframes(mocker, capsys):
|
|||||||
]
|
]
|
||||||
start_list_timeframes(get_args(args))
|
start_list_timeframes(get_args(args))
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert re.match("Timeframes available for the exchange `bittrex`: "
|
assert re.match("Timeframes available for the exchange `Bittrex`: "
|
||||||
"1m, 5m, 30m, 1h, 1d",
|
"1m, 5m, 30m, 1h, 1d",
|
||||||
captured.out)
|
captured.out)
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ def test_list_timeframes(mocker, capsys):
|
|||||||
]
|
]
|
||||||
start_list_timeframes(get_args(args))
|
start_list_timeframes(get_args(args))
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert re.match("Timeframes available for the exchange `bittrex`: "
|
assert re.match("Timeframes available for the exchange `Bittrex`: "
|
||||||
"1m, 5m, 30m, 1h, 1d",
|
"1m, 5m, 30m, 1h, 1d",
|
||||||
captured.out)
|
captured.out)
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ def test_list_timeframes(mocker, capsys):
|
|||||||
'1d': '1d',
|
'1d': '1d',
|
||||||
'3d': '3d',
|
'3d': '3d',
|
||||||
}
|
}
|
||||||
patch_exchange(mocker, api_mock=api_mock)
|
patch_exchange(mocker, api_mock=api_mock, id='binance')
|
||||||
# Test with --exchange binance
|
# Test with --exchange binance
|
||||||
args = [
|
args = [
|
||||||
"list-timeframes",
|
"list-timeframes",
|
||||||
@ -133,7 +133,7 @@ def test_list_timeframes(mocker, capsys):
|
|||||||
]
|
]
|
||||||
start_list_timeframes(get_args(args))
|
start_list_timeframes(get_args(args))
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
assert re.match("Timeframes available for the exchange `binance`: "
|
assert re.match("Timeframes available for the exchange `Binance`: "
|
||||||
"1m, 5m, 15m, 30m, 1h, 6h, 12h, 1d, 3d",
|
"1m, 5m, 15m, 30m, 1h, 6h, 12h, 1d, 3d",
|
||||||
captured.out)
|
captured.out)
|
||||||
|
|
||||||
@ -449,7 +449,7 @@ def test_download_data_keyboardInterrupt(mocker, caplog, markets):
|
|||||||
def test_download_data_no_markets(mocker, caplog):
|
def test_download_data_no_markets(mocker, caplog):
|
||||||
dl_mock = mocker.patch('freqtrade.utils.refresh_backtest_ohlcv_data',
|
dl_mock = mocker.patch('freqtrade.utils.refresh_backtest_ohlcv_data',
|
||||||
MagicMock(return_value=["ETH/BTC", "XRP/BTC"]))
|
MagicMock(return_value=["ETH/BTC", "XRP/BTC"]))
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker, id='binance')
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
'freqtrade.exchange.Exchange.markets', PropertyMock(return_value={})
|
'freqtrade.exchange.Exchange.markets', PropertyMock(return_value={})
|
||||||
)
|
)
|
||||||
@ -461,7 +461,7 @@ def test_download_data_no_markets(mocker, caplog):
|
|||||||
]
|
]
|
||||||
start_download_data(get_args(args))
|
start_download_data(get_args(args))
|
||||||
assert dl_mock.call_args[1]['timerange'].starttype == "date"
|
assert dl_mock.call_args[1]['timerange'].starttype == "date"
|
||||||
assert log_has("Pairs [ETH/BTC,XRP/BTC] not available on exchange binance.", caplog)
|
assert log_has("Pairs [ETH/BTC,XRP/BTC] not available on exchange Binance.", caplog)
|
||||||
|
|
||||||
|
|
||||||
def test_download_data_no_exchange(mocker, caplog):
|
def test_download_data_no_exchange(mocker, caplog):
|
||||||
|
Loading…
Reference in New Issue
Block a user