Move RPCMessageType to enums

This commit is contained in:
Matthias
2021-06-09 19:51:44 +02:00
parent 756904f985
commit d4dfdf04fc
14 changed files with 36 additions and 38 deletions

View File

@@ -1,3 +1,3 @@
# flake8: noqa: F401
from .rpc import RPC, RPCException, RPCHandler, RPCMessageType
from .rpc import RPC, RPCException, RPCHandler
from .rpc_manager import RPCManager

View File

@@ -4,7 +4,6 @@ This module contains class to define a RPC communications
import logging
from abc import abstractmethod
from datetime import date, datetime, timedelta, timezone
from enum import Enum
from math import isnan
from typing import Any, Dict, List, Optional, Tuple, Union
@@ -30,24 +29,6 @@ from freqtrade.strategy.interface import SellCheckTuple
logger = logging.getLogger(__name__)
class RPCMessageType(Enum):
STATUS = 'status'
WARNING = 'warning'
STARTUP = 'startup'
BUY = 'buy'
BUY_FILL = 'buy_fill'
BUY_CANCEL = 'buy_cancel'
SELL = 'sell'
SELL_FILL = 'sell_fill'
SELL_CANCEL = 'sell_cancel'
def __repr__(self):
return self.value
def __str__(self):
return self.value
class RPCException(Exception):
"""
Should be raised with a rpc-formatted message in an _rpc_* method

View File

@@ -4,7 +4,8 @@ This module contains class to manage RPC communications (Telegram, Slack, ...)
import logging
from typing import Any, Dict, List
from freqtrade.rpc import RPC, RPCHandler, RPCMessageType
from freqtrade.enums import RPCMessageType
from freqtrade.rpc import RPC, RPCHandler
logger = logging.getLogger(__name__)

View File

@@ -22,9 +22,10 @@ from telegram.utils.helpers import escape_markdown
from freqtrade.__init__ import __version__
from freqtrade.constants import DUST_PER_COIN
from freqtrade.enums import RPCMessageType
from freqtrade.exceptions import OperationalException
from freqtrade.misc import chunks, round_coin_value
from freqtrade.rpc import RPC, RPCException, RPCHandler, RPCMessageType
from freqtrade.rpc import RPC, RPCException, RPCHandler
logger = logging.getLogger(__name__)

View File

@@ -6,7 +6,8 @@ from typing import Any, Dict
from requests import RequestException, post
from freqtrade.rpc import RPC, RPCHandler, RPCMessageType
from freqtrade.enums import RPCMessageType
from freqtrade.rpc import RPC, RPCHandler
logger = logging.getLogger(__name__)