remove /cancel command
This commit is contained in:
parent
3d5913d317
commit
53e71e09f7
@ -16,7 +16,7 @@ Persistence is achieved through sqlite.
|
|||||||
* /stop: Stops the trader
|
* /stop: Stops the trader
|
||||||
* /status: Lists all open trades
|
* /status: Lists all open trades
|
||||||
* /profit: Lists cumulative profit from all finished trades
|
* /profit: Lists cumulative profit from all finished trades
|
||||||
* /cancel: cancels open order for given trade (currently disabled)
|
* /forcesell <trade_id>: Instantly sells the given trade (Ignoring `minimum_roi`).
|
||||||
|
|
||||||
##### Config
|
##### Config
|
||||||
`minimal_roi` is a JSON object where the key is a duration
|
`minimal_roi` is a JSON object where the key is a duration
|
||||||
|
@ -166,39 +166,6 @@ class TelegramHandler(object):
|
|||||||
else:
|
else:
|
||||||
TelegramHandler.send_msg('*Status:* `already stopped`', bot=bot)
|
TelegramHandler.send_msg('*Status:* `already stopped`', bot=bot)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@authorized_only
|
|
||||||
def _cancel(bot, update):
|
|
||||||
"""
|
|
||||||
Handler for /cancel.
|
|
||||||
Cancels the open order for the current Trade.
|
|
||||||
:param bot: telegram bot
|
|
||||||
:param update: message update
|
|
||||||
:return: None
|
|
||||||
"""
|
|
||||||
# TODO: make compatible with max_open_orders
|
|
||||||
TelegramHandler.send_msg('`Currently not implemented`')
|
|
||||||
return
|
|
||||||
|
|
||||||
trade = Trade.query.filter(Trade.is_open.is_(True)).first()
|
|
||||||
if not trade:
|
|
||||||
TelegramHandler.send_msg('`There is no open trade`')
|
|
||||||
return
|
|
||||||
|
|
||||||
order_id = trade.open_order_id
|
|
||||||
if not order_id:
|
|
||||||
TelegramHandler.send_msg('`There is no open order`')
|
|
||||||
return
|
|
||||||
|
|
||||||
api_wrapper.cancel_order(order_id)
|
|
||||||
trade.open_order_id = None
|
|
||||||
trade.close_rate = None
|
|
||||||
trade.close_date = None
|
|
||||||
trade.close_profit = None
|
|
||||||
Session.flush()
|
|
||||||
TelegramHandler.send_msg('*Order cancelled:* `{}`'.format(order_id), bot=bot)
|
|
||||||
logger.info('Order cancelled: (order_id: {})'.format(order_id))
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@authorized_only
|
@authorized_only
|
||||||
def _forcesell(bot, update):
|
def _forcesell(bot, update):
|
||||||
@ -272,7 +239,6 @@ class TelegramHandler(object):
|
|||||||
CommandHandler('profit', TelegramHandler._profit),
|
CommandHandler('profit', TelegramHandler._profit),
|
||||||
CommandHandler('start', TelegramHandler._start),
|
CommandHandler('start', TelegramHandler._start),
|
||||||
CommandHandler('stop', TelegramHandler._stop),
|
CommandHandler('stop', TelegramHandler._stop),
|
||||||
CommandHandler('cancel', TelegramHandler._cancel),
|
|
||||||
CommandHandler('forcesell', TelegramHandler._forcesell),
|
CommandHandler('forcesell', TelegramHandler._forcesell),
|
||||||
]
|
]
|
||||||
for handle in handles:
|
for handle in handles:
|
||||||
|
Loading…
Reference in New Issue
Block a user