From 480ca65f56b8f888a4c50b37e238e3abdc85a267 Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Sun, 27 Jan 2013 21:19:59 -0500 Subject: [PATCH] Adds dictionary style access to Position object. --- zipline/protocol.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zipline/protocol.py b/zipline/protocol.py index 0f9a0f1b..6c89896c 100644 --- a/zipline/protocol.py +++ b/zipline/protocol.py @@ -75,6 +75,9 @@ class Position(object): self.cost_basis = 0.0 # per share self.last_sale_price = 0.0 + def __getattr__(self, key): + return self.__dict__[key] + def __repr__(self): return "Position({0})".format(self.__dict__)