From df55259737608a304c2fddf545bed5a8d45434f2 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 2 Jan 2021 14:18:15 +0100 Subject: [PATCH] Add start_trading endpoint --- freqtrade/rpc/api_server/api_v1.py | 1 + freqtrade/rpc/api_server/webserver.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/freqtrade/rpc/api_server/api_v1.py b/freqtrade/rpc/api_server/api_v1.py index 965664028..dd1df6353 100644 --- a/freqtrade/rpc/api_server/api_v1.py +++ b/freqtrade/rpc/api_server/api_v1.py @@ -256,3 +256,4 @@ def list_available_pairs(timeframe: Optional[str] = None, stake_currency: Option 'pair_interval': pair_interval, } return result + diff --git a/freqtrade/rpc/api_server/webserver.py b/freqtrade/rpc/api_server/webserver.py index 9cbd5512a..f53c8b0c6 100644 --- a/freqtrade/rpc/api_server/webserver.py +++ b/freqtrade/rpc/api_server/webserver.py @@ -34,6 +34,7 @@ class ApiServer(RPCHandler): _rpc: RPC _has_rpc: bool = False + _bgtask_running: bool = False _config: Dict[str, Any] = {} def __new__(cls, *args, **kwargs): @@ -47,13 +48,13 @@ class ApiServer(RPCHandler): return ApiServer.__instance def __init__(self, config: Dict[str, Any], standalone: bool = False) -> None: + ApiServer._config = config if self.__initialized and (standalone or self._standalone): return self._standalone: bool = standalone - self._config = config self._server = None + ApiServer.__initialized = True - ApiServer._config = config api_config = self._config['api_server'] self.app = FastAPI(title="Freqtrade API", @@ -69,7 +70,7 @@ class ApiServer(RPCHandler): """ Attach rpc handler """ - if not self._rpc: + if not self._has_rpc: self._rpc = rpc ApiServer._rpc = rpc ApiServer._has_rpc = True