Add show_config endpoint
This commit is contained in:
@@ -169,6 +169,8 @@ class ApiServer(RPC):
|
||||
view_func=self._status, methods=['GET'])
|
||||
self.app.add_url_rule(f'{BASE_URI}/version', 'version',
|
||||
view_func=self._version, methods=['GET'])
|
||||
self.app.add_url_rule(f'{BASE_URI}/show_config', 'show_config',
|
||||
view_func=self._show_config, methods=['GET'])
|
||||
self.app.add_url_rule(f'{BASE_URI}/ping', 'ping',
|
||||
view_func=self._ping, methods=['GET'])
|
||||
|
||||
@@ -241,6 +243,14 @@ class ApiServer(RPC):
|
||||
"""
|
||||
return self.rest_dump({"version": __version__})
|
||||
|
||||
@require_login
|
||||
@rpc_catch_errors
|
||||
def _show_config(self):
|
||||
"""
|
||||
Prints the bot's version
|
||||
"""
|
||||
return self.rest_dump(self._rpc_show_config())
|
||||
|
||||
@require_login
|
||||
@rpc_catch_errors
|
||||
def _reload_conf(self):
|
||||
|
@@ -80,6 +80,26 @@ class RPC:
|
||||
def send_msg(self, msg: Dict[str, str]) -> None:
|
||||
""" Sends a message to all registered rpc modules """
|
||||
|
||||
def _rpc_show_config(self) -> Dict:
|
||||
"""
|
||||
Return a dict of config options.
|
||||
Explicitly does NOT return the full config to avoid leakage of sensitive
|
||||
information via rpc.
|
||||
"""
|
||||
config = self._freqtrade.config
|
||||
val = {
|
||||
'dry_run': config.get('dry_run', False),
|
||||
'stake_currency': config['stake_currency'],
|
||||
'stake_amount': config['stake_amount'],
|
||||
'minimal_roi': config['minimal_roi'].copy(),
|
||||
'stoploss': config['stoploss'],
|
||||
'trailing_stop': config['trailing_stop'],
|
||||
'ticker_interval': config['ticker_interval'],
|
||||
'exchange': config['exchange']['name'],
|
||||
'strategy': config['strategy'],
|
||||
}
|
||||
return val
|
||||
|
||||
def _rpc_trade_status(self) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
Below follows the RPC backend it is prefixed with rpc_ to raise awareness that it is
|
||||
|
Reference in New Issue
Block a user