def get_command_sell_all(currency): try: cancel_all_open_orders(currency) nb_created_orders = len(sell_all(currency)) if nb_created_orders: return f"{currency} sold in {nb_created_orders} order{'s' if nb_created_orders > 1 else ''}." else: return f"Nothing to sell for {currency}." except Exception as e: return f"An error occurred: {e.__class__.__name__}"
def command_pause_resume(self, _, update): if self.paused: update.message.reply_text( "Resuming...{0}I will restart trading when i see opportunities !" .format(TelegramApp.EOL)) set_enable_trading(True) self.paused = False else: update.message.reply_text( "Pausing...{}I'm cancelling my orders.".format( TelegramApp.EOL)) cancel_all_open_orders() set_enable_trading(False) self.paused = True
def set_command_pause(self): cancel_all_open_orders() set_enable_trading(False) self.paused = True