Add plot_config endpoint

This commit is contained in:
Matthias
2020-06-23 06:49:53 +02:00
parent d528c44974
commit 677078350f
3 changed files with 30 additions and 1 deletions

View File

@@ -214,6 +214,8 @@ class ApiServer(RPC):
view_func=self._trades_delete, methods=['DELETE'])
self.app.add_url_rule(f'{BASE_URI}/pair_history', 'pair_history',
view_func=self._analysed_history, methods=['GET'])
self.app.add_url_rule(f'{BASE_URI}/plot_config', 'plot_config',
view_func=self._plot_config, methods=['GET'])
# Combined actions and infos
self.app.add_url_rule(f'{BASE_URI}/blacklist', 'blacklist', view_func=self._blacklist,
methods=['GET', 'POST'])
@@ -521,3 +523,11 @@ class ApiServer(RPC):
results = self._rpc_analysed_history(pair, timeframe, limit)
return self.rest_dump(results)
@require_login
@rpc_catch_errors
def _plot_config(self):
"""
Handler for /plot_config.
"""
return self.rest_dump(self._rpc_plot_config())

View File

@@ -654,7 +654,7 @@ class RPC:
raise RPCException('Edge is not enabled.')
return self._freqtrade.edge.accepted_pairs()
def _rpc_analysed_history(self, pair, timeframe, limit):
def _rpc_analysed_history(self, pair, timeframe, limit) -> Dict[str, Any]:
_data, last_analyzed = self._freqtrade.dataprovider.get_analyzed_dataframe(pair, timeframe)
if limit:
@@ -667,3 +667,7 @@ class RPC:
'length': len(_data),
'last_analyzed': last_analyzed,
}
def _rpc_plot_config(self) -> Dict[str, Any]:
return self._freqtrade.strategy.plot_config