darfting edge rpc messages
This commit is contained in:
parent
96ea27322d
commit
1dfbf6eed6
@ -460,3 +460,18 @@ class RPC(object):
|
||||
'whitelist': self._freqtrade.active_pair_whitelist
|
||||
}
|
||||
return res
|
||||
|
||||
def _rpc_edge(self) -> Dict:
|
||||
""" Returns information related to Edge """
|
||||
if not self._freqtrade.edge:
|
||||
raise RPCException(f'Edge is not enabled.')
|
||||
|
||||
for pair in self._freqtrade.edge._cached_pairs:
|
||||
res = {
|
||||
'pair': pair,
|
||||
'winrate': self._freqtrade.edge._cached_pairs[pair].winrate,
|
||||
'expectancy': self._freqtrade.edge._cached_pairs[pair].expectancy,
|
||||
'stoploss': self._freqtrade.edge._cached_pairs[pair].stoploss,
|
||||
}
|
||||
|
||||
return res
|
||||
|
@ -470,6 +470,29 @@ class Telegram(RPC):
|
||||
except RPCException as e:
|
||||
self._send_msg(str(e), bot=bot)
|
||||
|
||||
@authorized_only
|
||||
def _edge(self, bot: Bot, update: Update) -> None:
|
||||
"""
|
||||
Handler for /edge
|
||||
Shows informaton related to Edge
|
||||
"""
|
||||
try:
|
||||
edge_pairs = self._rpc_edge()
|
||||
edge_pairs_tab = tabulate(edge_pairs,
|
||||
headers=[
|
||||
'Pair',
|
||||
f'Winrate',
|
||||
f'Expectancy',
|
||||
f'Stoploss'
|
||||
],
|
||||
tablefmt='simple')
|
||||
|
||||
message = f'<b>Edge only validated following pairs:</b>\n<pre>{edge_pairs_tab}</pre>'
|
||||
self._send_msg(message, bot=bot, parse_mode=ParseMode.HTML)
|
||||
except RPCException as e:
|
||||
self._send_msg(str(e), bot=bot)
|
||||
|
||||
|
||||
@authorized_only
|
||||
def _help(self, bot: Bot, update: Update) -> None:
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user