Switch performanceFilter to use Minutes lookback resolution
closes #5060
This commit is contained in:
parent
12c12d42df
commit
564e0b9a1a
@ -191,7 +191,7 @@ Sorts pairs by past trade performance, as follows:
|
||||
|
||||
Trade count is used as a tie breaker.
|
||||
|
||||
You can use the `days` parameter to only consider performance of the past X days.
|
||||
You can use the `minutes` parameter to only consider performance of the past X minutes (rolling window).
|
||||
Not defining this parameter (or setting it to 0) will use all-time performance.
|
||||
|
||||
```json
|
||||
@ -199,7 +199,7 @@ Not defining this parameter (or setting it to 0) will use all-time performance.
|
||||
// ...
|
||||
{
|
||||
"method": "PerformanceFilter",
|
||||
"days": 10
|
||||
"minutes": 1440 // rolling 24h
|
||||
}
|
||||
],
|
||||
```
|
||||
|
@ -832,14 +832,14 @@ class Trade(_DECL_BASE, LocalTrade):
|
||||
return total_open_stake_amount or 0
|
||||
|
||||
@staticmethod
|
||||
def get_overall_performance(days=None) -> List[Dict[str, Any]]:
|
||||
def get_overall_performance(minutes=None) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
Returns List of dicts containing all Trades, including profit and trade count
|
||||
NOTE: Not supported in Backtesting.
|
||||
"""
|
||||
filters = [Trade.is_open.is_(False)]
|
||||
if days:
|
||||
start_date = datetime.today() - timedelta(days)
|
||||
if minutes:
|
||||
start_date = datetime.now(timezone.utc) - timedelta(minutes=minutes)
|
||||
filters.append(Trade.close_date >= start_date)
|
||||
pair_rates = Trade.query.with_entities(
|
||||
Trade.pair,
|
||||
|
@ -20,7 +20,7 @@ class PerformanceFilter(IPairList):
|
||||
pairlist_pos: int) -> None:
|
||||
super().__init__(exchange, pairlistmanager, config, pairlistconfig, pairlist_pos)
|
||||
|
||||
self._days = pairlistconfig.get('days', 0)
|
||||
self._minutes = pairlistconfig.get('minutes', 0)
|
||||
|
||||
@property
|
||||
def needstickers(self) -> bool:
|
||||
@ -47,7 +47,7 @@ class PerformanceFilter(IPairList):
|
||||
"""
|
||||
# Get the trading performance for pairs from database
|
||||
try:
|
||||
performance = pd.DataFrame(Trade.get_overall_performance(self._days))
|
||||
performance = pd.DataFrame(Trade.get_overall_performance(self._minutes))
|
||||
except AttributeError:
|
||||
# Performancefilter does not work in backtesting.
|
||||
self.log_once("PerformanceFilter is not available in this mode.", logger.warning)
|
||||
|
Loading…
Reference in New Issue
Block a user