2020-01-26 12:43:30 +00:00
|
|
|
import logging
|
2024-10-04 04:37:49 +00:00
|
|
|
from typing import Any
|
2020-01-26 12:43:30 +00:00
|
|
|
|
|
|
|
import rapidjson
|
|
|
|
|
2021-06-08 19:20:35 +00:00
|
|
|
from freqtrade.enums import RunMode
|
2020-01-26 12:43:30 +00:00
|
|
|
|
2020-09-28 17:39:41 +00:00
|
|
|
|
2020-01-26 12:43:30 +00:00
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
2024-10-04 04:37:49 +00:00
|
|
|
def start_test_pairlist(args: dict[str, Any]) -> None:
|
2020-01-26 12:43:30 +00:00
|
|
|
"""
|
|
|
|
Test Pairlist configuration
|
|
|
|
"""
|
2024-10-03 03:33:52 +00:00
|
|
|
from freqtrade.configuration import setup_utils_configuration
|
2024-01-10 19:08:23 +00:00
|
|
|
from freqtrade.persistence import FtNoDBContext
|
2020-12-23 15:54:35 +00:00
|
|
|
from freqtrade.plugins.pairlistmanager import PairListManager
|
2024-10-03 03:33:52 +00:00
|
|
|
from freqtrade.resolvers import ExchangeResolver
|
2024-05-12 14:27:03 +00:00
|
|
|
|
2020-01-26 12:43:30 +00:00
|
|
|
config = setup_utils_configuration(args, RunMode.UTIL_EXCHANGE)
|
|
|
|
|
2023-05-13 06:27:27 +00:00
|
|
|
exchange = ExchangeResolver.load_exchange(config, validate=False)
|
2020-01-26 12:43:30 +00:00
|
|
|
|
2024-05-12 14:27:03 +00:00
|
|
|
quote_currencies = args.get("quote_currencies")
|
2020-01-26 12:43:30 +00:00
|
|
|
if not quote_currencies:
|
2024-05-12 14:27:03 +00:00
|
|
|
quote_currencies = [config.get("stake_currency")]
|
2020-01-26 12:43:30 +00:00
|
|
|
results = {}
|
2024-01-10 19:08:23 +00:00
|
|
|
with FtNoDBContext():
|
|
|
|
for curr in quote_currencies:
|
2024-05-12 14:27:03 +00:00
|
|
|
config["stake_currency"] = curr
|
2024-01-10 19:08:23 +00:00
|
|
|
pairlists = PairListManager(exchange, config)
|
|
|
|
pairlists.refresh_pairlist()
|
|
|
|
results[curr] = pairlists.whitelist
|
2020-01-26 12:43:30 +00:00
|
|
|
|
|
|
|
for curr, pairlist in results.items():
|
2024-05-12 14:27:03 +00:00
|
|
|
if not args.get("print_one_column", False) and not args.get("list_pairs_print_json", False):
|
2020-01-26 12:43:30 +00:00
|
|
|
print(f"Pairs for {curr}: ")
|
|
|
|
|
2024-05-12 14:27:03 +00:00
|
|
|
if args.get("print_one_column", False):
|
|
|
|
print("\n".join(pairlist))
|
|
|
|
elif args.get("list_pairs_print_json", False):
|
2020-01-26 12:43:30 +00:00
|
|
|
print(rapidjson.dumps(list(pairlist), default=str))
|
|
|
|
else:
|
|
|
|
print(pairlist)
|