Have forcesell return a result

This commit is contained in:
Matthias 2019-04-30 06:23:14 +02:00
parent c347013eef
commit f71eda1c2f
2 changed files with 6 additions and 3 deletions

View File

@ -346,7 +346,7 @@ class RPC(object):
return {'status': 'No more buy will occur from now. Run /reload_conf to reset.'} return {'status': 'No more buy will occur from now. Run /reload_conf to reset.'}
def _rpc_forcesell(self, trade_id) -> None: def _rpc_forcesell(self, trade_id) -> Dict[str, str]:
""" """
Handler for forcesell <id>. Handler for forcesell <id>.
Sells the given trade at current price Sells the given trade at current price
@ -386,7 +386,7 @@ class RPC(object):
for trade in Trade.get_open_trades(): for trade in Trade.get_open_trades():
_exec_forcesell(trade) _exec_forcesell(trade)
Trade.session.flush() Trade.session.flush()
return return {'result': 'Created sell orders for all open trades.'}
# Query for trade # Query for trade
trade = Trade.query.filter( trade = Trade.query.filter(
@ -401,6 +401,7 @@ class RPC(object):
_exec_forcesell(trade) _exec_forcesell(trade)
Trade.session.flush() Trade.session.flush()
return {'result': f'Created sell orders for trade {trade_id}.'}
def _rpc_forcebuy(self, pair: str, price: Optional[float]) -> Optional[Trade]: def _rpc_forcebuy(self, pair: str, price: Optional[float]) -> Optional[Trade]:
""" """

View File

@ -413,7 +413,9 @@ class Telegram(RPC):
trade_id = update.message.text.replace('/forcesell', '').strip() trade_id = update.message.text.replace('/forcesell', '').strip()
try: try:
self._rpc_forcesell(trade_id) msg = self._rpc_forcesell(trade_id)
self._send_msg('Forcesell Result: `{result}`'.format(**msg), bot=bot)
except RPCException as e: except RPCException as e:
self._send_msg(str(e), bot=bot) self._send_msg(str(e), bot=bot)