Adds reprs for PerformanceTracker and TradingEnvironment.

For debugging in the REPL.
This commit is contained in:
Eddie Hebert
2012-12-27 18:26:55 -05:00
parent c6759eb938
commit a8413e1cc2
2 changed files with 12 additions and 0 deletions
+5
View File
@@ -206,6 +206,11 @@ class PerformanceTracker(object):
keep_transactions=True
)
def __repr__(self):
return "%s(%r)" % (
self.__class__.__name__,
{'trading_environment': self.trading_environment})
def transform(self, stream_in):
"""
Main generator work loop.
+7
View File
@@ -94,6 +94,13 @@ class TradingEnvironment(object):
self.prior_day_open = self.calculate_prior_day_open()
def __repr__(self):
return "%s(%r)" % (
self.__class__.__name__,
{'first_open': self.first_open,
'last_close': self.last_close
})
def calculate_first_open(self):
"""
Finds the first trading day on or after self.period_start.