Add documentation for days parameter in PerformanceFilter

This commit is contained in:
Matthias 2021-09-18 08:26:48 +02:00
parent d7395e873b
commit 12c12d42df
3 changed files with 17 additions and 3 deletions

View File

@ -165,6 +165,7 @@ Example to remove the first 10 pairs from the pairlist:
```json ```json
"pairlists": [ "pairlists": [
// ...
{ {
"method": "OffsetFilter", "method": "OffsetFilter",
"offset": 10 "offset": 10
@ -190,6 +191,19 @@ Sorts pairs by past trade performance, as follows:
Trade count is used as a tie breaker. Trade count is used as a tie breaker.
You can use the `days` parameter to only consider performance of the past X days.
Not defining this parameter (or setting it to 0) will use all-time performance.
```json
"pairlists": [
// ...
{
"method": "PerformanceFilter",
"days": 10
}
],
```
!!! Note !!! Note
`PerformanceFilter` does not support backtesting mode. `PerformanceFilter` does not support backtesting mode.

View File

@ -2,7 +2,7 @@
This module contains the class to persist trades into SQLite This module contains the class to persist trades into SQLite
""" """
import logging import logging
from datetime import datetime, timezone, timedelta from datetime import datetime, timedelta, timezone
from decimal import Decimal from decimal import Decimal
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional
@ -840,7 +840,7 @@ class Trade(_DECL_BASE, LocalTrade):
filters = [Trade.is_open.is_(False)] filters = [Trade.is_open.is_(False)]
if days: if days:
start_date = datetime.today() - timedelta(days) start_date = datetime.today() - timedelta(days)
filters.append((Trade.close_date >= start_date)) filters.append(Trade.close_date >= start_date)
pair_rates = Trade.query.with_entities( pair_rates = Trade.query.with_entities(
Trade.pair, Trade.pair,
func.sum(Trade.close_profit).label('profit_sum'), func.sum(Trade.close_profit).label('profit_sum'),

View File

@ -2,7 +2,7 @@
Performance pair list filter Performance pair list filter
""" """
import logging import logging
from typing import Dict, List, Any from typing import Any, Dict, List
import pandas as pd import pandas as pd