Added candle_type in doc strings

This commit is contained in:
Sam Germain 2021-11-27 02:55:42 -06:00
parent 0183e313ac
commit 8761649fd7
8 changed files with 32 additions and 4 deletions

View File

@ -55,6 +55,7 @@ class DataProvider:
:param pair: pair to get the data for
:param timeframe: Timeframe to get data for
:param dataframe: analyzed dataframe
:param candle_type: '', mark, index, premiumIndex, or funding_rate
"""
self.__cached_pairs[(pair, timeframe, candle_type)] = (
dataframe, datetime.now(timezone.utc))
@ -75,6 +76,7 @@ class DataProvider:
Get stored historical candle (OHLCV) data
:param pair: pair to get the data for
:param timeframe: timeframe to get data for
:param candle_type: '', mark, index, premiumIndex, or funding_rate
"""
saved_pair = (pair, str(timeframe), candle_type)
if saved_pair not in self.__cached_pairs_backtesting:
@ -106,6 +108,7 @@ class DataProvider:
:param pair: pair to get the data for
:param timeframe: timeframe to get data for
:return: Dataframe for this pair
:param candle_type: '', mark, index, premiumIndex, or funding_rate
"""
if self.runmode in (RunMode.DRY_RUN, RunMode.LIVE):
# Get live OHLCV data.
@ -128,6 +131,7 @@ class DataProvider:
and the last 1000 candles (up to the time evaluated at this moment) in all other modes.
:param pair: pair to get the data for
:param timeframe: timeframe to get data for
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: Tuple of (Analyzed Dataframe, lastrefreshed) for the requested pair / timeframe
combination.
Returns empty dataframe and Epoch 0 (1970-01-01) if no dataframe was cached.
@ -212,6 +216,7 @@ class DataProvider:
Please use the `available_pairs` method to verify which pairs are currently cached.
:param pair: pair to get the data for
:param timeframe: Timeframe to get data for
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:param copy: copy dataframe before returning if True.
Use False only for read-only operations (where the dataframe is not modified)
"""

View File

@ -49,6 +49,7 @@ class HDF5DataHandler(IDataHandler):
for the specified timeframe
:param datadir: Directory to search for ohlcv files
:param timeframe: Timeframe to search pairs for
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: List of Pairs
"""
@ -74,6 +75,7 @@ class HDF5DataHandler(IDataHandler):
:param pair: Pair - used to generate filename
:param timeframe: Timeframe - used to generate filename
:param data: Dataframe containing OHLCV data
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: None
"""
key = self._pair_ohlcv_key(pair, timeframe)
@ -98,6 +100,7 @@ class HDF5DataHandler(IDataHandler):
:param timerange: Limit data to be loaded to this timerange.
Optionally implemented by subclasses to avoid loading
all data where possible.
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: DataFrame with ohlcv data, or empty DataFrame
"""
key = self._pair_ohlcv_key(pair, timeframe)
@ -130,6 +133,7 @@ class HDF5DataHandler(IDataHandler):
Remove data for this pair
:param pair: Delete data for this pair.
:param timeframe: Timeframe (e.g. "5m")
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: True when deleted, false if file did not exist.
"""
filename = self._pair_data_filename(self._datadir, pair, timeframe, candle_type)
@ -150,6 +154,7 @@ class HDF5DataHandler(IDataHandler):
:param pair: Pair
:param timeframe: Timeframe this ohlcv data is for
:param data: Data to append.
:param candle_type: '', mark, index, premiumIndex, or funding_rate
"""
raise NotImplementedError()

View File

@ -44,6 +44,7 @@ def load_pair_history(pair: str,
:param startup_candles: Additional candles to load at the start of the period
:param data_handler: Initialized data-handler to use.
Will be initialized from data_format if not set
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: DataFrame with ohlcv data, or empty DataFrame
"""
data_handler = get_datahandler(datadir, data_format, data_handler)
@ -79,6 +80,7 @@ def load_data(datadir: Path,
:param startup_candles: Additional candles to load at the start of the period
:param fail_without_data: Raise OperationalException if no data is found.
:param data_format: Data format which should be used. Defaults to json
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: dict(<pair>:<Dataframe>)
"""
result: Dict[str, DataFrame] = {}
@ -120,6 +122,7 @@ def refresh_data(datadir: Path,
:param exchange: Exchange object
:param data_format: dataformat to use
:param timerange: Limit data to be loaded to this timerange
:param candle_type: '', mark, index, premiumIndex, or funding_rate
"""
data_handler = get_datahandler(datadir, data_format)
for idx, pair in enumerate(pairs):
@ -186,6 +189,7 @@ def _download_pair_history(pair: str, *,
:param pair: pair to download
:param timeframe: Timeframe (e.g "5m")
:param timerange: range of time to download
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: bool with success state
"""
data_handler = get_datahandler(datadir, data_handler=data_handler)

View File

@ -46,6 +46,7 @@ class IDataHandler(ABC):
for the specified timeframe
:param datadir: Directory to search for ohlcv files
:param timeframe: Timeframe to search pairs for
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: List of Pairs
"""
@ -62,6 +63,7 @@ class IDataHandler(ABC):
:param pair: Pair - used to generate filename
:param timeframe: Timeframe - used to generate filename
:param data: Dataframe containing OHLCV data
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: None
"""
@ -79,6 +81,7 @@ class IDataHandler(ABC):
:param timerange: Limit data to be loaded to this timerange.
Optionally implemented by subclasses to avoid loading
all data where possible.
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: DataFrame with ohlcv data, or empty DataFrame
"""
@ -88,6 +91,7 @@ class IDataHandler(ABC):
Remove data for this pair
:param pair: Delete data for this pair.
:param timeframe: Timeframe (e.g. "5m")
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: True when deleted, false if file did not exist.
"""
@ -104,6 +108,7 @@ class IDataHandler(ABC):
:param pair: Pair
:param timeframe: Timeframe this ohlcv data is for
:param data: Data to append.
:param candle_type: '', mark, index, premiumIndex, or funding_rate
"""
@abstractclassmethod
@ -177,6 +182,7 @@ class IDataHandler(ABC):
:param drop_incomplete: Drop last candle assuming it may be incomplete.
:param startup_candles: Additional candles to load at the start of the period
:param warn_no_data: Log a warning message when no data is found
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: DataFrame with ohlcv data, or empty DataFrame
"""
# Fix startup period

View File

@ -49,6 +49,7 @@ class JsonDataHandler(IDataHandler):
for the specified timeframe
:param datadir: Directory to search for ohlcv files
:param timeframe: Timeframe to search pairs for
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: List of Pairs
"""
if candle_type:
@ -75,6 +76,7 @@ class JsonDataHandler(IDataHandler):
:param pair: Pair - used to generate filename
:param timeframe: Timeframe - used to generate filename
:param data: Dataframe containing OHLCV data
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: None
"""
filename = self._pair_data_filename(
@ -105,6 +107,7 @@ class JsonDataHandler(IDataHandler):
:param timerange: Limit data to be loaded to this timerange.
Optionally implemented by subclasses to avoid loading
all data where possible.
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: DataFrame with ohlcv data, or empty DataFrame
"""
filename = self._pair_data_filename(self._datadir, pair, timeframe, candle_type=candle_type)
@ -129,6 +132,7 @@ class JsonDataHandler(IDataHandler):
Remove data for this pair
:param pair: Delete data for this pair.
:param timeframe: Timeframe (e.g. "5m")
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: True when deleted, false if file did not exist.
"""
filename = self._pair_data_filename(self._datadir, pair, timeframe, candle_type=candle_type)
@ -149,6 +153,7 @@ class JsonDataHandler(IDataHandler):
:param pair: Pair
:param timeframe: Timeframe this ohlcv data is for
:param data: Data to append.
:param candle_type: '', mark, index, premiumIndex, or funding_rate
"""
raise NotImplementedError()

View File

@ -204,7 +204,7 @@ class Binance(Exchange):
"""
Overwrite to introduce "fast new pair" functionality by detecting the pair's listing date
Does not work for other exchanges, which don't return the earliest data when called with "0"
:param candle_type: "mark" if retrieving the mark price cnadles
:param candle_type: '', mark, index, premiumIndex, or funding_rate
"""
if is_new_pair:
x = await self._async_get_candle_history(pair, timeframe, 0, candle_type)

View File

@ -1319,6 +1319,7 @@ class Exchange:
:param pair: Pair to download
:param timeframe: Timeframe to get data for
:param since_ms: Timestamp in milliseconds to get history from
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: List with candle (OHLCV) data
"""
data: List
@ -1336,6 +1337,7 @@ class Exchange:
:param pair: Pair to download
:param timeframe: Timeframe to get data for
:param since_ms: Timestamp in milliseconds to get history from
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: OHLCV DataFrame
"""
ticks = self.get_historic_ohlcv(pair, timeframe, since_ms=since_ms, candle_type=candle_type)
@ -1350,6 +1352,7 @@ class Exchange:
"""
Download historic ohlcv
:param is_new_pair: used by binance subclass to allow "fast" new pair downloading
:param candle_type: '', mark, index, premiumIndex, or funding_rate
"""
one_call = timeframe_to_msecs(timeframe) * self.ohlcv_candle_limit(timeframe)
@ -1393,6 +1396,7 @@ class Exchange:
:param pair_list: List of 2 element tuples containing pair, interval to refresh
:param since_ms: time since when to download, in milliseconds
:param cache: Assign result to _klines. Usefull for one-off downloads like for pairlists
:param candle_type: '', mark, index, premiumIndex, or funding_rate
:return: Dict of [{(pair, timeframe): Dataframe}]
"""
logger.debug("Refreshing candle (OHLCV) data for %d pairs", len(pair_list))
@ -1480,9 +1484,7 @@ class Exchange:
) -> Tuple[str, str, str, List]:
"""
Asynchronously get candle history data using fetch_ohlcv
:param candle_type:
"mark" if retrieving the mark price cnadles
"index" for index price candles
:param candle_type: '', mark, index, premiumIndex, or funding_rate
returns tuple: (pair, timeframe, ohlcv_list)
"""
try:

View File

@ -47,6 +47,7 @@ def informative(timeframe: str, asset: str = '',
* {column} - name of dataframe column.
* {timeframe} - timeframe of informative dataframe.
:param ffill: ffill dataframe after merging informative pair.
:param candle_type: '', mark, index, premiumIndex, or funding_rate
"""
_asset = asset
_timeframe = timeframe