replaced candle_type: Optional[str] = '' with candle_type: str = ''
This commit is contained in:
@@ -266,7 +266,7 @@ def convert_ohlcv_format(
|
||||
convert_from: str,
|
||||
convert_to: str,
|
||||
erase: bool,
|
||||
candle_type: Optional[str] = ""
|
||||
candle_type: str = ''
|
||||
):
|
||||
"""
|
||||
Convert OHLCV from one format to another
|
||||
|
@@ -99,7 +99,12 @@ class DataProvider:
|
||||
logger.warning(f"No data found for ({pair}, {timeframe}).")
|
||||
return data
|
||||
|
||||
def get_analyzed_dataframe(self, pair: str, timeframe: str) -> Tuple[DataFrame, datetime]:
|
||||
def get_analyzed_dataframe(
|
||||
self,
|
||||
pair: str,
|
||||
timeframe: str,
|
||||
candle_type: str = ''
|
||||
) -> Tuple[DataFrame, datetime]:
|
||||
"""
|
||||
Retrieve the analyzed dataframe. Returns the full dataframe in trade mode (live / dry),
|
||||
and the last 1000 candles (up to the time evaluated at this moment) in all other modes.
|
||||
@@ -177,7 +182,13 @@ class DataProvider:
|
||||
raise OperationalException(NO_EXCHANGE_EXCEPTION)
|
||||
return list(self._exchange._klines.keys())
|
||||
|
||||
def ohlcv(self, pair: str, timeframe: str = None, copy: bool = True) -> DataFrame:
|
||||
def ohlcv(
|
||||
self,
|
||||
pair: str,
|
||||
timeframe: str = None,
|
||||
copy: bool = True,
|
||||
candle_type: str = ''
|
||||
) -> DataFrame:
|
||||
"""
|
||||
Get candle (OHLCV) data for the given pair as DataFrame
|
||||
Please use the `available_pairs` method to verify which pairs are currently cached.
|
||||
|
@@ -42,7 +42,7 @@ class HDF5DataHandler(IDataHandler):
|
||||
cls,
|
||||
datadir: Path,
|
||||
timeframe: str,
|
||||
candle_type: Optional[str] = ""
|
||||
candle_type: str = ''
|
||||
) -> List[str]:
|
||||
"""
|
||||
Returns a list of all pairs with ohlcv data available in this datadir
|
||||
@@ -67,7 +67,7 @@ class HDF5DataHandler(IDataHandler):
|
||||
pair: str,
|
||||
timeframe: str,
|
||||
data: pd.DataFrame,
|
||||
candle_type: Optional[str] = ""
|
||||
candle_type: str = ''
|
||||
) -> None:
|
||||
"""
|
||||
Store data in hdf5 file.
|
||||
@@ -88,7 +88,7 @@ class HDF5DataHandler(IDataHandler):
|
||||
|
||||
def _ohlcv_load(self, pair: str, timeframe: str,
|
||||
timerange: Optional[TimeRange] = None,
|
||||
candle_type: Optional[str] = "") -> pd.DataFrame:
|
||||
candle_type: str = '') -> pd.DataFrame:
|
||||
"""
|
||||
Internal method used to load data for one pair from disk.
|
||||
Implements the loading and conversion to a Pandas dataframe.
|
||||
@@ -125,7 +125,7 @@ class HDF5DataHandler(IDataHandler):
|
||||
'low': 'float', 'close': 'float', 'volume': 'float'})
|
||||
return pairdata
|
||||
|
||||
def ohlcv_purge(self, pair: str, timeframe: str, candle_type: Optional[str] = "") -> bool:
|
||||
def ohlcv_purge(self, pair: str, timeframe: str, candle_type: str = '') -> bool:
|
||||
"""
|
||||
Remove data for this pair
|
||||
:param pair: Delete data for this pair.
|
||||
@@ -143,7 +143,7 @@ class HDF5DataHandler(IDataHandler):
|
||||
pair: str,
|
||||
timeframe: str,
|
||||
data: pd.DataFrame,
|
||||
candle_type: Optional[str] = ""
|
||||
candle_type: str = ''
|
||||
) -> None:
|
||||
"""
|
||||
Append data to existing data structures
|
||||
@@ -238,7 +238,7 @@ class HDF5DataHandler(IDataHandler):
|
||||
datadir: Path,
|
||||
pair: str,
|
||||
timeframe: str,
|
||||
candle_type: Optional[str] = ""
|
||||
candle_type: str = ''
|
||||
) -> Path:
|
||||
pair_s = misc.pair_to_filename(pair)
|
||||
if candle_type:
|
||||
|
@@ -29,6 +29,7 @@ def load_pair_history(pair: str,
|
||||
startup_candles: int = 0,
|
||||
data_format: str = None,
|
||||
data_handler: IDataHandler = None,
|
||||
candle_type: str = ''
|
||||
) -> DataFrame:
|
||||
"""
|
||||
Load cached ohlcv history for the given pair.
|
||||
@@ -64,6 +65,7 @@ def load_data(datadir: Path,
|
||||
startup_candles: int = 0,
|
||||
fail_without_data: bool = False,
|
||||
data_format: str = 'json',
|
||||
candle_type: str = ''
|
||||
) -> Dict[str, DataFrame]:
|
||||
"""
|
||||
Load ohlcv history data for a list of pairs.
|
||||
@@ -105,6 +107,7 @@ def refresh_data(datadir: Path,
|
||||
exchange: Exchange,
|
||||
data_format: str = None,
|
||||
timerange: Optional[TimeRange] = None,
|
||||
candle_type: str = ''
|
||||
) -> None:
|
||||
"""
|
||||
Refresh ohlcv history data for a list of pairs.
|
||||
@@ -124,8 +127,13 @@ def refresh_data(datadir: Path,
|
||||
timerange=timerange, exchange=exchange, data_handler=data_handler)
|
||||
|
||||
|
||||
def _load_cached_data_for_updating(pair: str, timeframe: str, timerange: Optional[TimeRange],
|
||||
data_handler: IDataHandler) -> Tuple[DataFrame, Optional[int]]:
|
||||
def _load_cached_data_for_updating(
|
||||
pair: str,
|
||||
timeframe: str,
|
||||
timerange: Optional[TimeRange],
|
||||
data_handler: IDataHandler,
|
||||
candle_type: str = ''
|
||||
) -> Tuple[DataFrame, Optional[int]]:
|
||||
"""
|
||||
Load cached data to download more data.
|
||||
If timerange is passed in, checks whether data from an before the stored data will be
|
||||
@@ -162,7 +170,7 @@ def _download_pair_history(pair: str, *,
|
||||
new_pairs_days: int = 30,
|
||||
data_handler: IDataHandler = None,
|
||||
timerange: Optional[TimeRange] = None,
|
||||
candle_type: Optional[str] = "") -> bool:
|
||||
candle_type: str = '') -> bool:
|
||||
"""
|
||||
Download latest candles from the exchange for the pair and timeframe passed in parameters
|
||||
The data is downloaded starting from the last correct data that
|
||||
@@ -232,7 +240,7 @@ def refresh_backtest_ohlcv_data(exchange: Exchange, pairs: List[str], timeframes
|
||||
datadir: Path, timerange: Optional[TimeRange] = None,
|
||||
new_pairs_days: int = 30, erase: bool = False,
|
||||
data_format: str = None,
|
||||
candle_type: Optional[str] = "") -> List[str]:
|
||||
candle_type: str = '') -> List[str]:
|
||||
"""
|
||||
Refresh stored ohlcv data for backtesting and hyperopt operations.
|
||||
Used by freqtrade download-data subcommand.
|
||||
@@ -365,7 +373,7 @@ def convert_trades_to_ohlcv(
|
||||
erase: bool = False,
|
||||
data_format_ohlcv: str = 'json',
|
||||
data_format_trades: str = 'jsongz',
|
||||
candle_type: Optional[str] = ""
|
||||
candle_type: str = ''
|
||||
) -> None:
|
||||
"""
|
||||
Convert stored trades data to ohlcv data
|
||||
|
@@ -39,7 +39,7 @@ class IDataHandler(ABC):
|
||||
cls,
|
||||
datadir: Path,
|
||||
timeframe: str,
|
||||
candle_type: Optional[str] = ''
|
||||
candle_type: str = ''
|
||||
) -> List[str]:
|
||||
"""
|
||||
Returns a list of all pairs with ohlcv data available in this datadir
|
||||
@@ -55,7 +55,7 @@ class IDataHandler(ABC):
|
||||
pair: str,
|
||||
timeframe: str,
|
||||
data: DataFrame,
|
||||
candle_type: Optional[str] = ''
|
||||
candle_type: str = ''
|
||||
) -> None:
|
||||
"""
|
||||
Store ohlcv data.
|
||||
@@ -68,7 +68,7 @@ class IDataHandler(ABC):
|
||||
@abstractmethod
|
||||
def _ohlcv_load(self, pair: str, timeframe: str,
|
||||
timerange: Optional[TimeRange] = None,
|
||||
candle_type: Optional[str] = ''
|
||||
candle_type: str = ''
|
||||
) -> DataFrame:
|
||||
"""
|
||||
Internal method used to load data for one pair from disk.
|
||||
@@ -83,7 +83,7 @@ class IDataHandler(ABC):
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def ohlcv_purge(self, pair: str, timeframe: str, candle_type: Optional[str] = '') -> bool:
|
||||
def ohlcv_purge(self, pair: str, timeframe: str, candle_type: str = '') -> bool:
|
||||
"""
|
||||
Remove data for this pair
|
||||
:param pair: Delete data for this pair.
|
||||
@@ -97,7 +97,7 @@ class IDataHandler(ABC):
|
||||
pair: str,
|
||||
timeframe: str,
|
||||
data: DataFrame,
|
||||
candle_type: Optional[str] = ''
|
||||
candle_type: str = ''
|
||||
) -> None:
|
||||
"""
|
||||
Append data to existing data structures
|
||||
@@ -165,7 +165,7 @@ class IDataHandler(ABC):
|
||||
drop_incomplete: bool = True,
|
||||
startup_candles: int = 0,
|
||||
warn_no_data: bool = True,
|
||||
candle_type: Optional[str] = ''
|
||||
candle_type: str = ''
|
||||
) -> DataFrame:
|
||||
"""
|
||||
Load cached candle (OHLCV) data for the given pair.
|
||||
|
@@ -42,7 +42,7 @@ class JsonDataHandler(IDataHandler):
|
||||
cls,
|
||||
datadir: Path,
|
||||
timeframe: str,
|
||||
candle_type: Optional[str] = ""
|
||||
candle_type: str = ''
|
||||
) -> List[str]:
|
||||
"""
|
||||
Returns a list of all pairs with ohlcv data available in this datadir
|
||||
@@ -66,7 +66,7 @@ class JsonDataHandler(IDataHandler):
|
||||
pair: str,
|
||||
timeframe: str,
|
||||
data: DataFrame,
|
||||
candle_type: Optional[str] = ""
|
||||
candle_type: str = ''
|
||||
) -> None:
|
||||
"""
|
||||
Store data in json format "values".
|
||||
@@ -94,7 +94,7 @@ class JsonDataHandler(IDataHandler):
|
||||
|
||||
def _ohlcv_load(self, pair: str, timeframe: str,
|
||||
timerange: Optional[TimeRange] = None,
|
||||
candle_type: Optional[str] = ""
|
||||
candle_type: str = ''
|
||||
) -> DataFrame:
|
||||
"""
|
||||
Internal method used to load data for one pair from disk.
|
||||
@@ -124,7 +124,7 @@ class JsonDataHandler(IDataHandler):
|
||||
infer_datetime_format=True)
|
||||
return pairdata
|
||||
|
||||
def ohlcv_purge(self, pair: str, timeframe: str, candle_type: Optional[str] = "") -> bool:
|
||||
def ohlcv_purge(self, pair: str, timeframe: str, candle_type: str = '') -> bool:
|
||||
"""
|
||||
Remove data for this pair
|
||||
:param pair: Delete data for this pair.
|
||||
@@ -142,7 +142,7 @@ class JsonDataHandler(IDataHandler):
|
||||
pair: str,
|
||||
timeframe: str,
|
||||
data: DataFrame,
|
||||
candle_type: Optional[str] = ""
|
||||
candle_type: str = ''
|
||||
) -> None:
|
||||
"""
|
||||
Append data to existing data structures
|
||||
@@ -222,7 +222,7 @@ class JsonDataHandler(IDataHandler):
|
||||
datadir: Path,
|
||||
pair: str,
|
||||
timeframe: str,
|
||||
candle_type: Optional[str] = ""
|
||||
candle_type: str = ''
|
||||
) -> Path:
|
||||
pair_s = misc.pair_to_filename(pair)
|
||||
if candle_type:
|
||||
|
Reference in New Issue
Block a user