Have forcesell return a result
This commit is contained in:
parent
c347013eef
commit
f71eda1c2f
@ -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]:
|
||||||
"""
|
"""
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user