From 69731b653d3362634556394677a7b76cdf81cde7 Mon Sep 17 00:00:00 2001 From: lenak25 Date: Tue, 13 Mar 2018 18:42:28 +0200 Subject: [PATCH] BLD: revert hourly freq support reported at issue #227 --- catalyst/examples/simple_loop.py | 2 +- catalyst/exchange/exchange.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/catalyst/examples/simple_loop.py b/catalyst/examples/simple_loop.py index 99822b70..bc356e0a 100644 --- a/catalyst/examples/simple_loop.py +++ b/catalyst/examples/simple_loop.py @@ -26,7 +26,7 @@ def handle_data(context, data): context.asset, fields='price', bar_count=20, - frequency='2H' + frequency='30T' ) last_traded = prices.index[-1] log.info('last candle date: {}'.format(last_traded)) diff --git a/catalyst/exchange/exchange.py b/catalyst/exchange/exchange.py index c86b8cdd..73593c6d 100644 --- a/catalyst/exchange/exchange.py +++ b/catalyst/exchange/exchange.py @@ -13,6 +13,7 @@ from catalyst.exchange.exchange_errors import MismatchingBaseCurrencies, \ PricingDataNotLoadedError, \ NoDataAvailableOnExchange, NoValueForField, \ NoCandlesReceivedFromExchange, \ + InvalidHistoryFrequencyAlias, \ TickerNotFoundError, NotEnoughCashError from catalyst.exchange.utils.datetime_utils import get_delta, \ get_periods_range, \ @@ -508,6 +509,10 @@ class Exchange: frequency, data_frequency, supported_freqs=['T', 'D', 'H'] ) + if unit == 'H': + raise InvalidHistoryFrequencyAlias( + freq=frequency) + # we want to avoid receiving empty candles # so we request more than needed # TODO: consider defining a const per asset