Skip to content

Commit

Permalink
MAINT: break refcycle in metrics tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Jevnik authored and llllllllll committed Mar 6, 2018
1 parent c2c6ea1 commit e5aa830
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions zipline/finance/metrics/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ def __init__(self,
)

if emission_rate == 'minute':
def progress():
def progress(self):
return 1.0 # a fake value
else:
def progress():
def progress(self):
return self._session_count / self._total_session_count

# don't compare these strings over and over again!
self.progress = progress
self._progress = progress

# bind all of the hooks from the passed metric objects.
for hook in self._hooks:
Expand Down Expand Up @@ -228,7 +228,7 @@ def handle_minute_close(self, dt, data_portal):
'period_open': self._first_session,
'period_close': self._last_session,
},
'progress': self.progress(),
'progress': self._progress(self),
'cumulative_risk_metrics': {},
}
ledger = self._ledger
Expand Down Expand Up @@ -312,7 +312,7 @@ def handle_market_close(self, dt, data_portal):
'period_open': self._first_session,
'period_close': self._last_session,
},
'progress': self.progress(),
'progress': self._progress(self),
'cumulative_risk_metrics': {},
}
ledger = self._ledger
Expand Down

0 comments on commit e5aa830

Please sign in to comment.