freqtrade_origin/freqtrade/resolvers/pairlist_resolver.py

44 lines
1.7 KiB
Python
Raw Normal View History

2018-12-05 19:44:56 +00:00
# pragma pylint: disable=attribute-defined-outside-init
"""
This module load custom pairlists
2018-12-05 19:44:56 +00:00
"""
import logging
from pathlib import Path
from freqtrade.pairlist.IPairList import IPairList
from freqtrade.resolvers import IResolver
logger = logging.getLogger(__name__)
class PairListResolver(IResolver):
"""
This class contains all the logic to load custom PairList class
2018-12-05 19:44:56 +00:00
"""
2019-12-24 12:34:37 +00:00
object_type = IPairList
2019-12-24 12:54:46 +00:00
object_type_str = "Pairlist"
user_subdir = None
initial_search_path = Path(__file__).parent.parent.joinpath('pairlist').resolve()
2018-12-05 19:44:56 +00:00
@staticmethod
def load_pairlist(pairlist_name: str, exchange, pairlistmanager,
config: dict, pairlistconfig: dict, pairlist_pos: int) -> IPairList:
2018-12-05 19:44:56 +00:00
"""
Load the pairlist with pairlist_name
:param pairlist_name: Classname of the pairlist
:param exchange: Initialized exchange class
:param pairlistmanager: Initialized pairlist manager
:param config: configuration dictionary
:param pairlistconfig: Configuration dedicated to this pairlist
:param pairlist_pos: Position of the pairlist in the list of pairlists
:return: initialized Pairlist class
2018-12-05 19:44:56 +00:00
"""
2019-12-24 12:54:46 +00:00
return PairListResolver.load_object(pairlist_name, config,
kwargs={'exchange': exchange,
'pairlistmanager': pairlistmanager,
'config': config,
'pairlistconfig': pairlistconfig,
'pairlist_pos': pairlist_pos},
)