From 2352c1e5765eca4bef6a265bb0d02360dc02b053 Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Sun, 27 Jan 2013 21:21:01 -0500 Subject: [PATCH] Adds dictionary style access to Portfolio object. --- zipline/protocol.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zipline/protocol.py b/zipline/protocol.py index 6c89896c..f4b57e74 100644 --- a/zipline/protocol.py +++ b/zipline/protocol.py @@ -63,6 +63,9 @@ class Portfolio(object): if initial_values: self.__dict__ = initial_values + def __getattr__(self, key): + return self.__dict__[key] + def __repr__(self): return "Portfolio({0})".format(self.__dict__)