Merge branch 'develop' into pr/wizrds/7303

This commit is contained in:
Matthias
2022-09-20 06:56:15 +02:00
103 changed files with 1189 additions and 442 deletions

View File

@@ -12,6 +12,7 @@ from fastapi.middleware.cors import CORSMiddleware
from janus import Queue as ThreadedQueue
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.api_server.ws import ChannelManager
@@ -42,10 +43,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
# websocket message queue stuff
@@ -63,7 +64,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

View File

@@ -1,6 +1,6 @@
import logging
from typing import Any, Dict
from freqtrade.constants import Config
from freqtrade.enums import RPCMessageType
from freqtrade.rpc import RPC
from freqtrade.rpc.webhook import Webhook
@@ -10,7 +10,7 @@ logger = logging.getLogger(__name__)
class Discord(Webhook):
def __init__(self, rpc: 'RPC', config: Dict[str, Any]):
def __init__(self, rpc: 'RPC', config: Config):
# super().__init__(rpc, config)
self.rpc = rpc
self.config = config

View File

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

View File

@@ -5,6 +5,7 @@ import logging
from collections import deque
from typing import Any, Dict, List
from freqtrade.constants import Config
from freqtrade.enums import RPCMessageType
from freqtrade.rpc import RPC, RPCHandler
@@ -90,7 +91,7 @@ class RPCManager:
'msg': msg,
})
def startup_messages(self, config: Dict[str, Any], pairlist, protections) -> None:
def startup_messages(self, config: Config, pairlist, protections) -> None:
if config['dry_run']:
self.send_msg({
'type': RPCMessageType.WARNING,

View File

@@ -24,7 +24,7 @@ from telegram.ext import CallbackContext, CallbackQueryHandler, CommandHandler,
from telegram.utils.helpers import escape_markdown
from freqtrade.__init__ import __version__
from freqtrade.constants import DUST_PER_COIN
from freqtrade.constants import DUST_PER_COIN, Config
from freqtrade.enums import RPCMessageType, SignalDirection, TradingMode
from freqtrade.exceptions import OperationalException
from freqtrade.misc import chunks, plural, round_coin_value
@@ -88,7 +88,7 @@ def authorized_only(command_handler: Callable[..., None]) -> Callable[..., Any]:
class Telegram(RPCHandler):
""" This class handles all telegram communication """
def __init__(self, rpc: RPC, config: Dict[str, Any]) -> None:
def __init__(self, rpc: RPC, config: Config) -> None:
"""
Init the Telegram call, and init the super class RPCHandler
:param rpc: instance of RPC Helper class

View File

@@ -7,6 +7,7 @@ from typing import Any, Dict
from requests import RequestException, post
from freqtrade.constants import Config
from freqtrade.enums import RPCMessageType
from freqtrade.rpc import RPC, RPCHandler
@@ -19,7 +20,7 @@ logger.debug('Included module rpc.webhook ...')
class Webhook(RPCHandler):
""" This class handles all webhook communication """
def __init__(self, rpc: RPC, config: Dict[str, Any]) -> None:
def __init__(self, rpc: RPC, config: Config) -> None:
"""
Init the Webhook class, and init the super class RPCHandler
:param rpc: instance of RPC Helper class