From 9edb88051d8291ab33eb199a6c449a9095e3b62d Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 29 Dec 2018 08:47:25 +0100 Subject: [PATCH] Add dataprovider documentation --- docs/bot-optimization.md | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/docs/bot-optimization.md b/docs/bot-optimization.md index 1cfae1bc4..6d03f55ac 100644 --- a/docs/bot-optimization.md +++ b/docs/bot-optimization.md @@ -222,6 +222,57 @@ Please note that the same buy/sell signals may work with one interval, but not t The metadata-dict (available for `populate_buy_trend`, `populate_sell_trend`, `populate_indicators`) contains additional information. Currently this is `pair`, which can be accessed using `metadata['pair']` - and will return a pair in the format `XRP/BTC`. +### Additional data (DataProvider) + +The strategy provides access to the `DataProvider`. This allows you to get additional data to use in your strategy. + +**NOTE**: The DataProvier is currently not available during backtesting / hyperopt. + +Please always check if the `DataProvider` is available to avoid failures during backtesting. + +``` python +if self.dp: + if dp.runmode == 'live': + if 'ETH/BTC' in self.dp.available_pairs: + data_eth = self.dp.ohlcv(pair='ETH/BTC', + ticker_interval=ticker_interval) + else: + # Get historic ohlcv data (cached on disk). + history_eth = self.dp.historic_ohlcv(pair='ETH/BTC', + ticker_interval='1h') +``` + +All methods return `None` in case of failure (do not raise an exception). + +#### Possible options for DataProvider + +- `available_pairs` - Property containing cached pairs +- `ohlcv(pair, ticker_interval)` - Currently cached ticker data for all pairs in the whitelist +- `historic_ohlcv(pair, ticker_interval)` - Data stored on disk +- `runmode` - Property containing the current runmode. + +### Additional data - Wallets + +The strategy provides access to the `Wallets` object. This contains the current balances on the exchange. + +**NOTE**: Wallets is not available during backtesting / hyperopt. + +Please always check if `Wallets` is available to avoid failures during backtesting. + +``` python +if self.wallets: + free_eth = self.wallets.get_free('ETH') + used_eth = self.wallets.get_used('ETH') + total_eth = self.wallets.get_total('ETH') +``` + +#### Possible options for Wallets + +- `get_free(asset)` - currently available balance to trade +- `get_used(asset)` - currently tied up balance (open orders) +- `get_total(asset)` - total available balance - sum of the 2 above + + ### Where is the default strategy? The default buy strategy is located in the file