Add name getting
This commit is contained in:
parent
31c7189b8b
commit
bf69b055eb
@ -57,7 +57,7 @@ class IPairList(ABC):
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def verify_blacklist(self, pairlist: List[str], blacklist: List[str]) -> List[str]:
|
||||
def verify_blacklist(pairlist: List[str], blacklist: List[str]) -> List[str]:
|
||||
"""
|
||||
Verify and remove items from pairlist - returning a filtered pairlist.
|
||||
"""
|
||||
|
@ -9,8 +9,8 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class LowPriceFilter(IPairList):
|
||||
|
||||
def __init__(self, exchange, config, pairlistconfig: dict) -> None:
|
||||
super().__init__(exchange, config, pairlistconfig)
|
||||
def __init__(self, exchange, pairlistmanager, config, pairlistconfig: dict) -> None:
|
||||
super().__init__(exchange, pairlistmanager, config, pairlistconfig)
|
||||
|
||||
self._low_price_percent = pairlistconfig.get('low_price_percent', 0)
|
||||
|
||||
|
@ -33,11 +33,10 @@ class PrecisionFilter(IPairList):
|
||||
(already cleaned to be 1 - stoploss)
|
||||
:return: True if the pair can stay, false if it should be removed
|
||||
"""
|
||||
stop_price = self._freqtrade.get_target_bid(ticker["symbol"], ticker) * stoploss
|
||||
stop_price = ticker['ask'] * stoploss
|
||||
# Adjust stop-prices to precision
|
||||
sp = self._freqtrade.exchange.symbol_price_prec(ticker["symbol"], stop_price)
|
||||
stop_gap_price = self._freqtrade.exchange.symbol_price_prec(ticker["symbol"],
|
||||
stop_price * 0.99)
|
||||
sp = self._exchange.symbol_price_prec(ticker["symbol"], stop_price)
|
||||
stop_gap_price = self._exchange.symbol_price_prec(ticker["symbol"], stop_price * 0.99)
|
||||
logger.debug(f"{ticker['symbol']} - {sp} : {stop_gap_price}")
|
||||
if sp <= stop_gap_price:
|
||||
logger.info(f"Removed {ticker['symbol']} from whitelist, "
|
||||
@ -49,9 +48,9 @@ class PrecisionFilter(IPairList):
|
||||
"""
|
||||
Filters and sorts pairlists and assigns and returns them again.
|
||||
"""
|
||||
if self._freqtrade.strategy.stoploss is not None:
|
||||
if self._config.get('stoploss') is not None:
|
||||
# Precalculate sanitized stoploss value to avoid recalculation for every pair
|
||||
stoploss = 1 - abs(self._freqtrade.strategy.stoploss)
|
||||
stoploss = 1 - abs(self._config.get('stoploss'))
|
||||
# Copy list since we're modifying this list
|
||||
for p in deepcopy(pairlist):
|
||||
ticker = [t for t in tickers if t['symbol'] == p][0]
|
||||
|
@ -14,8 +14,8 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class StaticPairList(IPairList):
|
||||
|
||||
def __init__(self, exchange, config, pairlistconfig: dict) -> None:
|
||||
super().__init__(exchange, config, pairlistconfig)
|
||||
def __init__(self, exchange, pairlistmanager, config, pairlistconfig: dict) -> None:
|
||||
super().__init__(exchange, pairlistmanager, config, pairlistconfig)
|
||||
|
||||
@property
|
||||
def needstickers(self) -> bool:
|
||||
|
@ -19,8 +19,8 @@ SORT_VALUES = ['askVolume', 'bidVolume', 'quoteVolume']
|
||||
|
||||
class VolumePairList(IPairList):
|
||||
|
||||
def __init__(self, exchange, config, pairlistconfig: dict) -> None:
|
||||
super().__init__(exchange, config, pairlistconfig)
|
||||
def __init__(self, exchange, pairlistmanager, config, pairlistconfig: dict) -> None:
|
||||
super().__init__(exchange, pairlistmanager, config, pairlistconfig)
|
||||
|
||||
if 'number_assets' not in self._pairlistconfig:
|
||||
raise OperationalException(
|
||||
|
@ -5,7 +5,7 @@ Provides lists as configured in config.json
|
||||
|
||||
"""
|
||||
import logging
|
||||
from typing import List
|
||||
from typing import Dict, List
|
||||
|
||||
from freqtrade.pairlist.IPairList import IPairList
|
||||
from freqtrade.resolvers import PairListResolver
|
||||
@ -44,6 +44,18 @@ class PairListManager():
|
||||
"""
|
||||
return self._blacklist
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
"""
|
||||
"""
|
||||
return str([p.name for p in self._pairlists])
|
||||
|
||||
def short_desc(self) -> List[Dict]:
|
||||
"""
|
||||
List of short_desc for each pairlist
|
||||
"""
|
||||
return [{p.name: p.short_desc()} for p in self._pairlists]
|
||||
|
||||
def refresh_pairlist(self) -> None:
|
||||
"""
|
||||
Run pairlist through all pairlists.
|
||||
@ -52,7 +64,7 @@ class PairListManager():
|
||||
pairlist = self._whitelist.copy()
|
||||
|
||||
# tickers should be cached to avoid calling the exchange on each call.
|
||||
tickers = []
|
||||
tickers: List[Dict] = []
|
||||
if self._tickers_needed:
|
||||
tickers = self._exchange.get_tickers()
|
||||
|
||||
|
@ -20,7 +20,8 @@ class PairListResolver(IResolver):
|
||||
|
||||
__slots__ = ['pairlist']
|
||||
|
||||
def __init__(self, pairlist_name: str, exchange, pairlistmanager, config: dict, pairlistconfig) -> None:
|
||||
def __init__(self, pairlist_name: str, exchange, pairlistmanager,
|
||||
config: dict, pairlistconfig) -> None:
|
||||
"""
|
||||
Load the custom class from config parameter
|
||||
:param config: configuration dictionary or None
|
||||
|
Loading…
Reference in New Issue
Block a user