replaced candle_type: Optional[str] = '' with candle_type: str = ''

This commit is contained in:
Sam Germain
2021-11-21 00:21:10 -06:00
parent 64a6abc541
commit e2f98a8dab
8 changed files with 63 additions and 43 deletions

View File

@@ -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:

View File

@@ -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

View File

@@ -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.

View File

@@ -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: