2021-12-03 11:12:33 +00:00
|
|
|
from enum import Enum
|
|
|
|
|
|
|
|
|
|
|
|
class CandleType(str, Enum):
|
|
|
|
"""Enum to distinguish candle types"""
|
|
|
|
SPOT = "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
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def from_string(cls, value: str) -> 'CandleType':
|
|
|
|
if not value:
|
|
|
|
# Default to spot
|
2021-12-03 13:27:04 +00:00
|
|
|
return CandleType.SPOT_
|
2021-12-03 11:46:18 +00:00
|
|
|
return CandleType(value)
|