/trades shall only return closed trades

This commit is contained in:
Matthias
2020-07-23 07:50:45 +02:00
parent 8300eb59d4
commit fdc84eef59
5 changed files with 14 additions and 14 deletions

View File

@@ -252,9 +252,10 @@ class RPC:
def _rpc_trade_history(self, limit: int) -> Dict:
""" Returns the X last trades """
if limit > 0:
trades = Trade.get_trades().order_by(Trade.id.desc()).limit(limit)
trades = Trade.get_trades([Trade.is_open.is_(False)]).order_by(
Trade.id.desc()).limit(limit)
else:
trades = Trade.get_trades().order_by(Trade.id.desc()).all()
trades = Trade.get_trades([Trade.is_open.is_(False)]).order_by(Trade.id.desc()).all()
output = [trade.to_json() for trade in trades]

View File

@@ -520,7 +520,7 @@ class Telegram(RPC):
[[arrow.get(trade['open_date']).humanize(),
trade['pair'],
f"{(100 * trade['close_profit']):.2f}% ({trade['close_profit_abs']})"]
for trade in trades['trades'] if trade['close_profit'] is not None],
for trade in trades['trades']],
headers=[
'Open Date',
'Pair',