Add "defaultCandletype"
This commit is contained in:
parent
dda7283f3e
commit
222c293602
@ -134,7 +134,7 @@ class DataProvider:
|
|||||||
combination.
|
combination.
|
||||||
Returns empty dataframe and Epoch 0 (1970-01-01) if no dataframe was cached.
|
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 pair_key in self.__cached_pairs:
|
||||||
if self.runmode in (RunMode.DRY_RUN, RunMode.LIVE):
|
if self.runmode in (RunMode.DRY_RUN, RunMode.LIVE):
|
||||||
df, date = self.__cached_pairs[pair_key]
|
df, date = self.__cached_pairs[pair_key]
|
||||||
|
@ -87,8 +87,7 @@ class IDataHandler(ABC):
|
|||||||
:return: DataFrame with ohlcv data, or empty DataFrame
|
:return: DataFrame with ohlcv data, or empty DataFrame
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def ohlcv_purge(
|
def ohlcv_purge(self, pair: str, timeframe: str, candle_type: CandleType) -> bool:
|
||||||
self, pair: str, timeframe: str, candle_type: CandleType = CandleType.SPOT_) -> bool:
|
|
||||||
"""
|
"""
|
||||||
Remove data for this pair
|
Remove data for this pair
|
||||||
:param pair: Delete data for this pair.
|
:param pair: Delete data for this pair.
|
||||||
@ -218,12 +217,12 @@ class IDataHandler(ABC):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
def ohlcv_load(self, pair, timeframe: str,
|
def ohlcv_load(self, pair, timeframe: str,
|
||||||
|
candle_type: CandleType,
|
||||||
timerange: Optional[TimeRange] = None,
|
timerange: Optional[TimeRange] = None,
|
||||||
fill_missing: bool = True,
|
fill_missing: bool = True,
|
||||||
drop_incomplete: bool = True,
|
drop_incomplete: bool = True,
|
||||||
startup_candles: int = 0,
|
startup_candles: int = 0,
|
||||||
warn_no_data: bool = True,
|
warn_no_data: bool = True,
|
||||||
candle_type: CandleType = CandleType.SPOT_
|
|
||||||
) -> DataFrame:
|
) -> DataFrame:
|
||||||
"""
|
"""
|
||||||
Load cached candle (OHLCV) data for the given pair.
|
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
|
# TODO-lev: not sure this belongs here, as the datatype is really different
|
||||||
FUNDING_RATE = "funding_rate"
|
FUNDING_RATE = "funding_rate"
|
||||||
|
|
||||||
@classmethod
|
@staticmethod
|
||||||
def from_string(cls, value: str) -> 'CandleType':
|
def from_string(value: str) -> 'CandleType':
|
||||||
if not value:
|
if not value:
|
||||||
# Default to spot
|
# Default to spot
|
||||||
return CandleType.SPOT_
|
return CandleType.SPOT_
|
||||||
return CandleType(value)
|
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