Example #1
0
 def _locks(self, update: Update, context: CallbackContext) -> None:
     """
     Handler for /locks.
     Returns the currently active locks
     """
     rpc_locks = self._rpc._rpc_locks()
     for locks in chunks(rpc_locks['locks'], 25):
         message = tabulate([[
             lock['id'], lock['pair'], lock['lock_end_time'], lock['reason']
         ] for lock in locks],
                            headers=['ID', 'Pair', 'Until', 'Reason'],
                            tablefmt='simple')
         message = f"<pre>{escape(message)}</pre>"
         logger.debug(message)
         self._send_msg(message, parse_mode=ParseMode.HTML)
Example #2
0
    def _edge(self, update: Update, context: CallbackContext) -> None:
        """
        Handler for /edge
        Shows information related to Edge
        """
        try:
            edge_pairs = self._rpc._rpc_edge()
            if not edge_pairs:
                message = '<b>Edge only validated following pairs:</b>'
                self._send_msg(message, parse_mode=ParseMode.HTML)

            for chunk in chunks(edge_pairs, 25):
                edge_pairs_tab = tabulate(chunk, headers='keys', tablefmt='simple')
                message = (f'<b>Edge only validated following pairs:</b>\n'
                           f'<pre>{edge_pairs_tab}</pre>')

                self._send_msg(message, parse_mode=ParseMode.HTML)

        except RPCException as e:
            self._send_msg(str(e))