mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 18:23:55 +00:00
Revert "Add telegram /delete command to delete tradeid"
This reverts commit 08fdd7d863
.
This commit is contained in:
parent
08fdd7d863
commit
28f4a1101e
|
@ -537,28 +537,6 @@ class RPC:
|
|||
else:
|
||||
return None
|
||||
|
||||
def _rpc_delete(self, trade_id: str) -> Dict[str, str]:
|
||||
"""
|
||||
Handler for delete <id>.
|
||||
Delete the given trade
|
||||
"""
|
||||
def _exec_delete(trade: Trade) -> None:
|
||||
Trade.session.delete(trade)
|
||||
Trade.session.flush()
|
||||
|
||||
with self._freqtrade._sell_lock:
|
||||
trade = Trade.get_trades(
|
||||
trade_filter=[Trade.id == trade_id, ]
|
||||
).first()
|
||||
if not trade:
|
||||
logger.warning('delete: Invalid argument received')
|
||||
raise RPCException('invalid argument')
|
||||
|
||||
_exec_delete(trade)
|
||||
Trade.session.flush()
|
||||
self._freqtrade.wallets.update()
|
||||
return {'result': f'Deleted trade {trade_id}.'}
|
||||
|
||||
def _rpc_performance(self) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
Handler for performance.
|
||||
|
|
|
@ -93,7 +93,6 @@ class Telegram(RPC):
|
|||
CommandHandler('forcesell', self._forcesell),
|
||||
CommandHandler('forcebuy', self._forcebuy),
|
||||
CommandHandler('trades', self._trades),
|
||||
CommandHandler('delete', self._delete),
|
||||
CommandHandler('performance', self._performance),
|
||||
CommandHandler('daily', self._daily),
|
||||
CommandHandler('count', self._count),
|
||||
|
@ -498,24 +497,6 @@ class Telegram(RPC):
|
|||
except RPCException as e:
|
||||
self._send_msg(str(e))
|
||||
|
||||
@authorized_only
|
||||
def _delete(self, update: Update, context: CallbackContext) -> None:
|
||||
"""
|
||||
Handler for /delete <id>.
|
||||
Delete the given trade
|
||||
:param bot: telegram bot
|
||||
:param update: message update
|
||||
:return: None
|
||||
"""
|
||||
|
||||
trade_id = context.args[0] if len(context.args) > 0 else None
|
||||
try:
|
||||
msg = self._rpc_delete(trade_id)
|
||||
self._send_msg('Delete Result: `{result}`'.format(**msg))
|
||||
|
||||
except RPCException as e:
|
||||
self._send_msg(str(e))
|
||||
|
||||
@authorized_only
|
||||
def _trades(self, update: Update, context: CallbackContext) -> None:
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user