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,
}
return result

View File

@ -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