Add "defaultCandletype"

This commit is contained in:
Matthias
2021-12-08 13:00:11 +01:00
parent dda7283f3e
commit 222c293602
3 changed files with 12 additions and 6 deletions

View File

@@ -12,9 +12,16 @@ class CandleType(str, Enum):
# 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':
@staticmethod
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':
return CandleType.FUTURES
# TODO-lev: The below should be SPOT, not SPOT_
return CandleType.SPOT_