aboutsummaryrefslogtreecommitdiffstats
path: root/python/analytics/portfolio.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/analytics/portfolio.py')
-rw-r--r--python/analytics/portfolio.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/python/analytics/portfolio.py b/python/analytics/portfolio.py
index ab9084b1..c337a978 100644
--- a/python/analytics/portfolio.py
+++ b/python/analytics/portfolio.py
@@ -131,6 +131,27 @@ class Portfolio:
raise ValueError("The number of refs doesn't match the number of indices")
@property
+ def spread(self):
+ if len(self.indices) == 1:
+ return self.indices[0].spread
+ else:
+ return [index.spread for index in self.indices]
+
+ @spread.setter
+ def spread(self, val):
+ if len(self.indices) == 1:
+ self.indices[0].spread = val
+ elif len(self.indices) == 0:
+ ##no index, so set the individual refs
+ for t in trades:
+ t.index.spread = val
+ elif len(self.indices) == len(val):
+ for index, val in zip(self.indices, val):
+ index.spread = val
+ else:
+ raise ValueError("The number of spreads doesn't match the number of indices")
+
+ @property
def delta(self):
"""returns the equivalent protection notional