diff options
Diffstat (limited to 'python/analytics/option.py')
| -rw-r--r-- | python/analytics/option.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/python/analytics/option.py b/python/analytics/option.py index c0989814..34f1b7a0 100644 --- a/python/analytics/option.py +++ b/python/analytics/option.py @@ -8,7 +8,7 @@ from db import dbengine from .black import black, Nx from .sabr import sabr from .utils import GHquad, build_table -from .index import g, ForwardIndex, Index +from .index import g, ForwardIndex, CreditIndex from .db import _engine from yieldcurve import roll_yc from pandas.tseries.offsets import BDay @@ -55,7 +55,7 @@ def ATMstrike(index, exercise_date): Parameters ---------- index : - Index object + CreditIndex object exercise_date : datetime.date expiration date. price : bool, defaults to False @@ -99,7 +99,7 @@ class BlackSwaption(ForwardIndex): if rec is None: return ValueError("trade_id doesn't exist") if index is None: - index = Index.from_name(redcode=rec.security_id, maturity=rec.maturity, value_date=rec.trade_date) + index = CreditIndex(redcode=rec.security_id, maturity=rec.maturity, value_date=rec.trade_date) index.ref = rec.index_ref instance = cls(index, rec.expiration_date, rec.strike, rec.swaption_type.lower(), direction="Long" if rec.buysell else "Short") @@ -519,6 +519,7 @@ class QuoteSurface(): r.append((quotedate, quotesource)) return r + class VolSurface(QuoteSurface): def __init__(self, index_type, series, tenor='5yr', value_date=datetime.date.today()): super().__init__(index_type, series, tenor, value_date) @@ -626,7 +627,7 @@ class ModelBasedVolSurface(VolSurface): def __init__(self, index_type, series, tenor='5yr', value_date=datetime.date.today(), interp_method='bivariate_spline'): super().__init__(index_type, series, tenor, value_date) - self._index = Index.from_name(index_type, series, tenor, value_date, notional=1.) + self._index = CreditIndex(index_type, series, tenor, value_date, notional=1.) self._surfaces = {} self._index_refs = {} self._quotes = self._quotes.assign( @@ -716,7 +717,7 @@ class ProbSurface(QuoteSurface): def __init__(self, index_type, series, tenor='5yr', value_date=datetime.date.today()): super().__init__(index_type, series, tenor, value_date) self._surfaces = {} - self._index = Index.from_name(index_type, series, tenor, value_date) + self._index = CreditIndex(index_type, series, tenor, value_date) def __getitem__(self, surface_id): if surface_id not in self._surfaces: |
