From 3c954af08c012371b660b8a4f0b9f37b6242dfc4 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Thu, 22 Oct 2015 03:57:33 -0400 Subject: [PATCH] MAINT: Just do searchsorted with the date. Previously we were converting our date to a string, then calling `searchsorted` on the DatetimeIndex with the string, which would cause pandas to convert the string back into a date to actually do the lookup. --- zipline/data/loader.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zipline/data/loader.py b/zipline/data/loader.py index f6108806..f169acba 100644 --- a/zipline/data/loader.py +++ b/zipline/data/loader.py @@ -169,8 +169,7 @@ def load_market_data(trading_day=trading_day_nyse, # Find the offset of the last date for which we have trading data in our # list of valid trading days last_bm_date = saved_benchmarks.index[-1] - last_bm_date_offset = days_up_to_now.searchsorted( - last_bm_date.strftime('%Y/%m/%d')) + last_bm_date_offset = days_up_to_now.searchsorted(last_bm_date) # If more than 1 trading days has elapsed since the last day where # we have data,then we need to update