Use Alias to type config objects
This commit is contained in:
@@ -8,6 +8,7 @@ from fastapi import Depends, FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from starlette.responses import JSONResponse
|
||||
|
||||
from freqtrade.constants import Config
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.rpc.api_server.uvicorn_threaded import UvicornServer
|
||||
from freqtrade.rpc.rpc import RPC, RPCException, RPCHandler
|
||||
@@ -37,10 +38,10 @@ class ApiServer(RPCHandler):
|
||||
_bt = None
|
||||
_bt_data = None
|
||||
_bt_timerange = None
|
||||
_bt_last_config: Dict[str, Any] = {}
|
||||
_bt_last_config: Config = {}
|
||||
_has_rpc: bool = False
|
||||
_bgtask_running: bool = False
|
||||
_config: Dict[str, Any] = {}
|
||||
_config: Config = {}
|
||||
# Exchange - only available in webserver mode.
|
||||
_exchange = None
|
||||
|
||||
@@ -54,7 +55,7 @@ class ApiServer(RPCHandler):
|
||||
ApiServer.__initialized = False
|
||||
return ApiServer.__instance
|
||||
|
||||
def __init__(self, config: Dict[str, Any], standalone: bool = False) -> None:
|
||||
def __init__(self, config: Config, standalone: bool = False) -> None:
|
||||
ApiServer._config = config
|
||||
if self.__initialized and (standalone or self._standalone):
|
||||
return
|
||||
|
@@ -16,7 +16,7 @@ from pandas import DataFrame, NaT
|
||||
|
||||
from freqtrade import __version__
|
||||
from freqtrade.configuration.timerange import TimeRange
|
||||
from freqtrade.constants import CANCEL_REASON, DATETIME_PRINT_FORMAT
|
||||
from freqtrade.constants import CANCEL_REASON, DATETIME_PRINT_FORMAT, Config
|
||||
from freqtrade.data.history import load_data
|
||||
from freqtrade.data.metrics import calculate_max_drawdown
|
||||
from freqtrade.enums import (CandleType, ExitCheckTuple, ExitType, SignalDirection, State,
|
||||
@@ -58,7 +58,7 @@ class RPCException(Exception):
|
||||
|
||||
class RPCHandler:
|
||||
|
||||
def __init__(self, rpc: 'RPC', config: Dict[str, Any]) -> None:
|
||||
def __init__(self, rpc: 'RPC', config: Config) -> None:
|
||||
"""
|
||||
Initializes RPCHandlers
|
||||
:param rpc: instance of RPC Helper class
|
||||
@@ -66,7 +66,7 @@ class RPCHandler:
|
||||
:return: None
|
||||
"""
|
||||
self._rpc = rpc
|
||||
self._config: Dict[str, Any] = config
|
||||
self._config: Config = config
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
@@ -96,7 +96,7 @@ class RPC:
|
||||
:return: None
|
||||
"""
|
||||
self._freqtrade = freqtrade
|
||||
self._config: Dict[str, Any] = freqtrade.config
|
||||
self._config: Config = freqtrade.config
|
||||
if self._config.get('fiat_display_currency'):
|
||||
self._fiat_converter = CryptoToFiatConverter()
|
||||
|
||||
|
Reference in New Issue
Block a user