From 32835b87f393004661160ed69fd3bbcdae7d0d6e Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Tue, 7 May 2013 18:34:41 -0400 Subject: [PATCH] MAINT: Rename perfomances intraday_perf to minute_perf. minute_perf is more precise than intraday_perf as a naming scheme for the performance packet type. --- tests/test_perf_tracking.py | 12 ++++++------ zipline/finance/performance.py | 7 +------ zipline/finance/risk.py | 2 +- zipline/gens/tradesimulation.py | 4 ++-- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/tests/test_perf_tracking.py b/tests/test_perf_tracking.py index 28775ee7..e2ae3a4d 100644 --- a/tests/test_perf_tracking.py +++ b/tests/test_perf_tracking.py @@ -1098,21 +1098,21 @@ class TestPerformanceTracker(unittest.TestCase): msg_1 = messages[foo_event_1.dt] msg_2 = messages[foo_event_2.dt] - self.assertEquals(1, len(msg_1['intraday_perf']['transactions']), + self.assertEquals(1, len(msg_1['minute_perf']['transactions']), "The first message should contain one transaction.") # Check that transactions aren't emitted for previous events. - self.assertEquals(0, len(msg_2['intraday_perf']['transactions']), + self.assertEquals(0, len(msg_2['minute_perf']['transactions']), "The second message should have no transactions.") - self.assertEquals(1, len(msg_1['intraday_perf']['orders']), + self.assertEquals(1, len(msg_1['minute_perf']['orders']), "The first message should contain one orders.") # Check that orders aren't emitted for previous events. - self.assertEquals(0, len(msg_2['intraday_perf']['orders']), + self.assertEquals(0, len(msg_2['minute_perf']['orders']), "The second message should have no orders.") # Ensure that period_close moves through time. # Also, ensure that the period_closes are the expected dts. self.assertEquals(foo_event_1.dt, - msg_1['intraday_perf']['period_close']) + msg_1['minute_perf']['period_close']) self.assertEquals(foo_event_2.dt, - msg_2['intraday_perf']['period_close']) + msg_2['minute_perf']['period_close']) diff --git a/zipline/finance/performance.py b/zipline/finance/performance.py index ce46f57a..6a08ddc2 100644 --- a/zipline/finance/performance.py +++ b/zipline/finance/performance.py @@ -278,14 +278,9 @@ class PerformanceTracker(object): 'daily_perf': self.todays_performance.to_dict()}) if emission_type == 'minute': - # Currently reusing 'todays_performance' for intraday trading - # result, should be analogous, but has the potential for needing - # its own configuration down the line. - # Naming as intraday to make clear that these results are - # being updated per minute _dict['intraday_risk_metrics'] = \ self.intraday_risk_metrics.to_dict() - _dict['intraday_perf'] = self.todays_performance.to_dict( + _dict['minute_perf'] = self.todays_performance.to_dict( self.saved_dt) _dict['cumulative_risk_metrics'] = \ self.cumulative_risk_metrics.to_dict() diff --git a/zipline/finance/risk.py b/zipline/finance/risk.py index 355ac845..d4a23a39 100644 --- a/zipline/finance/risk.py +++ b/zipline/finance/risk.py @@ -649,7 +649,7 @@ algorithm_returns ({algo_count}) in range {start} : {end} on {dt}" self.algorithm_volatility.append( self.calculate_volatility(self.algorithm_returns)) - # caching the treasury rates for the live case is a + # caching the treasury rates for the minutely case is a # big speedup, because it avoids searching the treasury # curves on every minute. treasury_end = self.algorithm_returns.index[-1].replace( diff --git a/zipline/gens/tradesimulation.py b/zipline/gens/tradesimulation.py index 73011605..136cdd9c 100644 --- a/zipline/gens/tradesimulation.py +++ b/zipline/gens/tradesimulation.py @@ -26,7 +26,7 @@ log = Logger('Trade Simulation') class AlgorithmSimulator(object): EMISSION_TO_PERF_KEY_MAP = { - 'minute': 'intraday_perf', + 'minute': 'minute_perf', 'daily': 'daily_perf' } @@ -185,7 +185,7 @@ class AlgorithmSimulator(object): elif self.algo.perf_tracker.emission_rate == 'minute': self.algo.perf_tracker.handle_minute_close(date) perf_message = self.algo.perf_tracker.to_dict() - perf_message['intraday_perf']['recorded_vars'] = rvars + perf_message['minute_perf']['recorded_vars'] = rvars return perf_message def get_next_close(self, mkt_close):