stable/freqtrade/rpc/api_server/deps.py

28 lines
559 B
Python
Raw Normal View History

2021-01-02 12:12:49 +00:00
from typing import Any, Dict, Optional
2021-01-02 11:54:40 +00:00
2021-01-02 12:12:49 +00:00
from freqtrade.rpc.rpc import RPC, RPCException
2021-01-02 11:54:40 +00:00
from .webserver import ApiServer
2021-01-02 12:12:49 +00:00
def get_rpc_optional() -> Optional[RPC]:
if ApiServer._has_rpc:
return ApiServer._rpc
return None
def get_rpc() -> Optional[RPC]:
_rpc = get_rpc_optional()
if _rpc:
return _rpc
else:
raise RPCException('Bot is not in the correct state')
2021-01-02 11:54:40 +00:00
def get_config() -> Dict[str, Any]:
return ApiServer._config
2020-12-27 14:24:49 +00:00
2021-01-02 11:54:40 +00:00
def get_api_config() -> Dict[str, Any]:
2020-12-27 14:24:49 +00:00
return ApiServer._config['api_server']