darfting edge rpc messages

This commit is contained in:
Misagh 2019-03-24 22:36:33 +01:00
parent 96ea27322d
commit 1dfbf6eed6
2 changed files with 38 additions and 0 deletions

View File

@ -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

View File

@ -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:
"""