-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Closed
Labels
EnhancementEnhancements to the bot. Get lower priority than bugs by default.Enhancements to the bot. Get lower priority than bugs by default.PairlistIssues / PR's related to Pairlists / pairlist handlingIssues / PR's related to Pairlists / pairlist handling
Description
Describe the enhancement
Hey Guys I have written a delist filter for binance
https://binance-docs.github.io/apidocs/spot/en/#get-symbols-delist-schedule-for-spot-market_data
Not sure if it makes sense or if it actually will help but maybe you think about this and maybe this worthy to take into the mainline
It requires authentication so it might only run in not dry mode.
"""
Exchange Delist filter
"""
import logging
from typing import Any, Dict, List
import pandas as pd
from freqtrade.constants import Config
from freqtrade.exchange.types import Tickers
from freqtrade.persistence import Trade
from freqtrade.plugins.pairlist.IPairList import IPairList, PairlistParameter
logger = logging.getLogger(__name__)
class ExchangeDelistFilter(IPairList):
def __init__(self, exchange, pairlistmanager,
config: Config, pairlistconfig: Dict[str, Any],
pairlist_pos: int) -> None:
super().__init__(exchange, pairlistmanager, config, pairlistconfig, pairlist_pos)
self._refresh_period = self._pairlistconfig.get('refresh_period', 1800)
@property
def needstickers(self) -> bool:
"""
Boolean property defining if tickers are necessary.
If no Pairlist requires tickers, an empty List is passed
as tickers argument to filter_pairlist
"""
return False
def short_desc(self) -> str:
"""
Short allowlist method description - used for startup-messages
"""
return f"{self.name} - Removing Pairs when delisting."
@staticmethod
def description() -> str:
return "Filter pairs by performance."
@staticmethod
def available_parameters() -> Dict[str, PairlistParameter]:
return {
**IPairList.refresh_period_parameter(),
}
def filter_pairlist(self, pairlist: List[str], tickers: Tickers) -> List[str]:
"""
Filters and sorts pairlist and returns the allowlist again.
Called on each bot iteration - please use internal caching if necessary
:param pairlist: pairlist to filter or sort
:param tickers: Tickers (from exchange.get_tickers). May be cached.
:return: new allowlist
"""
# Get the trading performance for pairs from database
delistings = self._exchange._api.sapiGetSpotDelistSchedule()
delisted_pairs = set(sum([d['symbols'] for d in delistings], []))
for pair in pairlist:
pair_in_delisting_format = pair.replace('/', "")
if pair_in_delisting_format in delisted_pairs:
pairlist.remove(pair)
self.log_once(f"Removed {pair} from whitelist due to delisting", logger.info)
return pairlist
lythanh24denisdemaisbr, Durden-T, MrHumanRebel and lythanh24
Metadata
Metadata
Assignees
Labels
EnhancementEnhancements to the bot. Get lower priority than bugs by default.Enhancements to the bot. Get lower priority than bugs by default.PairlistIssues / PR's related to Pairlists / pairlist handlingIssues / PR's related to Pairlists / pairlist handling