diff options
Diffstat (limited to 'python/analytics/tranche_basket.py')
| -rw-r--r-- | python/analytics/tranche_basket.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/python/analytics/tranche_basket.py b/python/analytics/tranche_basket.py index 48353b46..56d5b0f2 100644 --- a/python/analytics/tranche_basket.py +++ b/python/analytics/tranche_basket.py @@ -3,6 +3,7 @@ from .tranche_functions import ( credit_schedule, adjust_attachments, GHquad, BCloss_recov_dist, BCloss_recov_trunc, tranche_cl, tranche_pl, tranche_pl_trunc, tranche_cl_trunc) +from .exceptions import MissingDataError from .index_data import get_tranche_quotes from .utils import memoize, build_table, bus_day, next_twentieth from collections import namedtuple @@ -72,7 +73,7 @@ class Skew(): conn.commit() serenitas_pool.putconn(conn) if not K: - raise ValueError(f"No skew for {index_type}{series} {tenor} on {value_date}") + raise MissingDataError(f"No skew for {index_type}{series} {tenor} on {value_date}") K.append(100) K = np.array(K) / 100 K = adjust_attachments(K, cumloss/100, factor/100) @@ -406,7 +407,7 @@ class DualCorrTranche(): try: ref, = c.fetchone() except TypeError: - raise ValueError(f"No quote for date {self.value_date}") + raise MissingDataError(f"{type(self).__name__}: No market quote for date {self.value_date}") try: self._index.tweak([ref]) except NameError: @@ -424,7 +425,7 @@ class DualCorrTranche(): self.series, self.tenor, value_date=d)) - except ValueError as e: + except MissingDataError as e: logger.warning(str(e)) d -= bus_day logger.info(f"trying {d}") |
