mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-09-20 09:31:12 +00:00
Simplify class setups without inheritance
This commit is contained in:
parent
b12dbd2bea
commit
accc1b509b
|
@ -3,7 +3,7 @@ from typing import Callable
|
||||||
from cachetools import TTLCache, cached
|
from cachetools import TTLCache, cached
|
||||||
|
|
||||||
|
|
||||||
class LoggingMixin():
|
class LoggingMixin:
|
||||||
"""
|
"""
|
||||||
Logging Mixin
|
Logging Mixin
|
||||||
Shows similar messages only once every `refresh_period`.
|
Shows similar messages only once every `refresh_period`.
|
||||||
|
|
|
@ -35,7 +35,7 @@ def hyperopt_serializer(x):
|
||||||
return str(x)
|
return str(x)
|
||||||
|
|
||||||
|
|
||||||
class HyperoptStateContainer():
|
class HyperoptStateContainer:
|
||||||
""" Singleton class to track state of hyperopt"""
|
""" Singleton class to track state of hyperopt"""
|
||||||
state: HyperoptState = HyperoptState.OPTIMIZE
|
state: HyperoptState = HyperoptState.OPTIMIZE
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class HyperoptStateContainer():
|
||||||
cls.state = value
|
cls.state = value
|
||||||
|
|
||||||
|
|
||||||
class HyperoptTools():
|
class HyperoptTools:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_strategy_filename(config: Config, strategy_name: str) -> Optional[Path]:
|
def get_strategy_filename(config: Config, strategy_name: str) -> Optional[Path]:
|
||||||
|
|
|
@ -42,7 +42,7 @@ class _KeyValueStoreModel(ModelBase):
|
||||||
int_value: Mapped[Optional[int]]
|
int_value: Mapped[Optional[int]]
|
||||||
|
|
||||||
|
|
||||||
class KeyValueStore():
|
class KeyValueStore:
|
||||||
"""
|
"""
|
||||||
Generic bot-wide, persistent key-value store
|
Generic bot-wide, persistent key-value store
|
||||||
Can be used to store generic values, e.g. very first bot startup time.
|
Can be used to store generic values, e.g. very first bot startup time.
|
||||||
|
|
|
@ -11,7 +11,7 @@ from freqtrade.persistence.models import PairLock
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class PairLocks():
|
class PairLocks:
|
||||||
"""
|
"""
|
||||||
Pairlocks middleware class
|
Pairlocks middleware class
|
||||||
Abstracts the database layer away so it becomes optional - which will be necessary to support
|
Abstracts the database layer away so it becomes optional - which will be necessary to support
|
||||||
|
|
|
@ -283,7 +283,7 @@ class Order(ModelBase):
|
||||||
return Order.session.scalars(select(Order).filter(Order.order_id == order_id)).first()
|
return Order.session.scalars(select(Order).filter(Order.order_id == order_id)).first()
|
||||||
|
|
||||||
|
|
||||||
class LocalTrade():
|
class LocalTrade:
|
||||||
"""
|
"""
|
||||||
Trade database model.
|
Trade database model.
|
||||||
Used in backtesting - must be aligned to Trade model!
|
Used in backtesting - must be aligned to Trade model!
|
||||||
|
|
|
@ -15,7 +15,7 @@ from freqtrade.resolvers import ProtectionResolver
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ProtectionManager():
|
class ProtectionManager:
|
||||||
|
|
||||||
def __init__(self, config: Config, protections: List) -> None:
|
def __init__(self, config: Config, protections: List) -> None:
|
||||||
self._config = config
|
self._config = config
|
||||||
|
|
|
@ -14,7 +14,7 @@ class JobsContainer(TypedDict):
|
||||||
error: Optional[str]
|
error: Optional[str]
|
||||||
|
|
||||||
|
|
||||||
class ApiBG():
|
class ApiBG:
|
||||||
# Backtesting type: Backtesting
|
# Backtesting type: Backtesting
|
||||||
bt: Dict[str, Any] = {
|
bt: Dict[str, Any] = {
|
||||||
'bt': None,
|
'bt': None,
|
||||||
|
|
|
@ -168,7 +168,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
||||||
download_all_data_for_training(self.dp, self.config)
|
download_all_data_for_training(self.dp, self.config)
|
||||||
else:
|
else:
|
||||||
# Gracious failures if freqAI is disabled but "start" is called.
|
# Gracious failures if freqAI is disabled but "start" is called.
|
||||||
class DummyClass():
|
class DummyClass:
|
||||||
def start(self, *args, **kwargs):
|
def start(self, *args, **kwargs):
|
||||||
raise OperationalException(
|
raise OperationalException(
|
||||||
'freqAI is not enabled. '
|
'freqAI is not enabled. '
|
||||||
|
|
|
@ -29,7 +29,7 @@ logging.basicConfig(
|
||||||
logger = logging.getLogger("ft_rest_client")
|
logger = logging.getLogger("ft_rest_client")
|
||||||
|
|
||||||
|
|
||||||
class FtRestClient():
|
class FtRestClient:
|
||||||
|
|
||||||
def __init__(self, serverurl, username=None, password=None):
|
def __init__(self, serverurl, username=None, password=None):
|
||||||
|
|
||||||
|
|
|
@ -342,7 +342,7 @@ def exchange_futures(request, exchange_conf, class_mocker):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.longrun
|
@pytest.mark.longrun
|
||||||
class TestCCXTExchange():
|
class TestCCXTExchange:
|
||||||
|
|
||||||
def test_load_markets(self, exchange: EXCHANGE_FIXTURE_TYPE):
|
def test_load_markets(self, exchange: EXCHANGE_FIXTURE_TYPE):
|
||||||
exch, exchangename = exchange
|
exch, exchangename = exchange
|
||||||
|
|
Loading…
Reference in New Issue
Block a user