stable/freqtrade/enums/candletype.py

26 lines
694 B
Python
Raw Normal View History

2021-12-03 11:12:33 +00:00
from enum import Enum
class CandleType(str, Enum):
"""Enum to distinguish candle types"""
SPOT = "spot"
FUTURES = "futures"
MARK = "mark"
INDEX = "index"
PREMIUMINDEX = "premiumIndex"
# TODO-lev: not sure this belongs here, as the datatype is really different
FUNDING_RATE = "funding_rate"
2021-12-03 11:46:18 +00:00
2021-12-08 12:00:11 +00:00
@staticmethod
def from_string(value: str) -> 'CandleType':
2021-12-03 11:46:18 +00:00
if not value:
# Default to spot
2021-12-08 13:35:15 +00:00
return CandleType.SPOT
2021-12-03 11:46:18 +00:00
return CandleType(value)
2021-12-08 12:00:11 +00:00
@staticmethod
def get_default(trading_mode: str) -> 'CandleType':
if trading_mode == 'futures':
return CandleType.FUTURES
2021-12-08 13:35:15 +00:00
return CandleType.SPOT