Add response-model for show_config
This commit is contained in:
		| @@ -112,6 +112,29 @@ class Daily(BaseModel): | |||||||
|     stake_currency: str |     stake_currency: str | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class ShowConfig(BaseModel): | ||||||
|  |     dry_run: str | ||||||
|  |     stake_currency: str | ||||||
|  |     stake_amount: float | ||||||
|  |     max_open_trades: int | ||||||
|  |     minimal_roi: Dict[str, Any] | ||||||
|  |     stoploss: float | ||||||
|  |     trailing_stop: bool | ||||||
|  |     trailing_stop_positive: Optional[float] | ||||||
|  |     trailing_stop_positive_offset: Optional[float] | ||||||
|  |     trailing_only_offset_is_reached: Optional[bool] | ||||||
|  |     timeframe: str | ||||||
|  |     timeframe_ms: int | ||||||
|  |     timeframe_min: int | ||||||
|  |     exchange: str | ||||||
|  |     strategy: str | ||||||
|  |     forcebuy_enabled: bool | ||||||
|  |     ask_strategy: Dict[str, Any] | ||||||
|  |     bid_strategy: Dict[str, Any] | ||||||
|  |     state: str | ||||||
|  |     runmode: str | ||||||
|  |  | ||||||
|  |  | ||||||
| class TradeSchema(BaseModel): | class TradeSchema(BaseModel): | ||||||
|     trade_id: int |     trade_id: int | ||||||
|     pair: str |     pair: str | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ from freqtrade.rpc.api_server.api_schemas import (AvailablePairs, Balances, Blac | |||||||
|                                                   ForceBuyPayload, ForceBuyResponse, |                                                   ForceBuyPayload, ForceBuyResponse, | ||||||
|                                                   ForceSellPayload, Locks, Logs, OpenTradeSchema, |                                                   ForceSellPayload, Locks, Logs, OpenTradeSchema, | ||||||
|                                                   PairHistory, PerformanceEntry, Ping, PlotConfig, |                                                   PairHistory, PerformanceEntry, Ping, PlotConfig, | ||||||
|                                                   Profit, ResultMsg, Stats, StatusMsg, |                                                   Profit, ResultMsg, ShowConfig, Stats, StatusMsg, | ||||||
|                                                   StrategyListResponse, StrategyResponse, |                                                   StrategyListResponse, StrategyResponse, | ||||||
|                                                   TradeResponse, Version, WhitelistResponse) |                                                   TradeResponse, Version, WhitelistResponse) | ||||||
| from freqtrade.rpc.api_server.deps import get_config, get_rpc, get_rpc_optional | from freqtrade.rpc.api_server.deps import get_config, get_rpc, get_rpc_optional | ||||||
| @@ -98,8 +98,7 @@ def edge(rpc: RPC = Depends(get_rpc)): | |||||||
|     return rpc._rpc_edge() |     return rpc._rpc_edge() | ||||||
|  |  | ||||||
|  |  | ||||||
| # TODO: Missing response model | @router.get('/show_config', response_model=ShowConfig, tags=['info']) | ||||||
| @router.get('/show_config', tags=['info']) |  | ||||||
| def show_config(rpc: Optional[RPC] = Depends(get_rpc_optional), config=Depends(get_config)): | def show_config(rpc: Optional[RPC] = Depends(get_rpc_optional), config=Depends(get_config)): | ||||||
|     state = '' |     state = '' | ||||||
|     if rpc: |     if rpc: | ||||||
|   | |||||||
| @@ -111,7 +111,7 @@ class RPC: | |||||||
|             self._fiat_converter = CryptoToFiatConverter() |             self._fiat_converter = CryptoToFiatConverter() | ||||||
|  |  | ||||||
|     @staticmethod |     @staticmethod | ||||||
|     def _rpc_show_config(config, botstate: State) -> Dict[str, Any]: |     def _rpc_show_config(config, botstate: Union[State, str]) -> Dict[str, Any]: | ||||||
|         """ |         """ | ||||||
|         Return a dict of config options. |         Return a dict of config options. | ||||||
|         Explicitly does NOT return the full config to avoid leakage of sensitive |         Explicitly does NOT return the full config to avoid leakage of sensitive | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user