From 6525a838d1dea85530d03d89e09d4451ead0aed7 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 30 Dec 2018 10:25:47 +0100 Subject: [PATCH] Adjust documentation to tuple use --- docs/bot-optimization.md | 26 ++++++++++++++++++-------- freqtrade/data/dataprovider.py | 1 - 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/docs/bot-optimization.md b/docs/bot-optimization.md index 979adcd08..51e2f0f63 100644 --- a/docs/bot-optimization.md +++ b/docs/bot-optimization.md @@ -228,12 +228,23 @@ The strategy provides access to the `DataProvider`. This allows you to get addit **NOTE**: The DataProvier is currently not available during backtesting / hyperopt. +All methods return `None` in case of failure (do not raise an exception). + Please always check if the `DataProvider` is available to avoid failures during backtesting. +#### Possible options for DataProvider + +- `available_pairs` - Property with tuples listing cached pairs with their intervals. (pair, interval) +- `ohlcv(pair, ticker_interval)` - Currently cached ticker data for all pairs in the whitelist, returns DataFrame or empty DataFrame +- `historic_ohlcv(pair, ticker_interval)` - Data stored on disk +- `runmode` - Property containing the current runmode. + +#### ohlcv / historic_ohlcv + ``` python if self.dp: if dp.runmode == 'live': - if 'ETH/BTC' in self.dp.available_pairs: + if ('ETH/BTC', ticker_interval) in self.dp.available_pairs: data_eth = self.dp.ohlcv(pair='ETH/BTC', ticker_interval=ticker_interval) else: @@ -242,14 +253,13 @@ if self.dp: ticker_interval='1h') ``` -All methods return `None` in case of failure (do not raise an exception). +#### Available Pairs -#### Possible options for DataProvider - -- `available_pairs` - Property containing cached pairs -- `ohlcv(pair, ticker_interval)` - Currently cached ticker data for all pairs in the whitelist, returns DataFrame or empty DataFrame -- `historic_ohlcv(pair, ticker_interval)` - Data stored on disk -- `runmode` - Property containing the current runmode. +``` python +if self.dp: + for pair, ticker in self.dp.available_pairs: + print(f"available {pair}, {ticker}") +``` ### Additional data - Wallets diff --git a/freqtrade/data/dataprovider.py b/freqtrade/data/dataprovider.py index c6f9c9c88..fdb3714fc 100644 --- a/freqtrade/data/dataprovider.py +++ b/freqtrade/data/dataprovider.py @@ -46,7 +46,6 @@ class DataProvider(object): :param copy: copy dataframe before returning. Use false only for RO operations (where the dataframe is not modified) """ - # TODO: Should not be stored in exchange but in this class if self.runmode in (RunMode.DRY_RUN, RunMode.LIVE): if tick_interval: pairtick = (pair, tick_interval)