Complete refactor, moving query_trades to persistance as get_open_trades

This commit is contained in:
Matthias
2019-02-25 20:00:17 +01:00
parent 7bc874c7fd
commit 0c53bd6dd4
4 changed files with 60 additions and 14 deletions

View File

@@ -83,7 +83,7 @@ class RPC(object):
a remotely exposed function
"""
# Fetch open trade
trades = Trade.query.filter(Trade.is_open.is_(True)).all()
trades = Trade.get_open_trades()
if not trades:
raise RPCException('no active trade')
else:
@@ -118,7 +118,7 @@ class RPC(object):
return results
def _rpc_status_table(self) -> DataFrame:
trades = Trade.query.filter(Trade.is_open.is_(True)).all()
trades = Trade.get_open_trades()
if not trades:
raise RPCException('no active order')
else:
@@ -366,7 +366,7 @@ class RPC(object):
if trade_id == 'all':
# Execute sell for all open orders
for trade in Trade.query.filter(Trade.is_open.is_(True)).all():
for trade in Trade.get_open_trades():
_exec_forcesell(trade)
Trade.session.flush()
return
@@ -442,7 +442,7 @@ class RPC(object):
if self._freqtrade.state != State.RUNNING:
raise RPCException('trader is not running')
return Trade.query.filter(Trade.is_open.is_(True)).all()
return Trade.get_open_trades()
def _rpc_whitelist(self) -> Dict:
""" Returns the currently active whitelist"""