Split out pairlist_commands
This commit is contained in:
parent
a3e9d04383
commit
2d02c3f2a4
@ -13,8 +13,8 @@ from freqtrade.commands.list_commands import (start_list_exchanges,
|
|||||||
start_list_timeframes)
|
start_list_timeframes)
|
||||||
from freqtrade.commands.optimize_commands import (start_backtesting,
|
from freqtrade.commands.optimize_commands import (start_backtesting,
|
||||||
start_edge, start_hyperopt)
|
start_edge, start_hyperopt)
|
||||||
|
from freqtrade.commands.pairlist_commands import start_test_pairlist
|
||||||
from freqtrade.commands.plot_commands import (start_plot_dataframe,
|
from freqtrade.commands.plot_commands import (start_plot_dataframe,
|
||||||
start_plot_profit)
|
start_plot_profit)
|
||||||
from freqtrade.commands.trade_commands import start_trading
|
from freqtrade.commands.trade_commands import start_trading
|
||||||
from freqtrade.commands.utils import (setup_utils_configuration,
|
from freqtrade.commands.utils import setup_utils_configuration
|
||||||
start_test_pairlist)
|
|
||||||
|
43
freqtrade/commands/pairlist_commands.py
Normal file
43
freqtrade/commands/pairlist_commands.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import logging
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
|
import rapidjson
|
||||||
|
|
||||||
|
from freqtrade.resolvers import ExchangeResolver
|
||||||
|
from freqtrade.state import RunMode
|
||||||
|
|
||||||
|
from .utils import setup_utils_configuration
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def start_test_pairlist(args: Dict[str, Any]) -> None:
|
||||||
|
"""
|
||||||
|
Test Pairlist configuration
|
||||||
|
"""
|
||||||
|
from freqtrade.pairlist.pairlistmanager import PairListManager
|
||||||
|
config = setup_utils_configuration(args, RunMode.UTIL_EXCHANGE)
|
||||||
|
|
||||||
|
exchange = ExchangeResolver.load_exchange(config['exchange']['name'], config, validate=False)
|
||||||
|
|
||||||
|
quote_currencies = args.get('quote_currencies')
|
||||||
|
if not quote_currencies:
|
||||||
|
quote_currencies = [config.get('stake_currency')]
|
||||||
|
results = {}
|
||||||
|
for curr in quote_currencies:
|
||||||
|
config['stake_currency'] = curr
|
||||||
|
# Do not use ticker_interval set in the config
|
||||||
|
pairlists = PairListManager(exchange, config)
|
||||||
|
pairlists.refresh_pairlist()
|
||||||
|
results[curr] = pairlists.whitelist
|
||||||
|
|
||||||
|
for curr, pairlist in results.items():
|
||||||
|
if not args.get('print_one_column', False):
|
||||||
|
print(f"Pairs for {curr}: ")
|
||||||
|
|
||||||
|
if args.get('print_one_column', False):
|
||||||
|
print('\n'.join(pairlist))
|
||||||
|
elif args.get('list_pairs_print_json', False):
|
||||||
|
print(rapidjson.dumps(list(pairlist), default=str))
|
||||||
|
else:
|
||||||
|
print(pairlist)
|
@ -1,11 +1,8 @@
|
|||||||
import logging
|
import logging
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
import rapidjson
|
|
||||||
|
|
||||||
from freqtrade.configuration import (Configuration, remove_credentials,
|
from freqtrade.configuration import (Configuration, remove_credentials,
|
||||||
validate_config_consistency)
|
validate_config_consistency)
|
||||||
from freqtrade.resolvers import ExchangeResolver
|
|
||||||
from freqtrade.state import RunMode
|
from freqtrade.state import RunMode
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -25,35 +22,3 @@ def setup_utils_configuration(args: Dict[str, Any], method: RunMode) -> Dict[str
|
|||||||
validate_config_consistency(config)
|
validate_config_consistency(config)
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
def start_test_pairlist(args: Dict[str, Any]) -> None:
|
|
||||||
"""
|
|
||||||
Test Pairlist configuration
|
|
||||||
"""
|
|
||||||
from freqtrade.pairlist.pairlistmanager import PairListManager
|
|
||||||
config = setup_utils_configuration(args, RunMode.UTIL_EXCHANGE)
|
|
||||||
|
|
||||||
exchange = ExchangeResolver.load_exchange(config['exchange']['name'], config, validate=False)
|
|
||||||
|
|
||||||
quote_currencies = args.get('quote_currencies')
|
|
||||||
if not quote_currencies:
|
|
||||||
quote_currencies = [config.get('stake_currency')]
|
|
||||||
results = {}
|
|
||||||
for curr in quote_currencies:
|
|
||||||
config['stake_currency'] = curr
|
|
||||||
# Do not use ticker_interval set in the config
|
|
||||||
pairlists = PairListManager(exchange, config)
|
|
||||||
pairlists.refresh_pairlist()
|
|
||||||
results[curr] = pairlists.whitelist
|
|
||||||
|
|
||||||
for curr, pairlist in results.items():
|
|
||||||
if not args.get('print_one_column', False):
|
|
||||||
print(f"Pairs for {curr}: ")
|
|
||||||
|
|
||||||
if args.get('print_one_column', False):
|
|
||||||
print('\n'.join(pairlist))
|
|
||||||
elif args.get('list_pairs_print_json', False):
|
|
||||||
print(rapidjson.dumps(list(pairlist), default=str))
|
|
||||||
else:
|
|
||||||
print(pairlist)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user