mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-29 20:15:35 +08:00
Applies PEP-8 recommendations. White space tweaking.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from zipline.gens.transform import TransformMeta
|
||||
from collections import defaultdict, deque
|
||||
|
||||
|
||||
class Returns(object):
|
||||
"""
|
||||
Class that maintains a dictionary from sids to the sid's
|
||||
@@ -16,8 +17,8 @@ class Returns(object):
|
||||
"""
|
||||
Update and return the calculated returns for this event's sid.
|
||||
"""
|
||||
assert event.has_key('dt')
|
||||
assert event.has_key('price')
|
||||
assert 'dt' in event
|
||||
assert 'price' in event
|
||||
tracker = self.mapping[event.sid]
|
||||
tracker.update(event)
|
||||
|
||||
@@ -26,6 +27,7 @@ class Returns(object):
|
||||
def _create(self):
|
||||
return ReturnsFromPriorClose(self.days)
|
||||
|
||||
|
||||
class ReturnsFromPriorClose(object):
|
||||
"""
|
||||
Records the last N closing events for a given security as well as the
|
||||
@@ -72,6 +74,5 @@ class ReturnsFromPriorClose(object):
|
||||
change = event.price - last_close
|
||||
self.returns = change / last_close
|
||||
|
||||
|
||||
# the current event is now the last_event
|
||||
self.last_event = event
|
||||
|
||||
Reference in New Issue
Block a user