mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 02:12:01 +00:00
ruff format: update enums
This commit is contained in:
parent
1a4bff7fb8
commit
794e30fedb
|
@ -5,6 +5,7 @@ class BacktestState(Enum):
|
|||
"""
|
||||
Bot application states
|
||||
"""
|
||||
|
||||
STARTUP = 1
|
||||
DATALOAD = 2
|
||||
ANALYZE = 3
|
||||
|
|
|
@ -3,6 +3,7 @@ from enum import Enum
|
|||
|
||||
class CandleType(str, Enum):
|
||||
"""Enum to distinguish candle types"""
|
||||
|
||||
SPOT = "spot"
|
||||
FUTURES = "futures"
|
||||
MARK = "mark"
|
||||
|
@ -17,14 +18,14 @@ class CandleType(str, Enum):
|
|||
return f"{self.name.lower()}"
|
||||
|
||||
@staticmethod
|
||||
def from_string(value: str) -> 'CandleType':
|
||||
def from_string(value: str) -> "CandleType":
|
||||
if not value:
|
||||
# Default to spot
|
||||
return CandleType.SPOT
|
||||
return CandleType(value)
|
||||
|
||||
@staticmethod
|
||||
def get_default(trading_mode: str) -> 'CandleType':
|
||||
if trading_mode == 'futures':
|
||||
def get_default(trading_mode: str) -> "CandleType":
|
||||
if trading_mode == "futures":
|
||||
return CandleType.FUTURES
|
||||
return CandleType.SPOT
|
||||
|
|
|
@ -5,10 +5,11 @@ class ExitCheckTuple:
|
|||
"""
|
||||
NamedTuple for Exit type + reason
|
||||
"""
|
||||
exit_type: ExitType
|
||||
exit_reason: str = ''
|
||||
|
||||
def __init__(self, exit_type: ExitType, exit_reason: str = ''):
|
||||
exit_type: ExitType
|
||||
exit_reason: str = ""
|
||||
|
||||
def __init__(self, exit_type: ExitType, exit_reason: str = ""):
|
||||
self.exit_type = exit_type
|
||||
self.exit_reason = exit_reason or exit_type.value
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ class ExitType(Enum):
|
|||
"""
|
||||
Enum to distinguish between exit reasons
|
||||
"""
|
||||
|
||||
ROI = "roi"
|
||||
STOP_LOSS = "stop_loss"
|
||||
STOPLOSS_ON_EXCHANGE = "stoploss_on_exchange"
|
||||
|
|
|
@ -2,7 +2,8 @@ from enum import Enum
|
|||
|
||||
|
||||
class HyperoptState(Enum):
|
||||
""" Hyperopt states """
|
||||
"""Hyperopt states"""
|
||||
|
||||
STARTUP = 1
|
||||
DATALOAD = 2
|
||||
INDICATORS = 3
|
||||
|
|
|
@ -7,6 +7,7 @@ class MarginMode(str, Enum):
|
|||
cross margin/futures margin_mode and
|
||||
isolated margin/futures margin_mode
|
||||
"""
|
||||
|
||||
CROSS = "cross"
|
||||
ISOLATED = "isolated"
|
||||
NONE = ''
|
||||
NONE = ""
|
||||
|
|
|
@ -5,6 +5,7 @@ class MarketDirection(Enum):
|
|||
"""
|
||||
Enum for various market directions.
|
||||
"""
|
||||
|
||||
LONG = "long"
|
||||
SHORT = "short"
|
||||
EVEN = "even"
|
||||
|
|
|
@ -2,5 +2,5 @@ from enum import Enum
|
|||
|
||||
|
||||
class OrderTypeValues(str, Enum):
|
||||
limit = 'limit'
|
||||
market = 'market'
|
||||
limit = "limit"
|
||||
market = "market"
|
||||
|
|
|
@ -3,6 +3,7 @@ from enum import Enum
|
|||
|
||||
class PriceType(str, Enum):
|
||||
"""Enum to distinguish possible trigger prices for stoplosses"""
|
||||
|
||||
LAST = "last"
|
||||
MARK = "mark"
|
||||
INDEX = "index"
|
||||
|
|
|
@ -2,27 +2,27 @@ from enum import Enum
|
|||
|
||||
|
||||
class RPCMessageType(str, Enum):
|
||||
STATUS = 'status'
|
||||
WARNING = 'warning'
|
||||
EXCEPTION = 'exception'
|
||||
STARTUP = 'startup'
|
||||
STATUS = "status"
|
||||
WARNING = "warning"
|
||||
EXCEPTION = "exception"
|
||||
STARTUP = "startup"
|
||||
|
||||
ENTRY = 'entry'
|
||||
ENTRY_FILL = 'entry_fill'
|
||||
ENTRY_CANCEL = 'entry_cancel'
|
||||
ENTRY = "entry"
|
||||
ENTRY_FILL = "entry_fill"
|
||||
ENTRY_CANCEL = "entry_cancel"
|
||||
|
||||
EXIT = 'exit'
|
||||
EXIT_FILL = 'exit_fill'
|
||||
EXIT_CANCEL = 'exit_cancel'
|
||||
EXIT = "exit"
|
||||
EXIT_FILL = "exit_fill"
|
||||
EXIT_CANCEL = "exit_cancel"
|
||||
|
||||
PROTECTION_TRIGGER = 'protection_trigger'
|
||||
PROTECTION_TRIGGER_GLOBAL = 'protection_trigger_global'
|
||||
PROTECTION_TRIGGER = "protection_trigger"
|
||||
PROTECTION_TRIGGER_GLOBAL = "protection_trigger_global"
|
||||
|
||||
STRATEGY_MSG = 'strategy_msg'
|
||||
STRATEGY_MSG = "strategy_msg"
|
||||
|
||||
WHITELIST = 'whitelist'
|
||||
ANALYZED_DF = 'analyzed_df'
|
||||
NEW_CANDLE = 'new_candle'
|
||||
WHITELIST = "whitelist"
|
||||
ANALYZED_DF = "analyzed_df"
|
||||
NEW_CANDLE = "new_candle"
|
||||
|
||||
def __repr__(self):
|
||||
return self.value
|
||||
|
@ -33,10 +33,10 @@ class RPCMessageType(str, Enum):
|
|||
|
||||
# Enum for parsing requests from ws consumers
|
||||
class RPCRequestType(str, Enum):
|
||||
SUBSCRIBE = 'subscribe'
|
||||
SUBSCRIBE = "subscribe"
|
||||
|
||||
WHITELIST = 'whitelist'
|
||||
ANALYZED_DF = 'analyzed_df'
|
||||
WHITELIST = "whitelist"
|
||||
ANALYZED_DF = "analyzed_df"
|
||||
|
||||
def __str__(self):
|
||||
return self.value
|
||||
|
|
|
@ -6,6 +6,7 @@ class RunMode(Enum):
|
|||
Bot running mode (backtest, hyperopt, ...)
|
||||
can be "live", "dry-run", "backtest", "edge", "hyperopt".
|
||||
"""
|
||||
|
||||
LIVE = "live"
|
||||
DRY_RUN = "dry_run"
|
||||
BACKTEST = "backtest"
|
||||
|
|
|
@ -5,6 +5,7 @@ class SignalType(Enum):
|
|||
"""
|
||||
Enum to distinguish between enter and exit signals
|
||||
"""
|
||||
|
||||
ENTER_LONG = "enter_long"
|
||||
EXIT_LONG = "exit_long"
|
||||
ENTER_SHORT = "enter_short"
|
||||
|
@ -18,6 +19,7 @@ class SignalTagType(Enum):
|
|||
"""
|
||||
Enum for signal columns
|
||||
"""
|
||||
|
||||
ENTER_TAG = "enter_tag"
|
||||
EXIT_TAG = "exit_tag"
|
||||
|
||||
|
@ -26,8 +28,8 @@ class SignalTagType(Enum):
|
|||
|
||||
|
||||
class SignalDirection(str, Enum):
|
||||
LONG = 'long'
|
||||
SHORT = 'short'
|
||||
LONG = "long"
|
||||
SHORT = "short"
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.name.lower()}"
|
||||
|
|
|
@ -5,6 +5,7 @@ class State(Enum):
|
|||
"""
|
||||
Bot application states
|
||||
"""
|
||||
|
||||
RUNNING = 1
|
||||
STOPPED = 2
|
||||
RELOAD_CONFIG = 3
|
||||
|
|
|
@ -6,6 +6,7 @@ class TradingMode(str, Enum):
|
|||
Enum to distinguish between
|
||||
spot, margin, futures or any other trading method
|
||||
"""
|
||||
|
||||
SPOT = "spot"
|
||||
MARGIN = "margin"
|
||||
FUTURES = "futures"
|
||||
|
|
Loading…
Reference in New Issue
Block a user