diff --git a/freqtrade/rpc/api_server.py b/freqtrade/rpc/api_server.py index b0620d6e2..be8c01b8b 100644 --- a/freqtrade/rpc/api_server.py +++ b/freqtrade/rpc/api_server.py @@ -1,3 +1,4 @@ +from copy import deepcopy import logging import threading from datetime import date, datetime @@ -538,14 +539,19 @@ class ApiServer(RPC): parameters: - pair: Pair - timeframe: Timeframe to get data for (should be aligned to strategy.timeframe) + - strategy: Strategy to use - Must exist in configured strategy-path! - timerange: timerange in the format YYYYMMDD-YYYYMMDD (YYYYMMDD- or (-YYYYMMDD)) are als possible. If omitted uses all available data. """ pair = request.args.get("pair") timeframe = request.args.get("timeframe") timerange = request.args.get("timerange") - - results = self._rpc_analysed_history_full(pair, timeframe, timerange) + strategy = request.args.get("strategy") + config = deepcopy(self._config) + config.update({ + 'strategy': strategy, + }) + results = self._rpc_analysed_history_full(config, pair, timeframe, timerange) return self.rest_dump(results) @require_login diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index e66314230..c40bface3 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -689,19 +689,19 @@ class RPC: _data = _data.iloc[-limit:].copy() return self._convert_dataframe_to_dict(pair, _data, last_analyzed) - def _rpc_analysed_history_full(self, pair: str, timeframe: str, + def _rpc_analysed_history_full(self, config: Dict[str, any], pair: str, timeframe: str, timerange: str) -> Dict[str, Any]: timerange = TimeRange.parse_timerange(timerange) _data = load_data( - datadir=self._freqtrade.config.get("datadir"), + datadir=config.get("datadir"), pairs=[pair], - timeframe=self._freqtrade.config.get('timeframe', '5m'), + timeframe=timeframe, timerange=timerange, - data_format=self._freqtrade.config.get('dataformat_ohlcv', 'json'), + data_format=config.get('dataformat_ohlcv', 'json'), ) from freqtrade.resolvers.strategy_resolver import StrategyResolver - strategy = StrategyResolver.load_strategy(self._freqtrade.config) + strategy = StrategyResolver.load_strategy(config) df_analyzed = strategy.analyze_ticker(_data[pair], {'pair': pair}) return self._convert_dataframe_to_dict(pair, df_analyzed, arrow.Arrow.utcnow().datetime)