Add candletype from string

This commit is contained in:
Matthias
2021-12-03 12:46:18 +01:00
parent f9cf59bb4d
commit f33643cacf
3 changed files with 26 additions and 0 deletions

View File

@@ -11,3 +11,10 @@ class CandleType(str, Enum):
PREMIUMINDEX = "premiumIndex"
# TODO-lev: not sure this belongs here, as the datatype is really different
FUNDING_RATE = "funding_rate"
@classmethod
def from_string(cls, value: str) -> 'CandleType':
if not value:
# Default to spot
return CandleType.SPOT
return CandleType(value)