From 57c39bf615e31bcbc87785961831ed36ae34e43b Mon Sep 17 00:00:00 2001 From: fawce Date: Mon, 9 Apr 2012 10:20:08 -0400 Subject: [PATCH] switching to only calculate the returns and risk on market close, rather than per trade. --- zipline/finance/performance.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/zipline/finance/performance.py b/zipline/finance/performance.py index 4b674e59..93d06f2c 100644 --- a/zipline/finance/performance.py +++ b/zipline/finance/performance.py @@ -255,12 +255,14 @@ class PerformanceTracker(): self.cumulative_performance.update_last_sale(event) self.todays_performance.update_last_sale(event) + + + def handle_market_close(self): #calculate performance as of last trade self.cumulative_performance.calculate_performance() self.todays_performance.calculate_performance() - - def handle_market_close(self): - #add the return results from today to the list of DailyReturn objects. + + # add the return results from today to the list of DailyReturn objects. todays_date = self.market_close.replace(hour=0, minute=0, second=0) todays_return_obj = risk.DailyReturn( todays_date, @@ -297,7 +299,6 @@ class PerformanceTracker(): self.market_close = self.market_open + self.trading_day # Roll over positions to current day. - self.todays_performance.calculate_performance() self.todays_performance = PerformancePeriod( self.todays_performance.positions, self.todays_performance.ending_value,