Add "defaultCandletype"
This commit is contained in:
parent
dda7283f3e
commit
222c293602
@ -134,7 +134,7 @@ class DataProvider:
|
||||
combination.
|
||||
Returns empty dataframe and Epoch 0 (1970-01-01) if no dataframe was cached.
|
||||
"""
|
||||
pair_key = (pair, timeframe, CandleType.SPOT_)
|
||||
pair_key = (pair, timeframe, CandleType.SPOT)
|
||||
if pair_key in self.__cached_pairs:
|
||||
if self.runmode in (RunMode.DRY_RUN, RunMode.LIVE):
|
||||
df, date = self.__cached_pairs[pair_key]
|
||||
|
@ -87,8 +87,7 @@ class IDataHandler(ABC):
|
||||
:return: DataFrame with ohlcv data, or empty DataFrame
|
||||
"""
|
||||
|
||||
def ohlcv_purge(
|
||||
self, pair: str, timeframe: str, candle_type: CandleType = CandleType.SPOT_) -> bool:
|
||||
def ohlcv_purge(self, pair: str, timeframe: str, candle_type: CandleType) -> bool:
|
||||
"""
|
||||
Remove data for this pair
|
||||
:param pair: Delete data for this pair.
|
||||
@ -218,12 +217,12 @@ class IDataHandler(ABC):
|
||||
return res
|
||||
|
||||
def ohlcv_load(self, pair, timeframe: str,
|
||||
candle_type: CandleType,
|
||||
timerange: Optional[TimeRange] = None,
|
||||
fill_missing: bool = True,
|
||||
drop_incomplete: bool = True,
|
||||
startup_candles: int = 0,
|
||||
warn_no_data: bool = True,
|
||||
candle_type: CandleType = CandleType.SPOT_
|
||||
) -> DataFrame:
|
||||
"""
|
||||
Load cached candle (OHLCV) data for the given pair.
|
||||
|
@ -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_
|
||||
|
Loading…
Reference in New Issue
Block a user