From 26b3148904860055aaf714ca8373a175721a320f Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 14 Aug 2019 20:30:13 +0200 Subject: [PATCH] Add build_ohlcv wrapper --- freqtrade/exchange/exchange.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 98e70ca7e..8ce0dec1b 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -839,6 +839,23 @@ class Exchange: except ccxt.BaseError as e: raise OperationalException(e) from e + def build_ohlcv(self, trades: List[Dict], timeframe: str, since: int = None, + limit: int = None) -> str: + # TODO: fix return value + """ + Build ohlcv data from trade list. + trade-list has to be in the ccxt format, which is a list of dicts containing at least: + * timestamp + * price + * amount + :param trades: List of Dicts + :param timeframe: timeframe to convert to (e.g. "5m") + :param since: start at a specific data, as oposed to the trades-list start date + :param limit: Limit amount of candles + :return: ohlcv data (as returned by ccxt.fetch_ohlcv) + """ + return self._api.build_ohlcv(trades, timeframe, since, limit) + def is_exchange_bad(exchange_name: str) -> bool: return exchange_name in BAD_EXCHANGES