Merge pull request #5170 from eschava/profit_N_consistent

make "/profit N" command output be consistent with "/daily" command
This commit is contained in:
Matthias 2021-06-23 18:27:49 +02:00 committed by GitHub
commit 18c00a4222
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -339,7 +339,9 @@ class RPC:
self, stake_currency: str, fiat_display_currency: str, self, stake_currency: str, fiat_display_currency: str,
start_date: datetime = datetime.fromtimestamp(0)) -> Dict[str, Any]: start_date: datetime = datetime.fromtimestamp(0)) -> Dict[str, Any]:
""" Returns cumulative profit statistics """ """ Returns cumulative profit statistics """
trades = Trade.get_trades([Trade.open_date >= start_date]).order_by(Trade.id).all() trade_filter = ((Trade.is_open.is_(False) & (Trade.close_date >= start_date)) |
Trade.is_open.is_(True))
trades = Trade.get_trades(trade_filter).order_by(Trade.id).all()
profit_all_coin = [] profit_all_coin = []
profit_all_ratio = [] profit_all_ratio = []

View File

@ -482,7 +482,7 @@ class Telegram(RPCHandler):
timescale = None timescale = None
try: try:
if context.args: if context.args:
timescale = int(context.args[0]) timescale = int(context.args[0]) - 1
today_start = datetime.combine(date.today(), datetime.min.time()) today_start = datetime.combine(date.today(), datetime.min.time())
start_date = today_start - timedelta(days=timescale) start_date = today_start - timedelta(days=timescale)
except (TypeError, ValueError, IndexError): except (TypeError, ValueError, IndexError):