From a8a869dd49b50e04ac31dee80b9e8a8ec88ab941 Mon Sep 17 00:00:00 2001 From: Abner Ayala-Acevedo Date: Thu, 16 Nov 2017 16:21:25 -0800 Subject: [PATCH] Fix when to fetch data Ensure to get data at the last minute of the candle. --- catalyst/examples/simple_universe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalyst/examples/simple_universe.py b/catalyst/examples/simple_universe.py index 20a4fc78..5d3d1e43 100644 --- a/catalyst/examples/simple_universe.py +++ b/catalyst/examples/simple_universe.py @@ -49,7 +49,7 @@ def handle_data(context, data): minutes = 30 one_day_in_minutes = 1440 # 1440 assumes data_frequency='minute' lookback = one_day_in_minutes / minutes * lookback_days # get N lookback_days of history data - if not context.i % minutes and context.universe: + if not ((context.i % minutes) - minutes + 1) and context.universe: # fetch data at last minute of the candle # we iterate for every pair in the current universe for coin in context.coins: pair = str(coin.symbol)