Rename start_list_pairs() -> start_list_markets()

This commit is contained in:
hroff-1902 2019-10-18 01:26:05 +03:00
parent 369335b80c
commit e957894852
3 changed files with 20 additions and 20 deletions

View File

@ -112,7 +112,7 @@ class Arguments:
from freqtrade.optimize import start_backtesting, start_hyperopt, start_edge from freqtrade.optimize import start_backtesting, start_hyperopt, start_edge
from freqtrade.utils import (start_create_userdir, start_download_data, from freqtrade.utils import (start_create_userdir, start_download_data,
start_list_exchanges, start_list_timeframes, start_list_exchanges, start_list_timeframes,
start_list_pairs) start_list_markets)
subparsers = self.parser.add_subparsers(dest='subparser') subparsers = self.parser.add_subparsers(dest='subparser')
@ -158,7 +158,7 @@ class Arguments:
'list-markets', 'list-markets',
help='Print markets on exchange.' help='Print markets on exchange.'
) )
list_markets_cmd.set_defaults(func=partial(start_list_pairs, pairs_only=False)) list_markets_cmd.set_defaults(func=partial(start_list_markets, pairs_only=False))
self._build_args(optionlist=ARGS_LIST_PAIRS, parser=list_markets_cmd) self._build_args(optionlist=ARGS_LIST_PAIRS, parser=list_markets_cmd)
# Add list-pairs subcommand # Add list-pairs subcommand
@ -166,7 +166,7 @@ class Arguments:
'list-pairs', 'list-pairs',
help='Print pairs on exchange.' help='Print pairs on exchange.'
) )
list_pairs_cmd.set_defaults(func=partial(start_list_pairs, pairs_only=True)) list_pairs_cmd.set_defaults(func=partial(start_list_markets, pairs_only=True))
self._build_args(optionlist=ARGS_LIST_PAIRS, parser=list_pairs_cmd) self._build_args(optionlist=ARGS_LIST_PAIRS, parser=list_pairs_cmd)
# Add download-data subcommand # Add download-data subcommand

View File

@ -125,9 +125,9 @@ def start_list_timeframes(args: Dict[str, Any]) -> None:
f"{', '.join(exchange.timeframes)}.") f"{', '.join(exchange.timeframes)}.")
def start_list_pairs(args: Dict[str, Any], pairs_only: bool = False) -> None: def start_list_markets(args: Dict[str, Any], pairs_only: bool = False) -> None:
""" """
Print pairs on the exchange Print pairs/markets on the exchange
:param args: Cli args from Arguments() :param args: Cli args from Arguments()
:param pairs_only: if True print only pairs, otherwise print all instruments (markets) :param pairs_only: if True print only pairs, otherwise print all instruments (markets)
:return: None :return: None

View File

@ -8,7 +8,7 @@ from freqtrade import OperationalException
from freqtrade.state import RunMode from freqtrade.state import RunMode
from freqtrade.utils import (setup_utils_configuration, start_create_userdir, from freqtrade.utils import (setup_utils_configuration, start_create_userdir,
start_download_data, start_list_exchanges, start_download_data, start_list_exchanges,
start_list_pairs, start_list_timeframes) start_list_markets, start_list_timeframes)
from tests.conftest import get_args, log_has, patch_exchange from tests.conftest import get_args, log_has, patch_exchange
@ -176,14 +176,14 @@ def test_list_markets(mocker, markets, capsys):
] ]
with pytest.raises(OperationalException, with pytest.raises(OperationalException,
match=r"This command requires a configured exchange.*"): match=r"This command requires a configured exchange.*"):
start_list_pairs(get_args(args), False) start_list_markets(get_args(args), False)
# Test with --config config.json.example # Test with --config config.json.example
args = [ args = [
'--config', 'config.json.example', '--config', 'config.json.example',
"list-markets", "list-markets",
] ]
start_list_pairs(get_args(args), False) start_list_markets(get_args(args), False)
captured = capsys.readouterr() captured = capsys.readouterr()
assert re.match("Exchange Bittrex has 8 active markets:\n", assert re.match("Exchange Bittrex has 8 active markets:\n",
captured.out) captured.out)
@ -193,7 +193,7 @@ def test_list_markets(mocker, markets, capsys):
# "list-markets", # "list-markets",
# "--exchange", "binance" # "--exchange", "binance"
# ] # ]
# start_list_pairs(get_args(args), False) # start_list_markets(get_args(args), False)
# captured = capsys.readouterr() # captured = capsys.readouterr()
# assert re.match("Exchange Binance has 8 active markets:\n", # assert re.match("Exchange Binance has 8 active markets:\n",
# captured.out) # captured.out)
@ -203,7 +203,7 @@ def test_list_markets(mocker, markets, capsys):
'--config', 'config.json.example', '--config', 'config.json.example',
"list-markets", "--all" "list-markets", "--all"
] ]
start_list_pairs(get_args(args), False) start_list_markets(get_args(args), False)
captured = capsys.readouterr() captured = capsys.readouterr()
assert re.match("Exchange Bittrex has 11 markets:\n", assert re.match("Exchange Bittrex has 11 markets:\n",
captured.out) captured.out)
@ -213,7 +213,7 @@ def test_list_markets(mocker, markets, capsys):
'--config', 'config.json.example', '--config', 'config.json.example',
"list-pairs", "list-pairs",
] ]
start_list_pairs(get_args(args), True) start_list_markets(get_args(args), True)
captured = capsys.readouterr() captured = capsys.readouterr()
assert re.match("Exchange Bittrex has 7 active pairs:\n", assert re.match("Exchange Bittrex has 7 active pairs:\n",
captured.out) captured.out)
@ -223,7 +223,7 @@ def test_list_markets(mocker, markets, capsys):
'--config', 'config.json.example', '--config', 'config.json.example',
"list-pairs", "--all" "list-pairs", "--all"
] ]
start_list_pairs(get_args(args), True) start_list_markets(get_args(args), True)
captured = capsys.readouterr() captured = capsys.readouterr()
assert re.match("Exchange Bittrex has 10 pairs:\n", assert re.match("Exchange Bittrex has 10 pairs:\n",
captured.out) captured.out)
@ -234,7 +234,7 @@ def test_list_markets(mocker, markets, capsys):
"list-markets", "list-markets",
"--base", "ETH", "LTC" "--base", "ETH", "LTC"
] ]
start_list_pairs(get_args(args), False) start_list_markets(get_args(args), False)
captured = capsys.readouterr() captured = capsys.readouterr()
assert re.match("Exchange Bittrex has 5 active markets with ETH, LTC as base currencies:\n", assert re.match("Exchange Bittrex has 5 active markets with ETH, LTC as base currencies:\n",
captured.out) captured.out)
@ -245,7 +245,7 @@ def test_list_markets(mocker, markets, capsys):
"list-markets", "list-markets",
"--base", "LTC" "--base", "LTC"
] ]
start_list_pairs(get_args(args), False) start_list_markets(get_args(args), False)
captured = capsys.readouterr() captured = capsys.readouterr()
assert re.match("Exchange Bittrex has 3 active markets with LTC as base currency:\n", assert re.match("Exchange Bittrex has 3 active markets with LTC as base currency:\n",
captured.out) captured.out)
@ -256,7 +256,7 @@ def test_list_markets(mocker, markets, capsys):
"list-markets", "list-markets",
"--quote", "USDT", "USD" "--quote", "USDT", "USD"
] ]
start_list_pairs(get_args(args), False) start_list_markets(get_args(args), False)
captured = capsys.readouterr() captured = capsys.readouterr()
assert re.match("Exchange Bittrex has 4 active markets with USDT, USD as quote currencies:\n", assert re.match("Exchange Bittrex has 4 active markets with USDT, USD as quote currencies:\n",
captured.out) captured.out)
@ -267,7 +267,7 @@ def test_list_markets(mocker, markets, capsys):
"list-markets", "list-markets",
"--quote", "USDT" "--quote", "USDT"
] ]
start_list_pairs(get_args(args), False) start_list_markets(get_args(args), False)
captured = capsys.readouterr() captured = capsys.readouterr()
assert re.match("Exchange Bittrex has 3 active markets with USDT as quote currency:\n", assert re.match("Exchange Bittrex has 3 active markets with USDT as quote currency:\n",
captured.out) captured.out)
@ -278,7 +278,7 @@ def test_list_markets(mocker, markets, capsys):
"list-markets", "list-markets",
"--base", "LTC", "--quote", "USDT" "--base", "LTC", "--quote", "USDT"
] ]
start_list_pairs(get_args(args), False) start_list_markets(get_args(args), False)
captured = capsys.readouterr() captured = capsys.readouterr()
assert re.match("Exchange Bittrex has 2 active markets with LTC as base currency and " assert re.match("Exchange Bittrex has 2 active markets with LTC as base currency and "
"with USDT as quote currency:\n", "with USDT as quote currency:\n",
@ -290,7 +290,7 @@ def test_list_markets(mocker, markets, capsys):
"list-pairs", "list-pairs",
"--base", "LTC", "--quote", "USDT" "--base", "LTC", "--quote", "USDT"
] ]
start_list_pairs(get_args(args), True) start_list_markets(get_args(args), True)
captured = capsys.readouterr() captured = capsys.readouterr()
assert re.match("Exchange Bittrex has 1 active pair with LTC as base currency and " assert re.match("Exchange Bittrex has 1 active pair with LTC as base currency and "
"with USDT as quote currency:\n", "with USDT as quote currency:\n",
@ -302,7 +302,7 @@ def test_list_markets(mocker, markets, capsys):
"list-markets", "list-markets",
"--base", "LTC", "--quote", "USDT", "NONEXISTENT" "--base", "LTC", "--quote", "USDT", "NONEXISTENT"
] ]
start_list_pairs(get_args(args), False) start_list_markets(get_args(args), False)
captured = capsys.readouterr() captured = capsys.readouterr()
assert re.match("Exchange Bittrex has 2 active markets with LTC as base currency and " assert re.match("Exchange Bittrex has 2 active markets with LTC as base currency and "
"with USDT, NONEXISTENT as quote currencies:\n", "with USDT, NONEXISTENT as quote currencies:\n",
@ -314,7 +314,7 @@ def test_list_markets(mocker, markets, capsys):
"list-markets", "list-markets",
"--base", "LTC", "--quote", "NONEXISTENT" "--base", "LTC", "--quote", "NONEXISTENT"
] ]
start_list_pairs(get_args(args), False) start_list_markets(get_args(args), False)
captured = capsys.readouterr() captured = capsys.readouterr()
assert re.match("Exchange Bittrex has 0 active markets with LTC as base currency and " assert re.match("Exchange Bittrex has 0 active markets with LTC as base currency and "
"with NONEXISTENT as quote currency.\n", "with NONEXISTENT as quote currency.\n",