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.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/python/analytics/portfolio.py b/python/analytics/portfolio.py
index c337a978..54d4cdeb 100644
--- a/python/analytics/portfolio.py
+++ b/python/analytics/portfolio.py
@@ -1,4 +1,4 @@
-from .index import Index, _key_from_index
+from .index import Index
from .option import BlackSwaption, VolatilitySurface
from db import dbengine
from warnings import warn
@@ -33,13 +33,8 @@ class Portfolio:
self.trades = trades
self.indices = [t for t in trades if isinstance(t, Index)]
self.swaptions = [t for t in trades if isinstance(t, BlackSwaption)]
- self._keys = []
- trade_dates = set()
- for index in self.indices:
- self._keys.append(_key_from_index(index))
- #pick the first available trade_date
- trade_dates.add(index.trade_date)
-
+ trade_dates = set(index.trade_date for index in self.indices)
+ self._keys = [(index.index_type, index.series, index.tenor) for index in self.indices]
for swaption in self.swaptions:
trade_dates.add(swaption.index.trade_date)
self._trade_date = trade_dates.pop()