Add start_trading endpoint

This commit is contained in:
Matthias 2021-01-02 14:18:15 +01:00
parent 02b84bd018
commit df55259737
2 changed files with 5 additions and 3 deletions

View File

@ -256,3 +256,4 @@ def list_available_pairs(timeframe: Optional[str] = None, stake_currency: Option
'pair_interval': pair_interval, 'pair_interval': pair_interval,
} }
return result return result

View File

@ -34,6 +34,7 @@ class ApiServer(RPCHandler):
_rpc: RPC _rpc: RPC
_has_rpc: bool = False _has_rpc: bool = False
_bgtask_running: bool = False
_config: Dict[str, Any] = {} _config: Dict[str, Any] = {}
def __new__(cls, *args, **kwargs): def __new__(cls, *args, **kwargs):
@ -47,13 +48,13 @@ class ApiServer(RPCHandler):
return ApiServer.__instance return ApiServer.__instance
def __init__(self, config: Dict[str, Any], standalone: bool = False) -> None: def __init__(self, config: Dict[str, Any], standalone: bool = False) -> None:
ApiServer._config = config
if self.__initialized and (standalone or self._standalone): if self.__initialized and (standalone or self._standalone):
return return
self._standalone: bool = standalone self._standalone: bool = standalone
self._config = config
self._server = None self._server = None
ApiServer.__initialized = True
ApiServer._config = config
api_config = self._config['api_server'] api_config = self._config['api_server']
self.app = FastAPI(title="Freqtrade API", self.app = FastAPI(title="Freqtrade API",
@ -69,7 +70,7 @@ class ApiServer(RPCHandler):
""" """
Attach rpc handler Attach rpc handler
""" """
if not self._rpc: if not self._has_rpc:
self._rpc = rpc self._rpc = rpc
ApiServer._rpc = rpc ApiServer._rpc = rpc
ApiServer._has_rpc = True ApiServer._has_rpc = True