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